diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-28 09:43:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-12 23:15:58 +0000 |
commit | bd0f526f2d3e1ffe43a74672485815768eee6e9e (patch) | |
tree | fcb675aa06dcc3251f2c23961520ee317483a225 /sd | |
parent | c945eafc99856f0bcd0a99195e2c5164c2a6d24a (diff) |
introduce docmodel comp., model::ThemeColor, use it in SvxColorItem
Added a new component docmodel, that has the document model types,
which only depend on other basic components. This is needed so the
types can be used in every relevant component - xmloff, oox, svx,
editeng,...
Introduces model::ThemeColor, which is a class used to store the
theme color data, including transformations (svx::Transformation).
For UNO use XThemeColor is added, and the implementation UnoThemeColor
which wraps svx::ThemeColor, so it can be tranported around.
Reactor all the code and tests to accomodate for this change.
Change-Id: I7ce6752cdfaf5e4d3b8e4d90314afa469dd65cfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144847
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/CppunitTest_sd_uiimpress.mk | 1 | ||||
-rw-r--r-- | sd/CppunitTest_sd_uimpress.mk | 1 | ||||
-rw-r--r-- | sd/Library_sd.mk | 1 | ||||
-rw-r--r-- | sd/inc/pch/precompiled_sd.hxx | 68 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 18 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fuconstr.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 7 |
9 files changed, 101 insertions, 30 deletions
diff --git a/sd/CppunitTest_sd_uiimpress.mk b/sd/CppunitTest_sd_uiimpress.mk index 2599d0a97982..c2ba59be987a 100644 --- a/sd/CppunitTest_sd_uiimpress.mk +++ b/sd/CppunitTest_sd_uiimpress.mk @@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uiimpress, \ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ for \ diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index 4575a06107b5..bff68b0386d0 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ drawinglayercore \ editeng \ diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 1a3a87174098..3c60a60b3a3d 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,sd,\ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayercore \ drawinglayer \ editeng \ diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 8963b9432162..b4110da7f641 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2022-08-08 10:27:15 using: + Generated on 2023-01-10 23:30:40 using: ./bin/update_pch sd sd --cutoff=4 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -25,16 +25,21 @@ #include <algorithm> #include <array> #include <cassert> +#include <cmath> #include <cstddef> +#include <cstring> #include <functional> #include <initializer_list> #include <iomanip> #include <iterator> +#include <limits> #include <locale> #include <map> +#include <math.h> #include <memory> #include <mutex> #include <new> +#include <numeric> #include <optional> #include <ostream> #include <set> @@ -61,12 +66,16 @@ #include <osl/socket_decl.hxx> #include <osl/time.h> #include <rtl/alloc.h> +#include <rtl/bootstrap.hxx> #include <rtl/character.hxx> -#include <rtl/locale.h> +#include <rtl/math.h> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.h> #include <rtl/strbuf.hxx> #include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> #include <rtl/ustrbuf.hxx> @@ -77,13 +86,13 @@ #include <sal/types.h> #include <sal/typesizes.h> #include <vcl/EnumContext.hxx> +#include <vcl/GraphicObject.hxx> #include <vcl/InterimItemWindow.hxx> #include <vcl/bitmapex.hxx> #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/customweld.hxx> #include <vcl/dllapi.h> -#include <comphelper/errcode.hxx> #include <vcl/errinf.hxx> #include <vcl/event.hxx> #include <vcl/fntstyle.hxx> @@ -96,6 +105,7 @@ #include <vcl/image.hxx> #include <vcl/imapobj.hxx> #include <vcl/keycod.hxx> +#include <vcl/mapmod.hxx> #include <vcl/outdev.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/region.hxx> @@ -121,6 +131,7 @@ #include <basegfx/color/bcolor.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/numeric/ftools.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2ipoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -131,6 +142,7 @@ #include <basegfx/range/basicrange.hxx> #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/vector/b2dvector.hxx> #include <basic/sberrors.hxx> #include <basic/sbstar.hxx> @@ -138,10 +150,27 @@ #include <cache/SlsPageCacheManager.hxx> #include <com/sun/star/animations/AnimationFill.hpp> #include <com/sun/star/animations/AnimationNodeType.hpp> +#include <com/sun/star/animations/AnimationRestart.hpp> +#include <com/sun/star/animations/AnimationTransformType.hpp> +#include <com/sun/star/animations/Event.hpp> +#include <com/sun/star/animations/EventTrigger.hpp> #include <com/sun/star/animations/ParallelTimeContainer.hpp> +#include <com/sun/star/animations/Timing.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/ValuePair.hpp> #include <com/sun/star/animations/XAnimate.hpp> +#include <com/sun/star/animations/XAnimateMotion.hpp> +#include <com/sun/star/animations/XAnimateTransform.hpp> +#include <com/sun/star/animations/XAnimationNode.hpp> +#include <com/sun/star/animations/XAnimationNodeSupplier.hpp> +#include <com/sun/star/animations/XAudio.hpp> +#include <com/sun/star/animations/XCommand.hpp> +#include <com/sun/star/animations/XIterateContainer.hpp> +#include <com/sun/star/animations/XTransitionFilter.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyState.hpp> @@ -164,9 +193,13 @@ #include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> #include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> @@ -185,6 +218,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/geometry/RealPoint2D.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -198,11 +232,20 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/media/XPlayer.hpp> #include <com/sun/star/office/XAnnotation.hpp> +#include <com/sun/star/office/XAnnotationAccess.hpp> +#include <com/sun/star/office/XAnnotationEnumeration.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <com/sun/star/presentation/EffectCommands.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/presentation/EffectPresetClass.hpp> #include <com/sun/star/presentation/ParagraphTarget.hpp> +#include <com/sun/star/presentation/ShapeAnimationSubType.hpp> +#include <com/sun/star/presentation/TextAnimationType.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/text/XSimpleText.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextCopy.hpp> #include <com/sun/star/text/XTextRange.hpp> @@ -226,6 +269,8 @@ #include <comphelper/classids.hxx> #include <comphelper/compbase.hxx> #include <comphelper/comphelperdllapi.h> +#include <comphelper/diagnose_ex.hxx> +#include <comphelper/errcode.hxx> #include <comphelper/extract.hxx> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> @@ -233,6 +278,7 @@ #include <comphelper/propertyvalue.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <controller/SlideSorterController.hxx> @@ -293,16 +339,17 @@ #include <editeng/unoedsrc.hxx> #include <editeng/unolingu.hxx> #include <editeng/wghtitem.hxx> +#include <filter/msfilter/msfilterdllapi.h> #include <framework/ConfigurationController.hxx> #include <framework/FrameworkHelper.hxx> #include <framework/Pane.hxx> #include <framework/ViewShellWrapper.hxx> -#include <i18nlangtag/i18nlangtagdllapi.h> #include <i18nlangtag/lang.h> #include <i18nlangtag/languagetag.hxx> #include <model/SlideSorterModel.hxx> #include <model/SlsPageDescriptor.hxx> #include <model/SlsPageEnumerationProvider.hxx> +#include <o3tl/any.hxx> #include <o3tl/cow_wrapper.hxx> #include <o3tl/deleter.hxx> #include <o3tl/safeint.hxx> @@ -312,7 +359,10 @@ #include <o3tl/strong_int.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/underlyingenumvalue.hxx> +#include <o3tl/unit_conversion.hxx> #include <officecfg/Office/Common.hxx> +#include <oox/dllapi.h> +#include <oox/drawingml/drawingmltypes.hxx> #include <salhelper/simplereferenceobject.hxx> #include <salhelper/thread.hxx> #include <sfx2/app.hxx> @@ -351,6 +401,7 @@ #include <sfx2/zoomitem.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> +#include <sot/storage.hxx> #include <svl/SfxBroadcaster.hxx> #include <svl/cjkoptions.hxx> #include <svl/eitem.hxx> @@ -368,6 +419,7 @@ #include <svl/style.hxx> #include <svl/svldllapi.h> #include <svl/typedwhich.hxx> +#include <svl/urihelper.hxx> #include <svl/urlbmk.hxx> #include <svl/whiter.hxx> #include <svtools/ehdl.hxx> @@ -385,9 +437,11 @@ #include <svx/fmshell.hxx> #include <svx/fontwork.hxx> #include <svx/fontworkbar.hxx> +#include <svx/gallery.hxx> #include <svx/hlnkitem.hxx> #include <svx/hyperdlg.hxx> #include <svx/imapdlg.hxx> +#include <svx/msdffdef.hxx> #include <svx/obj3d.hxx> #include <svx/pageitem.hxx> #include <svx/ruler.hxx> @@ -402,6 +456,7 @@ #include <svx/sdrpaintwindow.hxx> #include <svx/sdtagitm.hxx> #include <svx/sdtfsitm.hxx> +#include <svx/sdtmfitm.hxx> #include <svx/srchdlg.hxx> #include <svx/svddef.hxx> #include <svx/svdetc.hxx> @@ -422,6 +477,7 @@ #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> #include <svx/svdpool.hxx> +#include <svx/svdtypes.hxx> #include <svx/svdundo.hxx> #include <svx/svxdlg.hxx> #include <svx/svxdllapi.h> @@ -448,12 +504,11 @@ #include <tools/color.hxx> #include <tools/debug.hxx> #include <tools/degree.hxx> -#include <comphelper/diagnose_ex.hxx> #include <tools/fldunit.hxx> #include <tools/fontenum.hxx> +#include <tools/fract.hxx> #include <tools/gen.hxx> #include <tools/globname.hxx> -#include <tools/lineend.hxx> #include <tools/link.hxx> #include <tools/long.hxx> #include <tools/mapunit.hxx> @@ -474,6 +529,7 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/options.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/resmgr.hxx> #include <unotools/streamwrap.hxx> #include <unotools/syslocale.hxx> diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 4d72cf0915c6..b12e280f231f 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1358,7 +1358,7 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN if (pEntry->nMemberId == MID_COLOR_THEME_INDEX) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetThemeIndex() == -1) + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) { eState = PropertyState_DEFAULT_VALUE; } @@ -1366,7 +1366,13 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN else if (pEntry->nMemberId == MID_COLOR_LUM_MOD) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetLumMod() == 10000) + sal_Int16 nLumMod = 10000; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nLumMod = rTransform.mnValue; + } + if (nLumMod == 10000) { eState = PropertyState_DEFAULT_VALUE; } @@ -1374,7 +1380,13 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN else if (pEntry->nMemberId == MID_COLOR_LUM_OFF) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetLumOff() == 0) + sal_Int16 nLumOff = 0; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nLumOff = rTransform.mnValue; + } + if (nLumOff == 0) { eState = PropertyState_DEFAULT_VALUE; } diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index d0d602cb4299..3827c90e045e 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -2186,7 +2186,7 @@ bool PowerPointExport::WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme { sal_Int32 nToken = aPredefinedClrTokens[static_cast<PredefinedClrSchemeId>(nId)]; pFS->startElementNS(XML_a, nToken); - svx::ThemeColorType eType = svx::convertToThemeColorType(nId); + model::ThemeColorType eType = model::convertToThemeColorType(nId); pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(static_cast<sal_Int32>(pColorSet->getColor(eType)))); pFS->endElementNS(XML_a, nToken); } diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index dd086641cdbf..e7f0bb3a67bb 100644 --- a/sd/source/ui/func/fuconstr.cxx +++ b/sd/source/ui/func/fuconstr.cxx @@ -389,10 +389,10 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, aAttr.Put(XFillStyleItem(css::drawing::FillStyle_SOLID)); - svx::ThemeColorType eColorType = svx::ThemeColorType::Accent1; + model::ThemeColorType eColorType = model::ThemeColorType::Accent1; Color aColor = pTheme->GetColor(eColorType); XFillColorItem aFillColorItem("", aColor); - aFillColorItem.GetThemeColor().SetThemeIndex(static_cast<sal_Int16>(eColorType)); + aFillColorItem.GetThemeColor().setType(eColorType); aAttr.Put(aFillColorItem); aAttr.Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 6282b750aa06..7fba8728d991 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -780,21 +780,20 @@ void TextObjectBar::Execute( SfxRequest &rReq ) if (nSlot == SID_ATTR_CHAR_COLOR) { pColorItem = std::make_unique<SvxColorItem>(pNewArgs->Get(EE_CHAR_COLOR)); - } - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_THEME_INDEX, false)) - { - pColorItem->GetThemeColor().SetThemeIndex(pIntItem->GetValue()); - } - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_MOD, false)) - { - pColorItem->GetThemeColor().SetLumMod(pIntItem->GetValue()); - } - if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_OFF, false)) - { - pColorItem->GetThemeColor().SetLumOff(pIntItem->GetValue()); - } - if (pColorItem) - { + pColorItem->GetThemeColor().clearTransformations(); + + if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_THEME_INDEX, false)) + { + pColorItem->GetThemeColor().setType(model::convertToThemeColorType(pIntItem->GetValue())); + } + if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_MOD, false)) + { + pColorItem->GetThemeColor().addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); + } + if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_OFF, false)) + { + pColorItem->GetThemeColor().addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); + } pNewArgs->Put(std::move(pColorItem)); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index b2c2803a2438..a390533e89dc 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -575,20 +575,21 @@ public: if (pColorItem) { XFillColorItem aColorItem(*pColorItem); + aColorItem.GetThemeColor().clearTransformations(); if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetThemeIndex(pIntItem->GetValue()); + aColorItem.GetThemeColor().setType(model::convertToThemeColorType(pIntItem->GetValue())); } if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetLumMod(pIntItem->GetValue()); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); } if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetLumOff(pIntItem->GetValue()); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); } pArgs->Put(aColorItem); } |