[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source
include/oox/ppt/presentationfragmenthandler.hxx |8 ++-- oox/source/ppt/presentationfragmenthandler.cxx | 42 2 files changed, 26 insertions(+), 24 deletions(-) New commits: commit 9925d34afafc714d9c9c26f295fb7f88493c071d Author: Henry Castro AuthorDate: Mon Oct 9 07:34:02 2023 -0400 Commit: Henry Castro CommitDate: Wed Nov 1 14:08:22 2023 +0100 tdf#155512: oox: ppt: fix import master slides, follow up Import all master slides. Signed-off-by: Henry Castro Change-Id: Ieac68bacf15c75e4c23ec692aadcb16033cdd092 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157701 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158716 Tested-by: Jenkins (cherry picked from commit b835bcfad2290c37c60d2fab0f276ab57aef56c1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158697 diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 29204b282bdb..20fc521ae8c5 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -52,10 +52,10 @@ private: void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, const oox::ppt::SlidePersistPtr& rPersist ); void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); -oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, -::oox::ppt::PowerPointImport& rFilter, -std::u16string_view rLayoutFragmentPath, -std::u16string_view rMasterFragmentPath); +void importMasterSlides(); +void importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, + ::oox::ppt::PowerPointImport& rFilter, + const OUString& rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index dab9648cb025..b7730ef32faf 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -215,18 +215,16 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& } } -SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, - PowerPointImport& rFilter, - std::u16string_view rLayoutFragmentPath, - std::u16string_view rMasterFragmentPath) +void PresentationFragmentHandler::importMasterSlide(const Reference& xModel, +PowerPointImport& rFilter, +const OUString& rMasterFragmentPath) { OUString aLayoutFragmentPath; -OUString aMasterFragmentPath(rMasterFragmentPath); -SlidePersistPtr pMasterPersistPtr, pMasterPtr; +SlidePersistPtr pMasterPersistPtr; Reference< drawing::XDrawPage > xMasterPage; Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); -RelationsRef xMasterRelations = rFilter.importRelations( aMasterFragmentPath ); +RelationsRef xMasterRelations = rFilter.importRelations( rMasterFragmentPath ); for (const auto& rEntry : *xMasterRelations) { @@ -252,7 +250,7 @@ SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const ReferencesetLayoutPath( aLayoutFragmentPath ); rFilter.getMasterPages().push_back( pMasterPersistPtr ); rFilter.setActualSlidePersist( pMasterPersistPtr ); -FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) ); +FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) ); // set the correct theme OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" ); @@ -297,14 +295,7 @@ SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const ReferenceaddTheme(pMasterPersistPtr->getPage()); } - -if (pMasterPersistPtr->getLayoutPath() == rLayoutFragmentPath) -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source
include/oox/helper/graphichelper.hxx |3 ++- oox/source/helper/graphichelper.cxx |9 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) New commits: commit ba46f840fd0bf75aa71d4a5c3ab45204396e3948 Author: Balazs Varga AuthorDate: Thu Oct 26 18:11:40 2023 +0200 Commit: Michael Stahl CommitDate: Mon Oct 30 11:42:42 2023 +0100 tdf#156593 FILEOPEN OOXML: image shown in full instead of cropped Revert "Revert "tdf#118133 DOCX import: disable lazy-loading of tiff images"" This reverts commit c6bf16909db054ec5467ebdc0ea0c9dc07307048. Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM and the crop values are relative to original bitmap size. Change-Id: I2dbf6caf08d7899ec2eae683996d997809d62b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158509 Tested-by: Jenkins Reviewed-by: Balazs Varga (cherry picked from commit c3ce373227433f40d686847a22e78651bedbab24) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158533 Reviewed-by: Michael Stahl diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index 32e699ed3468..0d0b69216617 100644 --- a/include/oox/helper/graphichelper.hxx +++ b/include/oox/helper/graphichelper.hxx @@ -121,7 +121,8 @@ public: css::uno::Reference< css::graphic::XGraphic > importGraphic( const css::uno::Reference< css::io::XInputStream >& rxInStrm, -const WmfExternal* pExtHeader = nullptr ) const; +const WmfExternal* pExtHeader = nullptr, +const bool bLazyLoad = true ) const; /** Imports a graphic from the passed binary memory block. */ css::uno::Reference< css::graphic::XGraphic > diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index d197b341da70..830f0131284b 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -229,13 +229,13 @@ awt::Size GraphicHelper::convertHmmToAppFont( const awt::Size& rHmm ) const // Graphics and graphic objects -- Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStream >& rxInStrm, -const WmfExternal* pExtHeader ) const +const WmfExternal* pExtHeader, const bool bLazyLoad ) const { Reference< XGraphic > xGraphic; if( rxInStrm.is() && mxGraphicProvider.is() ) try { Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", rxInStrm), - comphelper::makePropertyValue("LazyRead", true) }; + comphelper::makePropertyValue("LazyRead", bLazyLoad) }; if ( pExtHeader && pExtHeader->mapMode > 0 ) { @@ -283,8 +283,11 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr xGraphic = mxGraphicMapper->findGraphic(rStreamName); if (!xGraphic.is()) { +// Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images +// we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM +// and the crop values are relative to original bitmap size. auto xStream = mxStorage->openInputStream(rStreamName); -xGraphic = importGraphic(xStream, pExtHeader); +xGraphic = importGraphic(xStream, pExtHeader, !rStreamName.endsWith(".tiff")); if (xGraphic.is()) mxGraphicMapper->putGraphic(rStreamName, xGraphic); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source sd/qa
include/oox/ppt/presentationfragmenthandler.hxx |4 oox/source/ppt/presentationfragmenthandler.cxx | 121 +--- sd/qa/unit/export-tests-ooxml2.cxx |4 3 files changed, 71 insertions(+), 58 deletions(-) New commits: commit 1b871b635c7f368d46a0cff96c059a4d53b257d6 Author: Henry Castro AuthorDate: Thu Sep 28 15:01:43 2023 -0400 Commit: Henry Castro CommitDate: Thu Oct 5 12:59:42 2023 +0200 tdf#155512: oox: ppt: fix import master slides Import all master slides according to the relationship with slide layouts. Adjust unit test values: SdOOXMLExportTest2::testTdf106867 I do not know why those values change since importing embedded video source code was not touched SdOOXMLExportTest2::testAccentColor The accent6 is a constant value. Signed-off-by: Henry Castro Change-Id: Ic7c70d2c4ce30a7f2d2d1cf22604f1119a66f5f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157387 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 08ed103d734ebf65202dc097c7bb0990573f8fd1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157532 Tested-by: Jenkins (cherry picked from commit adcde78935fb8ca2b93322aa3a558d0b3ccdbfad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157546 diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 4685ea2d8316..29204b282bdb 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -54,8 +54,8 @@ private: void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, ::oox::ppt::PowerPointImport& rFilter, -const OUString& rLayoutFragmentPath, -const OUString& rMasterFragmentPath); +std::u16string_view rLayoutFragmentPath, +std::u16string_view rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 8dd0af1345df..09c39902a66a 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -217,75 +217,88 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, PowerPointImport& rFilter, - const OUString& rLayoutFragmentPath, - const OUString& rMasterFragmentPath) + std::u16string_view rLayoutFragmentPath, + std::u16string_view rMasterFragmentPath) { -SlidePersistPtr pMasterPersistPtr; +OUString aLayoutFragmentPath; +OUString aMasterFragmentPath(rMasterFragmentPath); +SlidePersistPtr pMasterPersistPtr, pMasterPtr; Reference< drawing::XDrawPage > xMasterPage; Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); +RelationsRef xMasterRelations = rFilter.importRelations( aMasterFragmentPath ); -sal_Int32 nIndex; -if( rFilter.getMasterPages().empty() ) +for (const auto& rEntry : *xMasterRelations) { -nIndex = 0; -xMasterPages->getByIndex( nIndex ) >>= xMasterPage; -} -else -{ -nIndex = xMasterPages->getCount(); -xMasterPage = xMasterPages->insertNewByIndex( nIndex ); -} +aLayoutFragmentPath = xMasterRelations->getFragmentPathFromRelation(rEntry.second); -pMasterPersistPtr = std::make_shared( rFilter, true, false, xMasterPage, - std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), mpTextListStyle ); -pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath ); -rFilter.getMasterPages().push_back( pMasterPersistPtr ); -rFilter.setActualSlidePersist( pMasterPersistPtr ); -FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source
include/oox/ppt/presentationfragmenthandler.hxx |6 + oox/source/ppt/presentationfragmenthandler.cxx | 137 2 files changed, 80 insertions(+), 63 deletions(-) New commits: commit 89d6b13b8fa4edf5d1df79dded799c531c656652 Author: Henry Castro AuthorDate: Thu Sep 28 14:23:55 2023 -0400 Commit: Henry Castro CommitDate: Wed Oct 4 21:07:37 2023 +0200 tdf#155512: oox: ppt: abstraction "importMasterSlide" Signed-off-by: Henry Castro Change-Id: Icfe8e3abbada7f728b2ad1f8e300a688f51d8f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157386 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit 84ac58c37fffa0c8b6d55c70009515d013ad65b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157468 Tested-by: Jenkins (cherry picked from commit 9fabd7c11989c2a89c5bb238e6cb52b0a6678851) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157543 diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 7ac929ec555b..4685ea2d8316 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -38,6 +38,8 @@ namespace oox::core { class XmlFilterBase; } namespace oox::ppt { +class PowerPointImport; + class PresentationFragmentHandler final : public ::oox::core::FragmentHandler2 { public: @@ -50,6 +52,10 @@ private: void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, const oox::ppt::SlidePersistPtr& rPersist ); void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); +oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, +::oox::ppt::PowerPointImport& rFilter, +const OUString& rLayoutFragmentPath, +const OUString& rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index cc972b80a8b0..8dd0af1345df 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -215,6 +215,79 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& } } +SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, + PowerPointImport& rFilter, + const OUString& rLayoutFragmentPath, + const OUString& rMasterFragmentPath) +{ +SlidePersistPtr pMasterPersistPtr; +Reference< drawing::XDrawPage > xMasterPage; +Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); +Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); + +sal_Int32 nIndex; +if( rFilter.getMasterPages().empty() ) +{ +nIndex = 0; +xMasterPages->getByIndex( nIndex ) >>= xMasterPage; +} +else +{ +nIndex = xMasterPages->getCount(); +xMasterPage = xMasterPages->insertNewByIndex( nIndex ); +} + +pMasterPersistPtr = std::make_shared( rFilter, true, false, xMasterPage, + std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), mpTextListStyle ); +pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath ); +rFilter.getMasterPages().push_back( pMasterPersistPtr ); +rFilter.setActualSlidePersist( pMasterPersistPtr ); +FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) ); + +// set the correct theme +OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" ); +if( !aThemeFragmentPath.isEmpty() ) +{ +std::map< OUString, oox::drawingml::ThemePtr >& rThemes( rFilter.getThemes() ); +std::map< OUString, oox::drawingml::ThemePtr >::iterator aIter2( rThemes.find( aThemeFragmentPath ) ); +if( aIter2 == rThemes.end() ) +{ +oox::drawingml::ThemePtr pThemePtr = std::make_shared(); +pMasterPersistPtr->setTheme( pThemePtr ); +Reference xDoc= +rFilter.importFragment(aThemeFragmentPath); + +auto pTheme = std::make_shared(); +pThemePtr->setTheme(pTheme); + +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source sd/qa sw/qa sw/source
include/oox/drawingml/shape.hxx|2 oox/source/core/xmlfilterbase.cxx |1 oox/source/drawingml/connectorshapecontext.cxx |8 ++ oox/source/drawingml/shape.cxx |4 + oox/source/drawingml/shapecontext.cxx |8 ++ oox/source/drawingml/shapegroupcontext.cxx |8 ++ oox/source/export/shapes.cxx | 73 + oox/source/ppt/pptshapegroupcontext.cxx|8 ++ sd/qa/unit/data/pptx/tdf141058-1.pptx |binary sd/qa/unit/export-tests.cxx| 86 + sw/qa/extras/globalfilter/globalfilter.cxx | 17 sw/source/filter/ww8/docxattributeoutput.cxx | 15 sw/source/filter/ww8/docxsdrexport.cxx | 23 ++ sw/source/filter/ww8/docxsdrexport.hxx |5 + 14 files changed, 229 insertions(+), 29 deletions(-) New commits: commit 2f75278ff1f437228d39cc3f71d6fa98d58fc1c1 Author: Michael Stahl AuthorDate: Thu Jul 6 16:57:08 2023 +0200 Commit: Michael Stahl CommitDate: Thu Jul 6 22:14:34 2023 +0200 tdf#141058 oox,sw: OOXML import/export of decorative on shapes Also add a test for PPTX (using the oox filters), and add a SdrObject to the testTdf143311 for DOCX (using the writerfilter/docxsdrexport). Change-Id: Iccee46c0d30316c33c0947b117e2604c96fa0182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154137 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit e751d59264c369cfc342dab5f0759be12341d306) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154125 diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 72ce51ef6476..ccf477bef805 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -174,6 +174,7 @@ public: voidsetId( const OUString& rId ) { msId = rId; } const OUString& getId() const { return msId; } voidsetDescription( const OUString& rDescr ) { msDescription = rDescr; } +voidsetDecorative(bool const isDecorative) { m_isDecorative = isDecorative; } voidsetHidden( bool bHidden ) { mbHidden = bHidden; } voidsetHiddenMasterShape( bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; } voidsetLocked( bool bLocked ) { mbLocked = bLocked; } @@ -356,6 +357,7 @@ protected: OUStringmsInternalName; // used by diagram; not displayed in UI OUStringmsId; OUStringmsDescription; +boolm_isDecorative = false; sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder std::optional< sal_Int32 > moSubTypeIndex; diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index c2911a756047..0c95980accd4 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -148,6 +148,7 @@ const Sequence< beans::Pair< OUString, sal_Int32 > >& NamespaceIds() NMSP_c15}, {"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2;, NMSP_xr2}, +{"http://schemas.microsoft.com/office/drawing/2017/decorative;, NMSP_adec}, }; return SINGLETON; }; diff --git a/oox/source/drawingml/connectorshapecontext.cxx b/oox/source/drawingml/connectorshapecontext.cxx index 8ea0bcca6965..018ca95c648d 100644 --- a/oox/source/drawingml/connectorshapecontext.cxx +++ b/oox/source/drawingml/connectorshapecontext.cxx @@ -69,6 +69,14 @@ ConnectorShapePropertiesContext::onCreateContext(sal_Int32 aElementToken, { switch (getBaseToken(aElementToken)) { +case XML_extLst: +case XML_ext: +break; +case XML_decorative: +{ +mpConnectorShapePtr->setDecorative(rAttribs.getBool(XML_val, false)); +break; +} case XML_cNvPr: mpConnectorShapePtr->setId(rAttribs.getStringDefaulted(XML_id)); mpConnectorShapePtr->setName(rAttribs.getStringDefaulted(XML_name)); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b9aebab1b31d..3318198123e6 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1144,6 +1144,10 @@ Reference< XShape > const & Shape::createAndInsert( { xSet->setPropertyValue( "Description", Any( msDescription ) ); } +if (m_isDecorative) +{ +xSet->setPropertyValue("Decorative", Any(m_isDecorative)); +} if (aServiceName != "com.sun.star.text.TextFrame") rxShapes->add( mxShape ); diff --git a/oox/source/drawingml/shapecontext.cxx
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/oox oox/source
include/oox/drawingml/color.hxx |3 ++ oox/source/drawingml/color.cxx | 24 +++ oox/source/drawingml/fillproperties.cxx | 16 +-- oox/source/drawingml/textcharacterproperties.cxx | 15 -- 4 files changed, 30 insertions(+), 28 deletions(-) New commits: commit cba27b9723764b7215ad62fad9b30280dfea5f94 Author: Tomaž Vajngerl AuthorDate: Fri Jun 9 23:34:24 2023 +0900 Commit: Xisco Fauli CommitDate: Tue Jun 13 13:33:04 2023 +0200 oox: remove code duplication and add getComplexColor to oox::Color Change-Id: I9cfbc851d4f303a5a8c92183f01cb5b6545b7984 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152800 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit c1470e15bd0643be8d91aaf6a0d25c78867d0b3e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152979 Reviewed-by: Xisco Fauli diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index 75812c200c28..245e655d7c78 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -30,6 +30,7 @@ #include #include #include +#include namespace oox { class GraphicHelper; } @@ -117,6 +118,8 @@ public: /// Compares this color with rOther. bool equals(const Color& rOther, const GraphicHelper& rGraphicHelper, ::Color nPhClr) const; +model::ComplexColor getComplexColor() const; + private: /** Internal helper for getColor(). */ voidsetResolvedRgb( ::Color nRgb ) const; diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 805ca6c4faed..ad0b5ca7835e 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -571,6 +571,30 @@ sal_Int16 Color::getLumOff() const return 0; } +model::ComplexColor Color::getComplexColor() const +{ +model::ComplexColor aComplexColor; + aComplexColor.setSchemeColor(model::convertToThemeColorType(getSchemeColorIndex())); + +if (getTintOrShade() > 0) +{ +aComplexColor.addTransformation({model::TransformationType::Tint, getTintOrShade()}); +} +else if (getTintOrShade() < 0) +{ +sal_Int16 nShade = o3tl::narrowing(-getTintOrShade()); +aComplexColor.addTransformation({model::TransformationType::Shade, nShade}); +} + +if (getLumMod() != 1) +aComplexColor.addTransformation({model::TransformationType::LumMod, getLumMod()}); + +if (getLumOff() != 0) +aComplexColor.addTransformation({model::TransformationType::LumOff, getLumOff()}); + +return aComplexColor; +} + ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const { const sal_Int32 nTempC1 = mnC1; diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 705f2dc3b55a..7e2f5185b7f6 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -431,24 +431,12 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp if (aFillColor == nPhClr) { aComplexColor.setSchemeColor(model::convertToThemeColorType(nPhClrTheme)); -rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); } else { - aComplexColor.setSchemeColor(model::convertToThemeColorType(maFillColor.getSchemeColorIndex())); -if (maFillColor.getLumMod() != 1) - aComplexColor.addTransformation({model::TransformationType::LumMod, maFillColor.getLumMod()}); -if (maFillColor.getLumOff() != 0) - aComplexColor.addTransformation({model::TransformationType::LumOff, maFillColor.getLumOff()}); -if (maFillColor.getTintOrShade() > 0) - aComplexColor.addTransformation({model::TransformationType::Tint, maFillColor.getTintOrShade()}); -if (maFillColor.getTintOrShade() < 0) -{ -sal_Int16 nShade = o3tl::narrowing(-maFillColor.getTintOrShade()); - aComplexColor.addTransformation({model::TransformationType::Shade, nShade}); -} -rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); +aComplexColor = maFillColor.getComplexColor(); } +rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); eFillStyle = FillStyle_SOLID; } diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 7d3dda284680..0e1e2830a67f 100644 ---