diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-03-15 19:25:03 +0300 |
---|---|---|
committer | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-04-18 17:43:18 +0200 |
commit | c27946fb157fe46fbfaefbe93f2c6794b1af4411 (patch) | |
tree | 0ddcaa0e4439713835d8e6b80121336adaf056e5 /include | |
parent | be7ce49f33035fcd289a5ffc7a2307bd9a566780 (diff) |
tdf#150020 pptx import: handle algn for outerShdw
Introduces RectangleAlignmentItem that holds a value of the enum
model::RectangleAlignment.
Introduces SDRATTR_SHADOWALIGNMENT that holds alignment for a shadow.
Implements import of algn for outerShdw.
Makes the alignment considered while the shadow is being scaled.
Also adds a unit test that covers this.
Change-Id: I8f4eaed5f0d9428a7f405c65f19237f9e70ca151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148934
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/docmodel/theme/FormatScheme.hxx | 2 | ||||
-rw-r--r-- | include/drawinglayer/attribute/sdrshadowattribute.hxx | 6 | ||||
-rw-r--r-- | include/editeng/unoprnms.hxx | 1 | ||||
-rw-r--r-- | include/svx/RectangleAlignmentItem.hxx | 42 | ||||
-rw-r--r-- | include/svx/svddef.hxx | 4 | ||||
-rw-r--r-- | include/svx/unoshprp.hxx | 3 |
6 files changed, 56 insertions, 2 deletions
diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx index e207d9935432..feec16ee187f 100644 --- a/include/docmodel/theme/FormatScheme.hxx +++ b/include/docmodel/theme/FormatScheme.hxx @@ -306,6 +306,8 @@ enum class RectangleAlignment Bottom, BottomRight }; +constexpr sal_uInt16 RECTANGLE_ALIGNMENT_COUNT + = static_cast<sal_uInt16>(RectangleAlignment::BottomRight) + 1; enum class ColorEffectType { diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx b/include/drawinglayer/attribute/sdrshadowattribute.hxx index ffe249498db2..ab2c045e49bb 100644 --- a/include/drawinglayer/attribute/sdrshadowattribute.hxx +++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx @@ -31,6 +31,10 @@ namespace basegfx { class B2DVector; } +namespace model { + enum class RectangleAlignment; +} + namespace drawinglayer::attribute { class ImpSdrShadowAttribute; } @@ -53,6 +57,7 @@ namespace drawinglayer::attribute const basegfx::B2DVector& rSize, double fTransparence, sal_Int32 nBlur, + model::RectangleAlignment eAlignment, const basegfx::BColor& rColor); SdrShadowAttribute(); SdrShadowAttribute(const SdrShadowAttribute&); @@ -72,6 +77,7 @@ namespace drawinglayer::attribute const basegfx::B2DVector& getSize() const; double getTransparence() const; sal_Int32 getBlur() const; + model::RectangleAlignment getAlignment() const; const basegfx::BColor& getColor() const; }; diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx index 1ca19c3f5121..63d52d7537a6 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -96,6 +96,7 @@ inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEX = u"ShadowSizeX"; inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEY = u"ShadowSizeY"; inline constexpr OUStringLiteral UNO_NAME_SHADOWTRANSPARENCE = u"ShadowTransparence"; inline constexpr OUStringLiteral UNO_NAME_SHADOWBLUR = u"ShadowBlur"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWALIGNMENT = u"ShadowAlignment"; inline constexpr OUStringLiteral UNO_NAME_EDGERADIUS = u"CornerRadius"; diff --git a/include/svx/RectangleAlignmentItem.hxx b/include/svx/RectangleAlignmentItem.hxx new file mode 100644 index 000000000000..91179e628a40 --- /dev/null +++ b/include/svx/RectangleAlignmentItem.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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 <svl/eitem.hxx> +#include <svx/svxdllapi.h> + +namespace model +{ +enum class RectangleAlignment; +} + +/** Item that holds a rectangle alignment value. + + e.g. Top Left, Top, Top Right, Center. + @see model::RectangleAlignment + */ +class SVXCORE_DLLPUBLIC SvxRectangleAlignmentItem final + : public SfxEnumItem<model::RectangleAlignment> +{ +public: + SvxRectangleAlignmentItem(sal_uInt16 nWhich, model::RectangleAlignment nValue); + virtual ~SvxRectangleAlignmentItem() override; + + SvxRectangleAlignmentItem(SvxRectangleAlignmentItem const&) = default; + SvxRectangleAlignmentItem(SvxRectangleAlignmentItem&&) = default; + SvxRectangleAlignmentItem& operator=(SvxRectangleAlignmentItem const&) = delete; + SvxRectangleAlignmentItem& operator=(SvxRectangleAlignmentItem&&) = delete; + + virtual SvxRectangleAlignmentItem* Clone(SfxItemPool* pPool = nullptr) const override; + + virtual sal_uInt16 GetValueCount() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx index 84db8c4d0aa4..18088731bca1 100644 --- a/include/svx/svddef.hxx +++ b/include/svx/svddef.hxx @@ -160,6 +160,7 @@ class SvxBoxInfoItem; class SvxBoxItem; class SvxColorItem; class SvxLineItem; +class SvxRectangleAlignmentItem; class SvxTextRotateItem; class SvxWritingModeItem; class XColorItem; @@ -191,7 +192,8 @@ constexpr TypedWhichId<SfxVoidItem> SDRATTR_SHADOWPERSP (SDRATTR_SHADO constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWSIZEX (SDRATTR_SHADOW_FIRST+ 7); constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWSIZEY (SDRATTR_SHADOW_FIRST+ 8); constexpr TypedWhichId<SdrMetricItem> SDRATTR_SHADOWBLUR (SDRATTR_SHADOW_FIRST+ 9); -constexpr sal_uInt16 SDRATTR_SHADOW_LAST (SDRATTR_SHADOWBLUR); /* 1078 */ /* 1078 */ /* 1061 */ /* Pool V1: 1039 */ +constexpr TypedWhichId<SvxRectangleAlignmentItem> SDRATTR_SHADOWALIGNMENT(SDRATTR_SHADOW_FIRST + 10); +constexpr sal_uInt16 SDRATTR_SHADOW_LAST (SDRATTR_SHADOWALIGNMENT); /* 1078 */ /* 1078 */ /* 1061 */ /* Pool V1: 1039 */ constexpr sal_uInt16 SDRATTR_CAPTION_FIRST (SDRATTR_SHADOW_LAST + 1); /* 1080 */ /* 1080 */ /* 1063 */ /* Pool V1: 1041 */ constexpr TypedWhichId<SdrCaptionTypeItem> SDRATTR_CAPTIONTYPE (SDRATTR_CAPTION_FIRST+ 0); /* 1080 */ /* 1080 */ /* 1063 */ diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx index a1fa9412afc9..c385f0766358 100644 --- a/include/svx/unoshprp.hxx +++ b/include/svx/unoshprp.hxx @@ -230,7 +230,8 @@ { UNO_NAME_SHADOWYDIST, SDRATTR_SHADOWYDIST, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \ { UNO_NAME_SHADOWSIZEX, SDRATTR_SHADOWSIZEX, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \ { UNO_NAME_SHADOWSIZEY, SDRATTR_SHADOWSIZEY, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \ - { UNO_NAME_SHADOWBLUR, SDRATTR_SHADOWBLUR, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, + { UNO_NAME_SHADOWBLUR, SDRATTR_SHADOWBLUR, ::cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM}, \ + { UNO_NAME_SHADOWALIGNMENT, SDRATTR_SHADOWALIGNMENT, /*ENUM*/::cppu::UnoType<sal_Int32>::get(), 0, 0}, #define LINE_PROPERTIES_DEFAULTS\ |