[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2018-03-10 Thread Tomaž Vajngerl
 include/xmloff/xmlimp.hxx |5 --
 xmloff/source/core/xmlimp.cxx |   38 --
 xmloff/source/draw/XMLReplacementImageContext.cxx |   37 -
 xmloff/source/forms/elementimport.cxx |   31 +++--
 xmloff/source/forms/elementimport.hxx |2 +
 xmloff/source/forms/layerimport.cxx   |4 --
 xmloff/source/forms/propertyexport.hxx|2 -
 xmloff/source/forms/strings.hxx   |2 -
 8 files changed, 46 insertions(+), 75 deletions(-)

New commits:
commit 7ba32a63cf6064b5ad6e27c95ea3d9fa01ef19b1
Author: Tomaž Vajngerl 
Date:   Sat Mar 10 22:27:12 2018 +0900

xmloff: convert replacement image loading to use "Graphic" prop.

With this change ResolveGraphicObjectURLFromBase64 and
ResolveGraphicObjectURL became unused and are also removed with
this commit.

Change-Id: I45428a4e47f0e8800f18c1fdba007293dfcb53f4
Reviewed-on: https://gerrit.libreoffice.org/51043
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 3249b6797ae7..926a44d08f59 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -406,10 +406,7 @@ public:
 // internal package URL. The later one happens only if bLoadURL is true
 OUString ResolveGraphicObjectURL( const OUString& rURL, bool bLoadOnDemand 
);
 
-css::uno::Reference< css::io::XOutputStream >
-  GetStreamForGraphicObjectURLFromBase64();
-OUString ResolveGraphicObjectURLFromBase64(
-const css::uno::Reference< css::io::XOutputStream >& rOut );
+css::uno::Reference< css::io::XOutputStream > 
GetStreamForGraphicObjectURLFromBase64();
 
 bool IsPackageURL( const OUString& rURL ) const;
 OUString ResolveEmbeddedObjectURL( const OUString& rURL,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a58f32ba861b..3c1e8bb0c6ea 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1399,33 +1399,6 @@ uno::Reference 
SvXMLImport::loadGraphicFromBase64(uno::Refere
 return xGraphic;
 }
 
-OUString SvXMLImport::ResolveGraphicObjectURL( const OUString& rURL,
-  bool bLoadOnDemand )
-{
-OUString sRet;
-
-if( IsPackageURL( rURL ) )
-{
-if( !bLoadOnDemand && mxGraphicResolver.is() )
-{
-OUString aTmp( msPackageProtocol );
-aTmp += rURL;
-sRet = mxGraphicResolver->resolveGraphicObjectURL( aTmp );
-}
-
-if( sRet.isEmpty() )
-{
-sRet = msPackageProtocol;
-sRet += rURL;
-}
-}
-
-if( sRet.isEmpty() )
-sRet = GetAbsoluteReference( rURL );
-
-return sRet;
-}
-
 Reference< XOutputStream > 
SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
 {
 Reference< XOutputStream > xOStm;
@@ -1437,17 +1410,6 @@ Reference< XOutputStream > 
SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
 return xOStm;
 }
 
-OUString SvXMLImport::ResolveGraphicObjectURLFromBase64(
- const Reference < XOutputStream >& rOut )
-{
-OUString sURL;
-Reference< document::XBinaryStreamResolver > xStmResolver( 
mxGraphicResolver, UNO_QUERY );
-if( xStmResolver.is() )
-sURL = xStmResolver->resolveOutputStream( rOut );
-
-return sURL;
-}
-
 OUString SvXMLImport::ResolveEmbeddedObjectURL(
 const OUString& rURL,
 const OUString& rClassId )
diff --git a/xmloff/source/draw/XMLReplacementImageContext.cxx 
b/xmloff/source/draw/XMLReplacementImageContext.cxx
index cbea729a59af..eb5f6ea52c15 100644
--- a/xmloff/source/draw/XMLReplacementImageContext.cxx
+++ b/xmloff/source/draw/XMLReplacementImageContext.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,7 +32,7 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::makeAny;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::beans;
-
+using namespace css;
 
 XMLReplacementImageContext::XMLReplacementImageContext(
 SvXMLImport& rImport,
@@ -75,25 +76,29 @@ void XMLReplacementImageContext::EndElement()
 "neither URL nor base64 image data given" );
 rtl::Reference < XMLTextImportHelper > xTxtImport =
 GetImport().GetTextImport();
-OUString sHRef;
-if( !m_sHRef.isEmpty() )
+uno::Reference xGraphic;
+
+try
 {
-bool bForceLoad = xTxtImport->IsInsertMode() ||
-  xTxtImport->IsBlockMode() ||
-  xTxtImport->IsStylesOnlyMode() ||
-  xTxtImport->IsOrganizerMode();
-sHRef = 

[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2017-10-17 Thread Michael Stahl
 include/xmloff/xmlprhdl.hxx |   10 +++---
 xmloff/source/style/EnumPropertyHdl.cxx |2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit dc8c9d8052293055f31b56fcd5db56ce13306a65
Author: Michael Stahl 
Date:   Tue Oct 17 17:48:11 2017 +0200

xmloff: document return value

Change-Id: I0b2012d2134a94603d95ce5a955f03944e344561

diff --git a/include/xmloff/xmlprhdl.hxx b/include/xmloff/xmlprhdl.hxx
index 0aba91b432f4..9c9a6f79b8de 100644
--- a/include/xmloff/xmlprhdl.hxx
+++ b/include/xmloff/xmlprhdl.hxx
@@ -36,7 +36,6 @@ struct XMLPropertyState;
 */
 class XMLOFF_DLLPUBLIC XMLPropertyHandler
 {
-// ??? const SvXMLUnitConverter& rUnitConverter Do we need this ?
 
 public:
 // Just needed for virtual destruction
@@ -46,9 +45,14 @@ public:
 By default the Any-equal-operator is called. */
 virtual bool equals( const css::uno::Any& r1, const css::uno::Any& r2 ) 
const;
 
-/// Imports the given value in cas of the given XML-data-type
+/** Imports the given value according to the XML-data-type corresponding to
+the derived class.
+@retval true if the value was successfully converted to Any
+@retval false if the value was not recognised (warning will be printed)
+ */
 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& 
rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
-/// Exports the given value in case of the given XML-data-type
+/// Exports the given value according to the XML-data-type corresponding to
+/// the derived class.
 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& 
rValue, const SvXMLUnitConverter& rUnitConverter ) const =0;
 };
 
commit 99772908d741c39236f36b06e237810031b8851a
Author: Michael Stahl 
Date:   Tue Oct 17 17:22:18 2017 +0200

xmloff: this should be an assert()

Change-Id: Ib81fd7f72964d7152c62d1f9b90dc0cf95e952cc

diff --git a/xmloff/source/style/EnumPropertyHdl.cxx 
b/xmloff/source/style/EnumPropertyHdl.cxx
index c20fd050676c..d4b1ee091c4b 100644
--- a/xmloff/source/style/EnumPropertyHdl.cxx
+++ b/xmloff/source/style/EnumPropertyHdl.cxx
@@ -56,7 +56,7 @@ bool XMLEnumPropertyHdl::importXML( const OUString& 
rStrImpValue, Any& rValue, c
 rValue <<= (sal_Int8) nValue;
 break;
 default:
-OSL_FAIL( "Wrong type for enum property handler!" );
+assert(!"Wrong type for enum property handler!");
 return false;
 }
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2016-09-13 Thread Eike Rathke
 include/xmloff/xmlnumfi.hxx  |2 -
 xmloff/source/style/xmlnumfi.cxx |   41 +--
 2 files changed, 28 insertions(+), 15 deletions(-)

New commits:
commit e12c9b41012e44275761b35795b83ec4bc838d42
Author: Eike Rathke 
Date:   Tue Sep 13 19:33:11 2016 +0200

do not add calendar modifier to format code when importing as E or EE 
keyword

... with implicit calendar switch.

Change-Id: Ie4d848e261fe86bbe504954b2e0c7cf24bc181bc

diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
index a3eb590..10283e6 100644
--- a/include/xmloff/xmlnumfi.hxx
+++ b/include/xmloff/xmlnumfi.hxx
@@ -186,7 +186,7 @@ public:
 void SetHasLongDoW(bool bSet)   { bHasLongDoW = bSet; }
 bool HasEra() const { return bHasEra; }
 
-void UpdateCalendar( const OUString& rNewCalendar );
+void UpdateCalendar( const OUString& rNewCalendar, bool 
bImplicitSecondaryCalendarEC = false );
 
 const LocaleDataWrapper& GetLocaleData() const;
 
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 164ce76..257d945 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1201,20 +1201,33 @@ void SvXMLNumFmtElementContext::EndElement()
 : ( bEffLong ? NF_KEY_MM : NF_KEY_M ) ) );
 break;
 case XML_TOK_STYLE_YEAR:
-rParent.UpdateCalendar( sCalendar );
 //! I18N doesn't provide SYSTEM or extended date information yet
-// Y after G (era) is replaced by E, also if we're switching to the
-// other second known calendar for a locale.
-if ( rParent.HasEra() || 
rParent.GetLocaleData().doesSecondaryCalendarUseEC( sCalendar))
 {
-rParent.AddNfKeyword(
-sal::static_int_cast< sal_uInt16 >(
-bEffLong ? NF_KEY_EEC : NF_KEY_EC ) );
+// Y after G (era) is replaced by E, also if we're switching 
to the
+// other second known calendar for a locale.
+bool bImplicitEC = (!sCalendar.isEmpty() &&
+rParent.GetLocaleData().doesSecondaryCalendarUseEC( 
sCalendar));
+if (rParent.HasEra() || bImplicitEC)
+{
+// If E or EE is the first format keyword, passing
+// bImplicitEC=true suppresses the superfluous calendar
+// modifier for this format. This does not help for
+// something like [~cal]DD/MM/EE but so far only YMD order
+// is used with such calendars. Live with the modifier if
+// other keywords precede this.
+rParent.UpdateCalendar( sCalendar, bImplicitEC);
+rParent.AddNfKeyword(
+sal::static_int_cast< sal_uInt16 >(
+bEffLong ? NF_KEY_EEC : NF_KEY_EC ) );
+}
+else
+{
+rParent.UpdateCalendar( sCalendar );
+rParent.AddNfKeyword(
+sal::static_int_cast< sal_uInt16 >(
+bEffLong ? NF_KEY_ : NF_KEY_YY ) );
+}
 }
-else
-rParent.AddNfKeyword(
-sal::static_int_cast< sal_uInt16 >(
-bEffLong ? NF_KEY_ : NF_KEY_YY ) );
 break;
 case XML_TOK_STYLE_ERA:
 rParent.UpdateCalendar( sCalendar );
@@ -2257,12 +2270,12 @@ void SvXMLNumFormatContext::AddColor( sal_uInt32 const 
nColor )
 }
 }
 
