- 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
200 lines
10 KiB
Diff
200 lines
10 KiB
Diff
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<SlidePersist>( 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<sal_Int32>();
|
|
- 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<sal_Int32>();
|
|
+ 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 <a: solidFill> tag.
|
|
}
|