[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/draw/shapeexport2.cxx | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) New commits: commit 9602a121b458e7456fc533dad86f434f846a72ba Author: Oliver-Rainer Wittmann o...@apache.org Date: Wed Jul 23 08:53:15 2014 + 125289: do apply possible changed GraphicStreamURL only for embedded images which already have its stream inside the package fixes also issue 125290 diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index 0014188..da20ef9 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -1147,9 +1147,12 @@ void XMLShapeExport::ImpExportGraphicObjectShape( OUString aResolveURL( sImageURL ); const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM( vnd.sun.star.Package: ) ); -// sj: trying to preserve the filename +// sj: trying to preserve the filename for embedded images which already have its stream inside the package +bool bIsEmbeddedImageWithExistingStreamInPackage = false; if ( aStreamURL.match( sPackageURL, 0 ) ) { +bIsEmbeddedImageWithExistingStreamInPackage = true; + rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; if ( ( nLastIndex 0 ) ( nLastIndex sRequestedName.getLength() ) ) @@ -1169,20 +1172,23 @@ void XMLShapeExport::ImpExportGraphicObjectShape( if ( !aStr.isEmpty() ) { -aStreamURL = sPackageURL; -if ( aStr[0] == '#' ) -{ -aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); -} -else +// apply possible changed stream URL to embedded image object +if ( bIsEmbeddedImageWithExistingStreamInPackage ) { -aStreamURL = aStreamURL.concat( aStr ); -} +aStreamURL = sPackageURL; +if ( aStr[0] == '#' ) +{ +aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); +} +else +{ +aStreamURL = aStreamURL.concat( aStr ); +} -// update stream URL for load on demand -uno::Any aAny; -aAny = aStreamURL; -xPropSet-setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( GraphicStreamURL ) ), aAny ); +uno::Any aAny; +aAny = aStreamURL; +xPropSet-setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( GraphicStreamURL ) ), aAny ); +} mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/text/txtexppr.cxx |8 1 file changed, 8 insertions(+) New commits: commit 1ae655db954030d04fb3a413d57af2e47bea53af Author: Oliver-Rainer Wittmann o...@apache.org Date: Fri Jul 4 08:19:12 2014 + 124107: ODF export - suppress export of fo:margin for paragraph styles diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 102523d..a9b7144 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -462,7 +462,9 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClipState = NULL; +// filter fo:margin XMLPropertyState* pAllParaMargin = NULL; +XMLPropertyState* pAllParaMarginRel = NULL; XMLPropertyState* pAllMargin = NULL; // @@ -586,6 +588,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break; case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; +case CTF_PARAMARGINALL_REL: pAllParaMarginRel = propertie; break; case CTF_MARGINALL: pAllMargin = propertie; break; // @@ -675,6 +678,11 @@ void XMLTextExportPropertySetMapper::ContextFilter( pAllParaMargin-mnIndex = -1; // just export individual attributes... pAllParaMargin-maValue.clear(); } +if (pAllParaMarginRel) +{ +pAllParaMarginRel-mnIndex = -1; // just export individual attributes... +pAllParaMarginRel-maValue.clear(); +} if (pAllMargin) { pAllMargin-mnIndex = -1; // just export individual attributes... ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/text/txtimppr.cxx | 41 ++-- 1 file changed, 35 insertions(+), 6 deletions(-) New commits: commit 9d50f2b20cdf409f30fe573afb6e8db20be0689e Author: Oliver-Rainer Wittmann o...@apache.org Date: Fri Jul 4 11:36:35 2014 + 124107: ODF import - ignore fo:margin=100% for paragraph styles as core attributes are not able to treat it correctly. The result is the same - value are inherited from parent diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index a748923..b76f6e1 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -312,9 +312,11 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pVertOrientRelAsChar = 0; XMLPropertyState* pBackTransparency = NULL; // transparency in % XMLPropertyState* pBackTransparent = NULL; // transparency as boolean + XMLPropertyState* pAllParaMargin = 0; XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 }; ::std::auto_ptrXMLPropertyState pNewParaMargins[4]; + XMLPropertyState* pAllMargin = 0; XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; ::std::auto_ptrXMLPropertyState pNewMargins[4]; @@ -385,21 +387,42 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = sal_True; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; + case CTF_PARAMARGINALL: +pAllParaMargin = property; +break; case CTF_PARAMARGINALL_REL: -pAllParaMargin = property; break; +{ +sal_uInt32 nValue; +property-maValue = nValue; +// treat fo:margin=100% as it is not exisiting as the +// corresponding core attribute classes - SvxULSpaceItem and +// SvxLRSpaceItem - are not able to treat such a value correctly. +// The result will be the same as the values will be inherited +// from parent, when the no margin attribute is given. +if ( nValue != 100 ) +{ +pAllParaMargin = property; +} +} +break; + case CTF_PARALEFTMARGIN: case CTF_PARALEFTMARGIN_REL: pParaMargins[XML_LINE_LEFT] = property; break; + case CTF_PARARIGHTMARGIN: case CTF_PARARIGHTMARGIN_REL: pParaMargins[XML_LINE_RIGHT] = property; break; + case CTF_PARATOPMARGIN: case CTF_PARATOPMARGIN_REL: pParaMargins[XML_LINE_TOP] = property; break; + case CTF_PARABOTTOMMARGIN: case CTF_PARABOTTOMMARGIN_REL: pParaMargins[XML_LINE_BOTTOM] = property; break; + case CTF_MARGINALL: pAllMargin = property; break; case CTF_MARGINLEFT: @@ -428,7 +451,8 @@ void XMLTextImportPropertyMapper::finished( for (sal_uInt16 i = 0; i 4; i++) { -if (pAllParaMargin !pParaMargins[i]) +if ( pAllParaMargin != NULL + pParaMargins[i] == NULL ) { #ifdef DBG_UTIL sal_Int16 nTmp = getPropertySetMapper()-GetEntryContextId( @@ -437,9 +461,12 @@ void XMLTextImportPropertyMapper::finished( nTmp = CTF_PARABOTTOMMARGIN_REL, wrong property context id ); #endif -pNewParaMargins[i].reset(new XMLPropertyState( -pAllParaMargin-mnIndex + (2*i) + 2, pAllParaMargin-maValue)); +// IMPORTANT NOTE: the index calculation depends on the right order in the property map +pNewParaMargins[i].reset( +new XMLPropertyState( pAllParaMargin-mnIndex + (2*i) + 2, + pAllParaMargin-maValue ) ); } + if (pAllMargin !pMargins[i]) { #ifdef DBG_UTIL @@ -448,8 +475,10 @@ void XMLTextImportPropertyMapper::finished( OSL_ENSURE( nTmp = CTF_MARGINLEFT nTmp = CTF_MARGINBOTTOM, wrong property context id ); #endif -pNewMargins[i].reset(new XMLPropertyState( -pAllMargin-mnIndex + i + 1, pAllMargin-maValue)); +// IMPORTANT NOTE: the index calculation depends on the right order in the property map +pNewMargins[i].reset( +new XMLPropertyState( pAllMargin-mnIndex + i + 1, + pAllMargin-maValue ) ); } if( pAllBorderDistance !pBorderDistances[i] ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/text/txtfldi.cxx | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) New commits: commit 3d038663f44b20efbe10ab9b7149e8e58b648f5f Author: Oliver-Rainer Wittmann o...@apache.org Date: Sun Apr 6 08:31:58 2014 + 124607: ODF import: check on certain property existence in annotation import to avoid exceptions diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 3e506fc..090f7fc 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -3760,13 +3760,17 @@ void XMLAnnotationImportContext::EndElement() uno::Referencecontainer::XEnumeration xFields(xFieldsAccess-createEnumeration()); while (xFields-hasMoreElements()) { -uno::Referencebeans::XPropertySet xCurrField(xFields-nextElement(), uno::UNO_QUERY); -OUString aFieldName; -xCurrField-getPropertyValue(sPropertyName) = aFieldName; -if ( aFieldName == aName ) +uno::Reference beans::XPropertySet xCurrField(xFields-nextElement(), uno::UNO_QUERY); +uno::Reference beans::XPropertySetInfo xCurrFieldPropInfo = xCurrField-getPropertySetInfo(); +if ( xCurrFieldPropInfo-hasPropertyByName( sPropertyName ) ) { -xPrevField.set( xCurrField, uno::UNO_QUERY ); -break; +OUString aFieldName; +xCurrField-getPropertyValue( sPropertyName ) = aFieldName; +if ( aFieldName == aName ) +{ +xPrevField.set( xCurrField, uno::UNO_QUERY ); +break; +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/draw/ximpcustomshape.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit bd17b89d9344b03297e12306208ba72090d10771 Author: Armin Le Grand a...@apache.org Date: Thu Mar 20 10:05:11 2014 + i124452 correct empty svg:viweBox, added missing include diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 98ae15a..96d82a0 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -52,6 +52,7 @@ #include com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp #include com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp #include com/sun/star/drawing/ProjectionMode.hpp +#include com/sun/star/drawing/HomogenMatrix3.hpp #include basegfx/vector/b2dvector.hxx #include hash_map ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - xmloff/source
xmloff/source/draw/ximpcustomshape.cxx | 44 - 1 file changed, 43 insertions(+), 1 deletion(-) New commits: commit 4e04ad3623f2ab4693dcd50a9934fc836e190a6f Author: Armin Le Grand a...@apache.org Date: Wed Mar 19 14:51:18 2014 + i124452 correct svg:viewBox for EnhancedCustomShape geometry import when no width and no height are given diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 3c65884..98ae15a 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -52,6 +52,7 @@ #include com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp #include com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp #include com/sun/star/drawing/ProjectionMode.hpp +#include basegfx/vector/b2dvector.hxx #include hash_map using namespace ::com::sun::star; @@ -853,7 +854,48 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference xml::sax case EAS_viewBox : { SdXMLImExViewBox aViewBox( rValue, GetImport().GetMM100UnitConverter() ); -awt::Rectangle aRect( aViewBox.GetX(), aViewBox.GetY(), aViewBox.GetWidth(), aViewBox.GetHeight() ); +awt::Rectangle aRect( +basegfx::fround(aViewBox.GetX()), +basegfx::fround(aViewBox.GetY()), +basegfx::fround(aViewBox.GetWidth()), +basegfx::fround(aViewBox.GetHeight())); + +if(0 == aRect.Width 0 == aRect.Height) +{ +// #124452# If in svg:viewBox no width and height is given the objects should normally +// not be visible at all, but in this case it is a bug in LO to write empty svg:viewBox +// entries for CustomShapes. To allow for a better ODF user experience, just correct this +// here by getting the real object scale from the already set transformation from the xShape. +// Hopefully LO will fix that bug (but this will still leave the files with the error), but +// even when not this will do no harm as long noone uses this state explicitely for some +// purpose (e.g. to really have CustomShapes without content, but unlikely). +// When they do fix this they will need this fix anyways to read their own misformed ODF files +// again, so I guess it will be taken, too... +uno::Reference beans::XPropertySet xProps(mrxShape, uno::UNO_QUERY_THROW); +uno::Any aObjectTransform = xProps-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(Transformation))); +drawing::HomogenMatrix3 aTransformMatrix; +aObjectTransform = aTransformMatrix; +basegfx::B2DHomMatrix aMatrix; + +aMatrix.set(0, 0, aTransformMatrix.Line1.Column1); +aMatrix.set(0, 1, aTransformMatrix.Line1.Column2); +aMatrix.set(0, 2, aTransformMatrix.Line1.Column3); +aMatrix.set(1, 0, aTransformMatrix.Line2.Column1); +aMatrix.set(1, 1, aTransformMatrix.Line2.Column2); +aMatrix.set(1, 2, aTransformMatrix.Line2.Column3); +aMatrix.set(2, 0, aTransformMatrix.Line3.Column1); +aMatrix.set(2, 1, aTransformMatrix.Line3.Column2); +aMatrix.set(2, 2, aTransformMatrix.Line3.Column3); + +basegfx::B2DVector aScale, aTranslate; +double fRotate, fShearX; + +aMatrix.decompose(aScale, aTranslate, fRotate, fShearX); + +aRect.Width = basegfx::fround(fabs(aScale.getX())); +aRect.Height = basegfx::fround(fabs(aScale.getY())); +} + beans::PropertyValue aProp; aProp.Name = EASGet( EAS_ViewBox ); aProp.Value = aRect; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits