[Libreoffice-commits] core.git: include/docmodel include/oox oox/inc oox/source sw/qa
include/docmodel/theme/FormatScheme.hxx | 52 +++ include/oox/drawingml/drawingmltypes.hxx |1 oox/inc/drawingml/effectpropertiescontext.hxx|7 + oox/source/drawingml/drawingmltypes.cxx | 20 oox/source/drawingml/effectpropertiescontext.cxx | 105 --- oox/source/drawingml/misccontexts.cxx| 14 --- oox/source/drawingml/themeelementscontext.cxx| 24 +++-- sw/qa/core/theme/ThemeTest.cxx | 43 + 8 files changed, 232 insertions(+), 34 deletions(-) New commits: commit 2a7ab2ab7786ab88b1bdbbe5e4b00ea8e93636f7 Author: Tomaž Vajngerl AuthorDate: Thu Mar 2 23:36:38 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Apr 12 09:40:09 2023 +0200 oox: add model::EffectStyle and import effect style elements of a theme Extends the SwCoreThemeTest with effect style use-cases- Change-Id: Ifcb96a860fcbc0aae65e8ec276e069f7f60fb950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149361 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx index 5d16b79b6231..e207d9935432 100644 --- a/include/docmodel/theme/FormatScheme.hxx +++ b/include/docmodel/theme/FormatScheme.hxx @@ -295,6 +295,7 @@ enum class FlipMode enum class RectangleAlignment { +Unset, TopLeft, Top, TopRight, @@ -465,12 +466,53 @@ public: FillStyle maLineFillStyle; }; +enum class EffectType +{ +Unset, +OuterShadow, +InnerShadow, +Glow, +SoftEdge, +Reflection, +Blur +}; + +class DOCMODEL_DLLPUBLIC Effect +{ +public: +EffectType meType = EffectType::Unset; +sal_Int32 mnBlurRadius = 0; +sal_Int32 mnRadius = 0; +sal_Int32 mnDistance = 0; +sal_Int32 mnDirection = 0; +sal_Int32 mnScaleX = 100; +sal_Int32 mnScaley = 100; +sal_Int32 mnScewX = 0; +sal_Int32 mnScewY = 0; +RectangleAlignment meAlignment = RectangleAlignment::Bottom; +bool mbRotateWithShape = true; +ColorDefinition maColor; +double mnEndAlpha = 100.0; +double mnEndPosition = 0.0; +double mnStartAlpha = 0.0; +double mnStartPosition = 100.0; +sal_Int32 mnFadeDirection = 0; +bool mbGrow = false; +}; + +class DOCMODEL_DLLPUBLIC EffectStyle +{ +public: +std::vector maEffectList; +}; + class DOCMODEL_DLLPUBLIC FormatScheme { private: OUString maName; std::vector maFillStyleList; std::vector maLineStyleList; +std::vector maEffectStyleList; std::vector maBackgroundFillStyleList; public: @@ -493,6 +535,16 @@ public: return } +std::vector const& getEffectStyleList() const { return maEffectStyleList; } + +EffectStyle* addEffectStyle() +{ +if (maEffectStyleList.size() > 3) +return nullptr; +auto& rEffectStyle = maEffectStyleList.emplace_back(); +return +} + std::vector const& getFillStyleList() const { return maFillStyleList; } FillStyle* addFillStyle() diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 8dd5dee727d4..239d3283e55c 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -231,6 +231,7 @@ struct EmuRectangle : public EmuPoint, public EmuSize void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; } }; +model::RectangleAlignment convertToRectangleAlignment(sal_Int32 nToken); } // namespace oox::drawingml diff --git a/oox/inc/drawingml/effectpropertiescontext.hxx b/oox/inc/drawingml/effectpropertiescontext.hxx index d6a931043367..81d765cb887a 100644 --- a/oox/inc/drawingml/effectpropertiescontext.hxx +++ b/oox/inc/drawingml/effectpropertiescontext.hxx @@ -11,6 +11,8 @@ #include +namespace model { class EffectStyle; } + namespace oox::drawingml { struct EffectProperties; @@ -19,8 +21,8 @@ struct Effect; class EffectPropertiesContext final : public ::oox::core::ContextHandler2 { public: -EffectPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, -EffectProperties& rEffectProperties ) noexcept; +EffectPropertiesContext(::oox::core::ContextHandler2Helper const & rParent, EffectProperties& rEffectProperties, +model::EffectStyle* pEffectStyle = nullptr) noexcept; virtual ~EffectPropertiesContext() override; virtual ::oox::core::ContextHandlerRef @@ -29,6 +31,7 @@ public: private: static void saveUnsupportedAttribs( Effect& rEffect, const AttributeList& rAttribs ); +model::EffectStyle* mpEffectStyle; EffectProperties& mrEffectProperties; }; diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index d0bf1bf2c892..469029f48071 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -422,6
[Libreoffice-commits] core.git: include/docmodel include/oox oox/inc oox/source
include/docmodel/theme/FormatScheme.hxx | 46 +++ include/oox/drawingml/drawingmltypes.hxx |4 + oox/inc/drawingml/misccontexts.hxx |8 +- oox/source/drawingml/drawingmltypes.cxx |8 ++ oox/source/drawingml/misccontexts.cxx| 93 --- 5 files changed, 135 insertions(+), 24 deletions(-) New commits: commit 0d18262789fbe95eafe32bd775a9827ed99685ef Author: Tomaž Vajngerl AuthorDate: Fri Feb 24 00:48:55 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Mar 23 02:28:08 2023 + oox: import gradient fill to model::FormatScheme Change-Id: I90bc7cf4239f08efbc7239928c34ccdbec20cb2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147575 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx index a256532791d9..39fa5d36ae0b 100644 --- a/include/docmodel/theme/FormatScheme.hxx +++ b/include/docmodel/theme/FormatScheme.hxx @@ -159,6 +159,52 @@ public: } }; +class DOCMODEL_DLLPUBLIC GradientStop +{ +public: +double mfPosition = 0.0; // 0.0 - 1.0 +ColorDefinition maColor; +}; + +enum class GradientType +{ +Undefined, +Linear, +Circle, +Rectangle, +Shape, +}; + +struct DOCMODEL_DLLPUBLIC LinearGradientProperties +{ +sal_Int32 mnAngle = 0; +bool mbScaled = false; +}; + +struct DOCMODEL_DLLPUBLIC RelativeRectangle +{ +sal_Int32 mnLeft = 0; +sal_Int32 mnTop = 0; +sal_Int32 mnRight = 0; +sal_Int32 mnBottom = 0; +}; + +class DOCMODEL_DLLPUBLIC GradientFill : public Fill +{ +public: +bool mbRotateWithShape = false; +GradientType meGradientType = GradientType::Undefined; +std::vector maGradientStops; +LinearGradientProperties maLinearGradient; +RelativeRectangle maFillToRectangle; +RelativeRectangle maTileRectangle; + +GradientFill() +: Fill(FillType::Gradient) +{ +} +}; + // Format Scheme class DOCMODEL_DLLPUBLIC FillStyle diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 5fe86d56439e..8dd5dee727d4 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,9 @@ css::awt::Size GetSize2D( const css::uno::Reference< css::xml::sax::XFastAttribu /** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */ css::geometry::IntegerRectangle2D GetRelativeRect( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes ); +void fillRelativeRectangle(model::RelativeRectangle& rRelativeRectangle, + const css::uno::Reference& xAttributes); + /** converts EMUs into 1/100th mmm */ sal_Int32 GetCoordinate( sal_Int32 nValue ); diff --git a/oox/inc/drawingml/misccontexts.hxx b/oox/inc/drawingml/misccontexts.hxx index e2e255d10b64..6bbaa74efcf2 100644 --- a/oox/inc/drawingml/misccontexts.hxx +++ b/oox/inc/drawingml/misccontexts.hxx @@ -42,10 +42,9 @@ public: class GradientFillContext final : public ::oox::core::ContextHandler2 { public: -explicitGradientFillContext( -::oox::core::ContextHandler2Helper const & rParent, -const ::oox::AttributeList& rAttribs, -GradientFillProperties& rGradientProps ); +explicit GradientFillContext(::oox::core::ContextHandler2Helper const & rParent, +const ::oox::AttributeList& rAttribs, GradientFillProperties& rGradientProps, +model::GradientFill* pGradientFill); virtual ::oox::core::ContextHandlerRef onCreateContext( @@ -53,6 +52,7 @@ public: const ::oox::AttributeList& rAttribs ) override; private: +model::GradientFill* mpGradientFill; GradientFillProperties& mrGradientProps; }; diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index fc2f28d902b7..d0bf1bf2c892 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -400,6 +400,14 @@ IntegerRectangle2D GetRelativeRect( const Reference< XFastAttributeList >& xAttr return r; } +void fillRelativeRectangle(model::RelativeRectangle& rRelativeRectangle, const Reference& xAttribs) +{ +rRelativeRectangle.mnLeft = GetST_Percentage(xAttribs->getOptionalValue(XML_l)); +rRelativeRectangle.mnTop = GetST_Percentage(xAttribs->getOptionalValue(XML_t)); +rRelativeRectangle.mnRight = GetST_Percentage(xAttribs->getOptionalValue(XML_r)); +rRelativeRectangle.mnBottom = GetST_Percentage(xAttribs->getOptionalValue(XML_b)); +} + /** converts the attributes from a CT_Size2D into an awt Size with 1/100thmm */ awt::Size GetSize2D( const Reference< XFastAttributeList >& xAttribs ) { diff --git
[Libreoffice-commits] core.git: include/docmodel include/oox oox/inc oox/source
include/docmodel/theme/FormatScheme.hxx | 196 include/docmodel/theme/Theme.hxx|7 include/oox/drawingml/color.hxx |5 oox/inc/drawingml/colorchoicecontext.hxx| 30 +- oox/inc/drawingml/misccontexts.hxx | 17 - oox/source/drawingml/clrschemecontext.cxx |2 oox/source/drawingml/color.cxx | 56 +++- oox/source/drawingml/colorchoicecontext.cxx | 151 ++-- oox/source/drawingml/diagram/datamodelcontext.cxx |3 oox/source/drawingml/linepropertiescontext.cxx |2 oox/source/drawingml/misccontexts.cxx | 60 oox/source/drawingml/shapepropertiescontext.cxx |2 oox/source/drawingml/table/tablecellcontext.cxx |3 oox/source/drawingml/textcharacterpropertiescontext.cxx |2 oox/source/drawingml/themeelementscontext.cxx | 35 ++ oox/source/ppt/backgroundproperties.cxx |2 16 files changed, 481 insertions(+), 92 deletions(-) New commits: commit 7a0cf6797bb53d1fec5101a8f7007d2287ae53b0 Author: Tomaž Vajngerl AuthorDate: Fri Feb 24 00:29:45 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Mar 22 09:24:46 2023 + oox: introduce FormatScheme - use in Theme import Introduces model::FormatScheme as an member of model::Theme, which is used in the theme import. As an first step it imports FillStyleList, but only SolidFill and NoFill. Change-Id: I14a75782ebabcf7ff69b0872752d411183653a47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147573 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx new file mode 100644 index ..a256532791d9 --- /dev/null +++ b/include/docmodel/theme/FormatScheme.hxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include +#include +#include + +namespace model +{ +enum class ColorType +{ +Unused, +RGB, +CRGB, +HSL, +Scheme, +Palette, +System, +Placeholder +}; + +enum class SystemColorType +{ +Unused, +DarkShadow3D, +Light3D, +ActiveBorder, +ActiveCaption, +AppWorkspace, +Background, +ButtonFace, +ButtonHighlight, +ButtonShadow, +ButtonText, +CaptionText, +GradientActiveCaption, +GradientInactiveCaption, +GrayText, +Highlight, +HighlightText, +HotLight, +InactiveBorder, +InactiveCaption, +InactiveCaptionText, +InfoBack, +InfoText, +Menu, +MenuBar, +MenuHighlight, +MenuText, +ScrollBar, +Window, +WindowFrame, +WindowText +}; + +struct DOCMODEL_DLLPUBLIC ColorDefinition +{ +ColorType meType = ColorType::Unused; + +sal_Int32 mnComponent1 = 0; // Red, Hue +sal_Int32 mnComponent2 = 0; // Green, Saturation +sal_Int32 mnComponent3 = 0; // Blue, Luminance +sal_Int32 mnAlpha = 0; // Percentage + +SystemColorType meSystemColorType = SystemColorType::Unused; +::Color maLastColor; + +ThemeColorType meSchemeType = ThemeColorType::Unknown; +std::vector maTransformations; + +void setCRGB(sal_Int32 nR, sal_Int32 nG, sal_Int32 nB) +{ +mnComponent1 = nR; +mnComponent2 = nG; +mnComponent3 = nB; +meType = ColorType::CRGB; +} + +void setRGB(sal_Int32 nRGB) +{ +::Color aColor(ColorTransparency, nRGB); +mnComponent1 = aColor.GetRed(); +mnComponent2 = aColor.GetGreen(); +mnComponent3 = aColor.GetBlue(); +meType = ColorType::RGB; +} + +void setHSL(sal_Int32 nH, sal_Int32 nS, sal_Int32 nL) +{ +mnComponent1 = nH; +mnComponent2 = nS; +mnComponent3 = nL; +meType = ColorType::HSL; +} + +void setSystemColor(SystemColorType eSystemColorType, sal_Int32 nRGB) +{ +maLastColor = ::Color(ColorTransparency, nRGB); +meSystemColorType = eSystemColorType; +meType = ColorType::System; +} + +void setSchemePlaceholder() { meType = ColorType::Placeholder; } + +void setSchemeColor(ThemeColorType eType) +{ +meSchemeType = eType; +meType = ColorType::Scheme; +} +}; + +enum class FillType +{ +None, +Solid, +Gradient, +Pattern, +Blip +}; + +class DOCMODEL_DLLPUBLIC Fill +{ +public: +Fill(FillType eType) +: meType(eType) +{ +} + +FillType meType; +}; + +class DOCMODEL_DLLPUBLIC NoFill : public Fill