From 67b5716037e271bc5f05dff37da4fd7b21ca9155ececef6e678618118b00d202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 21 May 2019 10:23:36 +0000 Subject: [PATCH] Accepting request 704411 from LibreOffice:6.2 - LO-L3: PPTX: Rectangle turns from green to blue and loses transparency when transparency is set * bsc1135228.patch OBS-URL: https://build.opensuse.org/request/show/704411 OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=789 --- bsc1135228.patch | 199 ++++++++++++++++++++++++++++++++++++++++++++ libreoffice.changes | 6 ++ libreoffice.spec | 3 + 3 files changed, 208 insertions(+) create mode 100644 bsc1135228.patch diff --git a/bsc1135228.patch b/bsc1135228.patch new file mode 100644 index 0000000..4fa1889 --- /dev/null +++ b/bsc1135228.patch @@ -0,0 +1,199 @@ +diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx +index ab24a8262fae..bb9166e24afc 100644 +--- a/include/oox/ppt/presentationfragmenthandler.hxx ++++ b/include/oox/ppt/presentationfragmenthandler.hxx +@@ -50,7 +50,7 @@ private: + void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, + const oox::ppt::SlidePersistPtr& rPersist ); + void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); +- void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, const OUString& sTheme); ++ void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); + + std::vector< OUString > maSlideMasterVector; + std::vector< OUString > maSlidesVector; +diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx +index f2477b2cef6e..13bba2da95a3 100644 +--- a/oox/source/ppt/presentationfragmenthandler.cxx ++++ b/oox/source/ppt/presentationfragmenthandler.cxx +@@ -160,7 +160,7 @@ static void ResolveTextFields( XmlFilterBase const & rFilter ) + } + + void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, +- const OUString& sTheme) ++ sal_Int32 nThemeIdx) + { + if (!pThemePtr) + return; +@@ -198,8 +198,11 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme + aCurrentTheme[nId].Value = rColor; + } + ++ + // add new theme to the sequence +- aTheme[0].Name = sTheme; ++ // Export code uses the master slide's index to find the right theme ++ // so use the same index in the grabbag. ++ aTheme[0].Name = "ppt/theme/theme" + OUString::number(nThemeIdx) + ".xml"; + const uno::Any& rCurrentTheme = makeAny(aCurrentTheme); + aTheme[0].Value = rCurrentTheme; + +@@ -273,10 +276,17 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage + Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); + Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_QUERY_THROW ); + ++ sal_Int32 nIndex; + if( rFilter.getMasterPages().empty() ) +- xMasterPages->getByIndex( 0 ) >>= xMasterPage; ++ { ++ nIndex = 0; ++ xMasterPages->getByIndex( nIndex ) >>= xMasterPage; ++ } + else +- xMasterPage = xMasterPages->insertNewByIndex( xMasterPages->getCount() ); ++ { ++ nIndex = xMasterPages->getCount(); ++ xMasterPage = xMasterPages->insertNewByIndex( nIndex ); ++ } + + pMasterPersistPtr = std::make_shared( rFilter, true, false, xMasterPage, + ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpTextListStyle ); +@@ -306,7 +316,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage + UNO_QUERY_THROW)); + rThemes[ aThemeFragmentPath ] = pThemePtr; + pThemePtr->setFragment(xDoc); +- saveThemeToGrabBag(pThemePtr, aThemeFragmentPath); ++ saveThemeToGrabBag(pThemePtr, nIndex + 1); + } + else + { +diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx +index 24adf475be16..2da61a6f5300 100644 +--- a/include/oox/export/drawingml.hxx ++++ b/include/oox/export/drawingml.hxx +@@ -170,14 +170,14 @@ public: + OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false); + + void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); +- void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); +- void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); ++ void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); ++ void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); + void WriteGradientStop( sal_uInt16 nStop, ::Color nColor ); + void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); + void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); + + void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); +- void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); ++ void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); + void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); + void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); + void WriteGradientFill( css::awt::Gradient rGradient ); +diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx +index 23065ec67678..30f330226788 100644 +--- a/oox/source/export/drawingml.cxx ++++ b/oox/source/export/drawingml.cxx +@@ -231,7 +231,7 @@ void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha ) + } + } + +-void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< PropertyValue >& aTransformations ) ++void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) + { + // prevent writing a tag with empty val attribute + if( sColorSchemeName.isEmpty() ) +@@ -242,7 +242,15 @@ void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< Pr + mpFS->startElementNS( XML_a, XML_schemeClr, + XML_val, USS( sColorSchemeName ), + FSEND ); +- WriteColorTransformations( aTransformations ); ++ WriteColorTransformations( aTransformations, nAlpha ); ++ mpFS->endElementNS( XML_a, XML_schemeClr ); ++ } ++ else if(nAlpha < MAX_PERCENT) ++ { ++ mpFS->startElementNS( XML_a, XML_schemeClr, ++ XML_val, USS( sColorSchemeName ), ++ FSEND ); ++ mpFS->singleElementNS(XML_a, XML_alpha, XML_val, OString::number(nAlpha), FSEND); + mpFS->endElementNS( XML_a, XML_schemeClr ); + } + else +@@ -253,15 +261,22 @@ void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< Pr + } + } + +-void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTransformations ) ++void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) + { + for( sal_Int32 i = 0; i < aTransformations.getLength(); i++ ) + { + sal_Int32 nToken = Color::getColorTransformationToken( aTransformations[i].Name ); + if( nToken != XML_TOKEN_INVALID && aTransformations[i].Value.hasValue() ) + { +- sal_Int32 nValue = aTransformations[i].Value.get(); +- mpFS->singleElementNS( XML_a, nToken, XML_val, I32S( nValue ), FSEND ); ++ if(nToken == XML_alpha && nAlpha < MAX_PERCENT) ++ { ++ mpFS->singleElementNS( XML_a, nToken, XML_val, I32S( nAlpha ), FSEND ); ++ } ++ else ++ { ++ sal_Int32 nValue = aTransformations[i].Value.get(); ++ mpFS->singleElementNS( XML_a, nToken, XML_val, I32S( nValue ), FSEND ); ++ } + } + } + } +@@ -273,10 +288,10 @@ void DrawingML::WriteSolidFill( ::Color nColor, sal_Int32 nAlpha ) + mpFS->endElementNS( XML_a, XML_solidFill ); + } + +-void DrawingML::WriteSolidFill( const OUString& sSchemeName, const Sequence< PropertyValue >& aTransformations ) ++void DrawingML::WriteSolidFill( const OUString& sSchemeName, const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) + { + mpFS->startElementNS( XML_a, XML_solidFill, FSEND ); +- WriteColor( sSchemeName, aTransformations ); ++ WriteColor( sSchemeName, aTransformations, nAlpha ); + mpFS->endElementNS( XML_a, XML_solidFill ); + } + +@@ -326,22 +341,36 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) + else if ( !sColorFillScheme.isEmpty() ) + { + // the shape had a scheme color and the user didn't change it +- WriteSolidFill( sColorFillScheme, aTransformations ); ++ WriteSolidFill( sColorFillScheme, aTransformations, nAlpha ); + } + else if ( aStyleProperties.hasElements() ) + { + sal_uInt32 nThemeColor = 0; ++ sal_Int32 nThemeAlpha = MAX_PERCENT; + for( sal_Int32 i=0; i < aStyleProperties.getLength(); ++i ) + { + if( aStyleProperties[i].Name == "Color" ) + { + aStyleProperties[i].Value >>= nThemeColor; +- break; ++ } ++ else if(aStyleProperties[i].Name == "Transformations" ) ++ { ++ Sequence< PropertyValue > aStyleTransformations; ++ aStyleProperties[i].Value >>= aStyleTransformations; ++ for( sal_Int32 j = 0; j < aStyleTransformations.getLength(); j++ ) ++ { ++ if (aStyleTransformations[j].Name == "alpha" ) ++ { ++ aStyleTransformations[j].Value >>= nThemeAlpha; ++ break; ++ } ++ } + } + } +- if ( nFillColor != nThemeColor ) ++ if ( nFillColor != nThemeColor || nAlpha != nThemeAlpha ) + // the shape contains a theme but it wasn't being used + WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha ); ++ + // in case the shape used the style color and the user didn't change it, + // we must not write a tag. + } diff --git a/libreoffice.changes b/libreoffice.changes index ed99798..1e1aeba 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 21 06:33:21 UTC 2019 - Andras Timar + +- LO-L3: PPTX: Rectangle turns from green to blue and loses transparency when transparency is set + * bsc1135228.patch + ------------------------------------------------------------------- Thu May 16 12:40:39 UTC 2019 - Andras Timar diff --git a/libreoffice.spec b/libreoffice.spec index 5511b08..a78c078 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -107,6 +107,8 @@ Patch13: bsc1127760.patch Patch14: bsc1124869.patch # LO-L3: Image from PPTX shown in a square, not a circle Patch15: bsc1121874.patch +# LO-L3: PPTX: Rectangle turns from green to blue and loses transparency when transparency is set +Patch16: bsc1135228.patch # try to save space by using hardlinks Patch990: install-with-hardlinks.diff # save time by relying on rpm check rather than doing stupid find+grep @@ -973,6 +975,7 @@ Provides %{langname} translations and additional resources (help files, etc.) fo %patch13 -p1 %patch14 -p1 %patch15 -p1 +%patch16 -p1 %patch990 -p1 %patch991 -p1