-void SvXMLNumFormatContext::UpdateCalendar( const OUString& rNewCalendar )
+void SvXMLNumFormatContext::UpdateCalendar( const OUString& rNewCalendar, bool 
bImplicitSecondaryCalendarEC )
 {
 if ( rNewCalendar != sCalendar )
 {
 sCalendar = rNewCalendar;
-if ( !sCalendar.isEmpty() )
+if ( !sCalendar.isEmpty() && !bImplicitSecondaryCalendarEC )
 {
 aFormatCode.append( "[~" );// intro for calendar code
 aFormatCode.append( sCalendar );
commit 426723912fcb9bca39e0cada68e209f5f1be927c
Author: Eike Rathke 
Date:   Tue Sep 13 16:18:32 2016 +0200

that copypasta comment fragment makes no sense

Change-Id: I835fd6045e5ab5aeb93c91edb07037b1ed3ea4a9

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 1fd5afd..164ce76 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -2266,7 +2266,7 @@ void SvXMLNumFormatContext::UpdateCalendar( const 
OUString& rNewCalendar )
 {
 aFormatCode.append( "[~" );// intro for calendar code
 aFormatCode.append( sCalendar );
-aFormatCode.append( ']' );// end of "new" currency 

[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2016-06-23 Thread Jan Holesovsky
 include/xmloff/SchXMLImportHelper.hxx |3 ++
 xmloff/source/chart/SchXMLAxisContext.cxx |   28 ++--
 xmloff/source/chart/SchXMLChartContext.cxx|   30 +++---
 xmloff/source/chart/SchXMLImport.cxx  |   18 ++-
 xmloff/source/chart/SchXMLLegendContext.cxx   |   10 
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |   27 ++-
 6 files changed, 35 insertions(+), 81 deletions(-)

New commits:
commit 4d1118e5cc9f2a4dc20ea73fba4cb09d9e2a3ce5
Author: Jan Holesovsky 
Date:   Thu Jun 23 10:22:34 2016 +0200

Simplify dynamic_cast followed by a static_cast.

Change-Id: Ia8b1145d43828a40611e5f59651d9dc6ff7d5360

diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx 
b/xmloff/source/chart/SchXMLAxisContext.cxx
index 652e223..41fad4d7 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -465,17 +465,13 @@ void SchXMLAxisContext::CreateAxis()
 if( !m_aAutoStyleName.isEmpty())
 {
 const SvXMLStylesContext* pStylesCtxt = 
m_rImportHelper.GetAutoStylesContext();
-if( pStylesCtxt )
+if (pStylesCtxt)
 {
-const SvXMLStyleContext* pStyle = 
pStylesCtxt->FindStyleChildContext(
-SchXMLImportHelper::GetChartFamilyID(), m_aAutoStyleName );
+SvXMLStyleContext* pStyle = 
const_cast(pStylesCtxt->FindStyleChildContext(SchXMLImportHelper::GetChartFamilyID(),
 m_aAutoStyleName));
 
-if( pStyle && dynamic_cast( 
pStyle) !=  nullptr)
+if (XMLPropStyleContext * pPropStyleContext = 
dynamic_cast(pStyle))
 {
-// note: SvXMLStyleContext::FillPropertySet is not const
-XMLPropStyleContext * pPropStyleContext = const_cast< 
XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
-if( pPropStyleContext )
-pPropStyleContext->FillPropertySet( m_xAxisProps );
+pPropStyleContext->FillPropertySet(m_xAxisProps);
 
 if( m_bAdaptWrongPercentScaleValues && 
m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y )
 {
@@ -498,7 +494,7 @@ void SchXMLAxisContext::CreateAxis()
 if( xAxisSuppl.is() )
 {
 Reference< beans::XPropertySet > xXAxisProp( 
xAxisSuppl->getAxis(0), uno::UNO_QUERY );
-const_cast( static_cast< 
const XMLPropStyleContext* >( pStyle ))->FillPropertySet( xXAxisProp );
+pPropStyleContext->FillPropertySet(xXAxisProp);
 }
 
 //set scale data of added x axis back to default
commit a07a69850acddae631d6bd9496ace0c35accdda5
Author: Jan Holesovsky 
Date:   Thu Jun 23 10:18:35 2016 +0200

Introduce FillAutoStyle() method to reduce copy'n'paste.

Change-Id: Ibdb6ae15790cc117d3d8c41c57924f9b22e85cba

diff --git a/include/xmloff/SchXMLImportHelper.hxx 
b/include/xmloff/SchXMLImportHelper.hxx
index 415a9a0..765a960 100644
--- a/include/xmloff/SchXMLImportHelper.hxx
+++ b/include/xmloff/SchXMLImportHelper.hxx
@@ -100,6 +100,9 @@ public:
 void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { 
mpAutoStyles = pAutoStyles; }
 SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
 
+/// Fill in the autostyle.
+void FillAutoStyle(const OUString& rAutoStyleName, const 
css::uno::Reference& rProp);
+
 const css::uno::Reference< css::chart::XChartDocument >& GetChartDocument()
 { return mxChartDoc; }
 
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx 
b/xmloff/source/chart/SchXMLAxisContext.cxx
index 9feded2..652e223 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -219,18 +219,8 @@ void SchXMLAxisContext::CreateGrid( const OUString& 
sAutoStyleName, bool bIsMajo
 // the line color is black as default, in the model it is a light gray
 xGridProp->setPropertyValue("LineColor",
  uno::makeAny( COL_BLACK ));
-if( !sAutoStyleName.isEmpty())
-{
-const SvXMLStylesContext* pStylesCtxt = 
m_rImportHelper.GetAutoStylesContext();
-if( pStylesCtxt )
-{
-const SvXMLStyleContext* pStyle = 
pStylesCtxt->FindStyleChildContext(
-SchXMLImportHelper::GetChartFamilyID(), sAutoStyleName );
-
-if( pStyle && dynamic_cast( 
pStyle) !=  nullptr)
-const_cast( static_cast< const 
XMLPropStyleContext* >( pStyle ))->FillPropertySet( xGridProp );
-}
-}
+if (!sAutoStyleName.isEmpty())

[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2014-04-16 Thread Michael Stahl
 include/xmloff/xmlimp.hxx  |7 +++
 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx |5 +
 xmloff/source/meta/xmlmetai.cxx|3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 426077fbea57facf9907cff2431d8f669713d6da
Author: Michael Stahl mst...@redhat.com
Date:   Wed Apr 16 12:11:39 2014 +0200

fdo#77027: add some comments to prevent such oversights

Change-Id: I381c9738bba3e422e01324fa0c781c857db3d360

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index d4a7480..8790f77 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -430,11 +430,18 @@ public:
 static const sal_uInt16 OOo_34x = 34;
 // for AOO, no release overlaps with OOo, so continue OOo version numbers
 static const sal_uInt16 AOO_40x = 40;
+// @ATTENTION: it's not usually ok to use the 4x wildcard in an ==
+// comparison, since that will match unreleased versions too; it is also
+// risky to use it in  comparison, because it requires checking and
+// possibly adapting all such uses when a new value for a more specific
+// version is added.
 static const sal_uInt16 AOO_4x = 41;
 static const sal_uInt16 LO_flag = 0x100;
 static const sal_uInt16 LO_3x = 30 | LO_flag;
 static const sal_uInt16 LO_41x = 41 | LO_flag;
 static const sal_uInt16 LO_42x = 42 | LO_flag;
+/// @ATTENTION: when adding a new value more specific than 4x, grep for
+/// all current uses and adapt them!!!
 static const sal_uInt16 LO_4x = 43 | LO_flag;
 static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
 
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx 
b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index afbe579..9753a3f 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -125,6 +125,11 @@ void XMLGraphicsDefaultStyle::SetDefaults()
 xDefaults-setPropertyValue(IsFollowingTextFlow, uno::makeAny(true));
 }
 
+// NOTE: the only reason why it's legal to check == (not ) against
+// arbitrary versions here is that the default value of these attributes
+// is not defined by ODF, therefore it is implementation-defined
+// (and we of course must not override any attributes that are actually
+// in the document, so check for that)
 bool const bIsAOO4(
GetImport().getGeneratorVersion() = SvXMLImport::AOO_40x
  GetImport().getGeneratorVersion() = SvXMLImport::AOO_4x);
commit 5d53cabb52648507086a39e06803624949e4a301
Author: Michael Stahl mst...@redhat.com
Date:   Wed Apr 16 12:07:56 2014 +0200

xmloff: we used to call it LOdev back in 4.0 so check that too

Change-Id: Icb7a82267d935a3ca28569657f8e8dc0ba240a5f

diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 17122cb..01117e1 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -268,7 +268,8 @@ void SvXMLMetaDocumentContext::setBuildId(OUString const 
i_rBuildId, const uno:
 
 OUString rest;
 if (i_rBuildId.startsWith(LibreOffice/, rest) ||
-i_rBuildId.startsWith(LibreOfficeDev/, rest))
+i_rBuildId.startsWith(LibreOfficeDev/, rest) ||
+i_rBuildId.startsWith(LOdev/, rest))
 {
 OUStringBuffer sNumber;
 for (sal_Int32 i = 0; i  rest.getLength(); ++i)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2013-05-03 Thread David Tardon
 include/xmloff/unointerfacetouniqueidentifiermapper.hxx |   17 
 include/xmloff/xmlmultiimagehelper.hxx  |6 +
 xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx |   41 +++
 xmloff/source/core/xmlmultiimagehelper.cxx  |6 +
 xmloff/source/draw/ximpshap.cxx |   43 +---
 xmloff/source/draw/ximpshap.hxx |1 
 6 files changed, 102 insertions(+), 12 deletions(-)

New commits:
commit 30b248dfe5bfb8a0649e36f22c943b3feb2f1385
Author: David Tardon dtar...@redhat.com
Date:   Fri May 3 06:15:30 2013 +0200

fdo#60075 open drawings with connector attached to SVG

This problem arises when there is a connector attached to draw:frame
element with multiple draw:image elements in it. The import code expects
that they are different representations of the same image (I have not
found if this is specified in ODF), so it only selects the most
suitable for import. To do that, it imports them all and then removes
all but the selected one. The image import context,
SdXMLGraphicObjectShapeContext, shares the parent frame's attributes,
which means that all the images in a frame have got the same ID. in
SdXMLGraphicObjectShapeContext::AddShape, the created css::draw::XShape
is registered with its ID... That means that anything that refers to the
frame's ID, like a draw:connector, will always get the _first_ image in
the frame.

Solution is to extend comphelper::UnoInterfaceToUniqueIdentifierMapper
to allow reserving an identifier and setting an interface for it later.
That way, SdXMLFrameShapeContext can reserve its own ID before it starts
importing the first draw:image, and then set the selected XShape at the
end.

Change-Id: I2e11cfd38e1e3534df2b3c01d85da0d755a266c3

diff --git a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx 
b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
index e538cbe..5919296 100644
--- a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
+++ b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
@@ -24,6 +24,7 @@
 #include xmloff/dllapi.h
 #include sal/types.h
 
+#include deque
 #include map
 #include rtl/ustring.hxx
 #include com/sun/star/uno/XInterface.hpp
@@ -35,6 +36,8 @@ typedef ::std::map OUString, const 
::com::sun::star::uno::Reference ::com::sun
 
 class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper
 {
+typedef std::deque rtl::OUString  Reserved_t;
+
 public:
 UnoInterfaceToUniqueIdentifierMapper();
 
@@ -50,6 +53,17 @@ public:
 */
 bool registerReference( const OUString rIdentifier, const 
::com::sun::star::uno::Reference ::com::sun::star::uno::XInterface  
rInterface );
 
+/** reserves an identifier for later registration.
+
+@returns
+false, if the identifier already exists
+  */
+bool reserveIdentifier( const rtl::OUString rIdentifier );
+
+/** registers the given uno object with reserved identifier.
+  */
+bool registerReservedReference( const rtl::OUString rIdentifier, const 
com::sun::star::uno::Reference com::sun::star::uno::XInterface  rInterface );
+
 /** @returns
 the identifier for the given uno object. If this uno object is not 
already
 registered, an empty string is returned
@@ -65,9 +79,12 @@ public:
 private:
 bool findReference( const ::com::sun::star::uno::Reference 
::com::sun::star::uno::XInterface  rInterface, IdMap_t::const_iterator rIter 
) const;
 bool findIdentifier( const OUString rIdentifier, IdMap_t::const_iterator 
rIter ) const;
+bool findReserved( const OUString rIdentifier ) const;
+bool findReserved( const OUString rIdentifier, 
Reserved_t::const_iterator rIter ) const;
 
 IdMap_tmaEntries;
 sal_Int32 mnNextId;
+Reserved_t maReserved;
 };
 
 }
diff --git a/include/xmloff/xmlmultiimagehelper.hxx 
b/include/xmloff/xmlmultiimagehelper.hxx
index cb0a290..bbe9ce1 100644
--- a/include/xmloff/xmlmultiimagehelper.hxx
+++ b/include/xmloff/xmlmultiimagehelper.hxx
@@ -41,8 +41,10 @@ public:
 virtual ~multiImageImportHelper();
 
 /// solve multiple imported images. The most valuable one is choosen,
-/// see imlementation for evtl. changing weights and/or adding filetypes
-void solveMultipleImages();
+/// see imlementation for evtl. changing weights and/or adding filetypes.
+///
+/// @returns import context of the selected image
+const SvXMLImportContext* solveMultipleImages();
 
 /// add a content to the remembered image import contexts
 void addContent(const SvXMLImportContext rSvXMLImportContext);
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx 
b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index 87e54d7..4b2b9db 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ 

[Libreoffice-commits] core.git: 2 commits - include/xmloff xmloff/source

2013-05-03 Thread David Tardon
 include/xmloff/unointerfacetouniqueidentifiermapper.hxx |1 +
 xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx |8 
 xmloff/source/core/xmlmultiimagehelper.cxx  |4 
 3 files changed, 13 insertions(+)

New commits:
commit 2f2e4d88db426e3b09c8f4cf6bb8dd6bc5f349e4
Author: David Tardon dtar...@redhat.com
Date:   Fri May 3 15:19:25 2013 +0200

add a warning

Change-Id: I0baf90cfe8d3caa96f826695c1be4bc563864c00

diff --git a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx 
b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
index 5919296..6f154bf 100644
--- a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
+++ b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx
@@ -40,6 +40,7 @@ class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper
 
 public:
 UnoInterfaceToUniqueIdentifierMapper();
+~UnoInterfaceToUniqueIdentifierMapper();
 
 /** returns a unique identifier for the given uno object. IF a uno object 
is
 registered more than once, the returned identifier is always the same.
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx 
b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index 4b2b9db..bbbc874 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -33,6 +33,14 @@ 
UnoInterfaceToUniqueIdentifierMapper::UnoInterfaceToUniqueIdentifierMapper()
 {
 }
 
+UnoInterfaceToUniqueIdentifierMapper::~UnoInterfaceToUniqueIdentifierMapper()
+{
+SAL_WARN_IF( !maReserved.empty(), xmloff,
+there are   maReserved.size()
+  ids left. This means a data loss: some connection(s) to 
shape(s) are missing.
+);
+}
+
 /** returns a unique identifier for the given uno object. IF a uno object is
 registered more than once, the returned identifier is always the same.
 */
commit 4f4f450eaf9dad85d28fcd58b01c0f51ff0bd5ef
Author: David Tardon dtar...@redhat.com
Date:   Fri May 3 14:58:26 2013 +0200

fdo#60075 need to return context when available

Change-Id: I53a83a3f2234dc061c23344116b0e294594f1c90

diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx 
b/xmloff/source/core/xmlmultiimagehelper.cxx
index e33c443..3d2dc77 100644
--- a/xmloff/source/core/xmlmultiimagehelper.cxx
+++ b/xmloff/source/core/xmlmultiimagehelper.cxx
@@ -129,6 +129,10 @@ const SvXMLImportContext* 
multiImageImportHelper::solveMultipleImages()
 removeGraphicFromImportContext(**maImplContextVector[a]);
 }
 }
+else if (maImplContextVector.size() == 1)
+{
+pContext = *maImplContextVector.front();
+}
 
 return pContext;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits