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>
This commit is contained in:
parent
be7ce49f33
commit
c27946fb15
19 changed files with 213 additions and 20 deletions
|
@ -20,6 +20,7 @@
|
|||
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
|
||||
#include <basegfx/vector/b2dvector.hxx>
|
||||
#include <basegfx/color/bcolor.hxx>
|
||||
#include <docmodel/theme/FormatScheme.hxx>
|
||||
|
||||
|
||||
namespace drawinglayer::attribute
|
||||
|
@ -32,6 +33,7 @@ namespace drawinglayer::attribute
|
|||
basegfx::B2DVector maSize; // [0.0 .. 2.0]
|
||||
double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
|
||||
sal_Int32 mnBlur; // [0 .. 180], radius of the blur
|
||||
model::RectangleAlignment meAlignment{model::RectangleAlignment::Unset}; // alignment of the shadow
|
||||
basegfx::BColor maColor; // color of shadow
|
||||
|
||||
ImpSdrShadowAttribute(
|
||||
|
@ -39,11 +41,13 @@ namespace drawinglayer::attribute
|
|||
const basegfx::B2DVector& rSize,
|
||||
double fTransparence,
|
||||
sal_Int32 nBlur,
|
||||
model::RectangleAlignment eAlignment,
|
||||
const basegfx::BColor& rColor)
|
||||
: maOffset(rOffset),
|
||||
maSize(rSize),
|
||||
mfTransparence(fTransparence),
|
||||
mnBlur(nBlur),
|
||||
meAlignment(eAlignment),
|
||||
maColor(rColor)
|
||||
{
|
||||
}
|
||||
|
@ -67,6 +71,7 @@ namespace drawinglayer::attribute
|
|||
&& getSize() == rCandidate.getSize()
|
||||
&& getTransparence() == rCandidate.getTransparence()
|
||||
&& getBlur() == rCandidate.getBlur()
|
||||
&& meAlignment == rCandidate.meAlignment
|
||||
&& getColor() == rCandidate.getColor());
|
||||
}
|
||||
};
|
||||
|
@ -86,9 +91,10 @@ namespace drawinglayer::attribute
|
|||
const basegfx::B2DVector& rSize,
|
||||
double fTransparence,
|
||||
sal_Int32 nBlur,
|
||||
model::RectangleAlignment eAlignment,
|
||||
const basegfx::BColor& rColor)
|
||||
: mpSdrShadowAttribute(ImpSdrShadowAttribute(
|
||||
rOffset, rSize, fTransparence,nBlur, rColor))
|
||||
rOffset, rSize, fTransparence, nBlur, eAlignment, rColor))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -141,6 +147,11 @@ namespace drawinglayer::attribute
|
|||
return mpSdrShadowAttribute->getBlur();
|
||||
}
|
||||
|
||||
model::RectangleAlignment SdrShadowAttribute::getAlignment() const
|
||||
{
|
||||
return mpSdrShadowAttribute->meAlignment;
|
||||
}
|
||||
|
||||
const basegfx::BColor& SdrShadowAttribute::getColor() const
|
||||
{
|
||||
return mpSdrShadowAttribute->getColor();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
42
include/svx/RectangleAlignmentItem.hxx
Normal file
42
include/svx/RectangleAlignmentItem.hxx
Normal file
|
@ -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: */
|
|
@ -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 */
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <docmodel/theme/FormatScheme.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -38,6 +39,7 @@ void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourcePro
|
|||
assignIfUsed( moShadowSy, rSourceProps.moShadowSy );
|
||||
moShadowColor.assignIfUsed( rSourceProps.moShadowColor );
|
||||
assignIfUsed( moShadowBlur, rSourceProps.moShadowBlur );
|
||||
assignIfUsed( moShadowAlignment, rSourceProps.moShadowAlignment );
|
||||
|
||||
}
|
||||
|
||||
|
@ -105,6 +107,9 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
|
|||
rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper ) );
|
||||
rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency());
|
||||
rPropMap.setProperty( PROP_ShadowBlur, convertEmuToHmm(nAttrBlur));
|
||||
rPropMap.setProperty(
|
||||
PROP_ShadowAlignment,
|
||||
static_cast<sal_Int32>(maShadow.moShadowAlignment.value_or(model::RectangleAlignment::Bottom)));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace model {
|
||||
enum class RectangleAlignment;
|
||||
}
|
||||
|
||||
namespace oox::drawingml {
|
||||
|
||||
struct EffectGlowProperties
|
||||
|
@ -43,6 +47,7 @@ struct EffectShadowProperties
|
|||
std::optional< sal_Int64 > moShadowSy;
|
||||
Color moShadowColor;
|
||||
std::optional< sal_Int64 > moShadowBlur; // size of blur effect
|
||||
std::optional< model::RectangleAlignment > moShadowAlignment;
|
||||
|
||||
/** Overwrites all members that are explicitly set in rSourceProps. */
|
||||
void assignUsed( const EffectShadowProperties& rSourceProps );
|
||||
|
|
|
@ -87,6 +87,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
|
|||
mrEffectProperties.maShadow.moShadowSx = rAttribs.getInteger( XML_sx, 0 );
|
||||
mrEffectProperties.maShadow.moShadowSy = rAttribs.getInteger( XML_sy, 0 );
|
||||
mrEffectProperties.maShadow.moShadowBlur = rAttribs.getInteger( XML_blurRad, 0 );
|
||||
mrEffectProperties.maShadow.moShadowAlignment = convertToRectangleAlignment( rAttribs.getToken(XML_algn, XML_b) );
|
||||
|
||||
model::ColorDefinition* pColor = nullptr;
|
||||
if (mpEffectStyle)
|
||||
|
|
|
@ -471,6 +471,7 @@ Segments
|
|||
SelectedItems
|
||||
SelectedPage
|
||||
Shadow
|
||||
ShadowAlignment
|
||||
ShadowColor
|
||||
ShadowFormat
|
||||
ShadowSizeX
|
||||
|
|
|
@ -219,6 +219,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
|
|||
svx/source/items/customshapeitem \
|
||||
svx/source/items/drawitem \
|
||||
svx/source/items/e3ditem \
|
||||
svx/source/items/RectangleAlignmentItem \
|
||||
svx/source/items/galleryitem \
|
||||
svx/source/items/grfitem \
|
||||
svx/source/sdr/animation/scheduler \
|
||||
|
|
BIN
svx/qa/unit/data/tdf150020-shadow-alignment.pptx
Normal file
BIN
svx/qa/unit/data/tdf150020-shadow-alignment.pptx
Normal file
Binary file not shown.
|
@ -80,6 +80,53 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin)
|
|||
CPPUNIT_ASSERT_EQUAL(sal_Int32(-684), fShadowY);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment)
|
||||
{
|
||||
loadFromURL(u"tdf150020-shadow-alignment.pptx");
|
||||
|
||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
|
||||
uno::UNO_QUERY);
|
||||
drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
|
||||
= renderPageToPrimitives(xDrawPage);
|
||||
|
||||
// Examine the created primitives.
|
||||
drawinglayer::Primitive2dXmlDump aDumper;
|
||||
xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
|
||||
|
||||
// Without the accompanying fix in place, this test would have failed with:
|
||||
// - Expected: -567
|
||||
// - Actual : 162
|
||||
// - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value.
|
||||
// i.e. shadow alignment was ignored while scaling the shadow.
|
||||
assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567");
|
||||
assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794");
|
||||
assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021");
|
||||
assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567");
|
||||
assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021");
|
||||
assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566");
|
||||
assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", "-1794");
|
||||
assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", "-1693");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[8]", "xy13", "-3022");
|
||||
assertXPath(pDocument, "(//shadow/transform)[8]", "xy23", "-1691");
|
||||
|
||||
assertXPath(pDocument, "(//shadow/transform)[9]", "xy13", "-1794");
|
||||
assertXPath(pDocument, "(//shadow/transform)[9]", "xy23", "-750");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap)
|
||||
{
|
||||
// Load a document containing a 0-width shape with text.
|
||||
|
|
31
svx/source/items/RectangleAlignmentItem.cxx
Normal file
31
svx/source/items/RectangleAlignmentItem.cxx
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*- 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/.
|
||||
*/
|
||||
|
||||
#include <svx/RectangleAlignmentItem.hxx>
|
||||
#include <docmodel/theme/FormatScheme.hxx>
|
||||
|
||||
SvxRectangleAlignmentItem::SvxRectangleAlignmentItem(sal_uInt16 nWhich,
|
||||
model::RectangleAlignment nValue)
|
||||
: SfxEnumItem<model::RectangleAlignment>(nWhich, nValue)
|
||||
{
|
||||
}
|
||||
|
||||
SvxRectangleAlignmentItem::~SvxRectangleAlignmentItem() {}
|
||||
|
||||
SvxRectangleAlignmentItem* SvxRectangleAlignmentItem::Clone(SfxItemPool*) const
|
||||
{
|
||||
return new SvxRectangleAlignmentItem(*this);
|
||||
}
|
||||
|
||||
sal_uInt16 SvxRectangleAlignmentItem::GetValueCount() const
|
||||
{
|
||||
return model::RECTANGLE_ALIGNMENT_COUNT;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
|
@ -53,6 +53,7 @@
|
|||
#include <svx/xflbmtit.hxx>
|
||||
#include <svx/xflbstit.hxx>
|
||||
#include <svx/xtextit0.hxx>
|
||||
#include <svx/RectangleAlignmentItem.hxx>
|
||||
#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
|
||||
#include <svx/svdotext.hxx>
|
||||
#include <sdr/attribute/sdrtextattribute.hxx>
|
||||
|
@ -402,7 +403,9 @@ namespace drawinglayer::primitive2d
|
|||
|
||||
sal_Int32 nBlur(rSet.Get(SDRATTR_SHADOWBLUR).GetValue());
|
||||
|
||||
return attribute::SdrShadowAttribute(aOffset, aSize, static_cast<double>(nTransparence) * 0.01,nBlur, aColor.getBColor());
|
||||
model::RectangleAlignment eAlignment{rSet.Get(SDRATTR_SHADOWALIGNMENT).GetValue()};
|
||||
|
||||
return attribute::SdrShadowAttribute(aOffset, aSize, static_cast<double>(nTransparence) * 0.01, nBlur, eAlignment, aColor.getBColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
|
||||
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
|
||||
#include <drawinglayer/attribute/sdrglowattribute.hxx>
|
||||
#include <docmodel/theme/FormatScheme.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
// for SlideBackgroundFillPrimitive2D
|
||||
|
@ -65,6 +66,35 @@ namespace drawinglayer::primitive2d
|
|||
{
|
||||
namespace
|
||||
{
|
||||
/// @returns the offset to apply/unapply to scale according to correct origin for a given alignment.
|
||||
basegfx::B2DTuple getShadowScaleOriginOffset(const basegfx::B2DTuple& aScale,
|
||||
model::RectangleAlignment eAlignment)
|
||||
{
|
||||
switch (eAlignment)
|
||||
{
|
||||
case model::RectangleAlignment::TopLeft:
|
||||
return { 0, 0 };
|
||||
case model::RectangleAlignment::Top:
|
||||
return { aScale.getX() / 2, 0 };
|
||||
case model::RectangleAlignment::TopRight:
|
||||
return { aScale.getX(), 0 };
|
||||
case model::RectangleAlignment::Left:
|
||||
return { 0, aScale.getY() / 2 };
|
||||
case model::RectangleAlignment::Center:
|
||||
return { aScale.getX() / 2, aScale.getY() / 2 };
|
||||
case model::RectangleAlignment::Right:
|
||||
return { aScale.getX(), aScale.getY() / 2 };
|
||||
case model::RectangleAlignment::BottomLeft:
|
||||
return { 0, aScale.getY() };
|
||||
case model::RectangleAlignment::Bottom:
|
||||
return { aScale.getX() / 2, aScale.getY() };
|
||||
case model::RectangleAlignment::BottomRight:
|
||||
return { aScale.getX(), aScale.getY() };
|
||||
default:
|
||||
return { 0, 0 };
|
||||
}
|
||||
};
|
||||
|
||||
// See also: SdrTextObj::AdjustRectToTextDistance
|
||||
basegfx::B2DRange getTextAnchorRange(const attribute::SdrTextAttribute& rText,
|
||||
const basegfx::B2DRange& rSnapRange)
|
||||
|
@ -775,19 +805,10 @@ sal_uInt32 SlideBackgroundFillPrimitive2D::getPrimitive2DID() const
|
|||
double fShearX = 0;
|
||||
rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
|
||||
// Scale the shadow
|
||||
double nTranslateX = aTranslate.getX();
|
||||
double nTranslateY = aTranslate.getY();
|
||||
|
||||
// The origin for scaling is the top left corner by default. A negative
|
||||
// shadow offset changes the origin.
|
||||
if (rShadow.getOffset().getX() < 0)
|
||||
nTranslateX += aScale.getX();
|
||||
if (rShadow.getOffset().getY() < 0)
|
||||
nTranslateY += aScale.getY();
|
||||
|
||||
aShadowOffset.translate(-nTranslateX, -nTranslateY);
|
||||
aTranslate += getShadowScaleOriginOffset(aScale, rShadow.getAlignment());
|
||||
aShadowOffset.translate(-aTranslate);
|
||||
aShadowOffset.scale(rShadow.getSize().getX() * 0.00001, rShadow.getSize().getY() * 0.00001);
|
||||
aShadowOffset.translate(nTranslateX, nTranslateY);
|
||||
aShadowOffset.translate(aTranslate);
|
||||
}
|
||||
|
||||
aShadowOffset.translate(rShadow.getOffset().getX(), rShadow.getOffset().getY());
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
|
||||
#include <com/sun/star/drawing/CircleKind.hpp>
|
||||
|
||||
#include <docmodel/theme/FormatScheme.hxx>
|
||||
|
||||
#include <editeng/boxitem.hxx>
|
||||
#include <editeng/eeitem.hxx>
|
||||
#include <editeng/lineitem.hxx>
|
||||
|
@ -95,6 +97,7 @@
|
|||
#include <svx/sxmtritm.hxx>
|
||||
#include <svx/sxmuitm.hxx>
|
||||
#include <svx/xcolit.hxx>
|
||||
#include <svx/RectangleAlignmentItem.hxx>
|
||||
#include <sxoneitm.hxx>
|
||||
#include <sxopitm.hxx>
|
||||
#include <sxreaitm.hxx>
|
||||
|
@ -135,6 +138,7 @@ SdrItemPool::SdrItemPool(
|
|||
rPoolDefaults[SDRATTR_SHADOWSIZEY -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWSIZEY, 100000);
|
||||
rPoolDefaults[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]=new SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE, 0);
|
||||
rPoolDefaults[SDRATTR_SHADOWBLUR -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWBLUR, 0);
|
||||
rPoolDefaults[SDRATTR_SHADOWALIGNMENT -SDRATTR_START]=new SvxRectangleAlignmentItem(SDRATTR_SHADOWALIGNMENT, model::RectangleAlignment::Unset);
|
||||
rPoolDefaults[SDRATTR_SHADOW3D -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOW3D );
|
||||
rPoolDefaults[SDRATTR_SHADOWPERSP -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOWPERSP );
|
||||
rPoolDefaults[SDRATTR_CAPTIONTYPE -SDRATTR_START]=new SdrCaptionTypeItem ;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <swmodeltestbase.hxx>
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <vcl/scheduler.hxx>
|
||||
#include <svx/svddef.hxx>
|
||||
|
||||
#include <fmtanchr.hxx>
|
||||
#include <fmtfsize.hxx>
|
||||
|
@ -1157,22 +1158,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025)
|
|||
// SDRATTR_TEXT_LEFTDIST
|
||||
assertXPath(pXmlDoc,
|
||||
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1072']",
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
|
||||
"[@whichId='"
|
||||
+ OString::number(SDRATTR_TEXT_LEFTDIST) + "']",
|
||||
"value", "567");
|
||||
// SDRATTR_TEXT_RIGHTDIST
|
||||
assertXPath(pXmlDoc,
|
||||
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1073']",
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
|
||||
"[@whichId='"
|
||||
+ OString::number(SDRATTR_TEXT_RIGHTDIST) + "']",
|
||||
"value", "1134");
|
||||
// SDRATTR_TEXT_UPPERDIST
|
||||
assertXPath(pXmlDoc,
|
||||
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1074']",
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
|
||||
"[@whichId='"
|
||||
+ OString::number(SDRATTR_TEXT_UPPERDIST) + "']",
|
||||
"value", "1701");
|
||||
// SDRATTR_TEXT_LOWERDIST
|
||||
assertXPath(pXmlDoc,
|
||||
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1075']",
|
||||
"/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
|
||||
"[@whichId='"
|
||||
+ OString::number(SDRATTR_TEXT_LOWERDIST) + "']",
|
||||
"value", "2268");
|
||||
|
||||
// Check the textbox-shape import too
|
||||
|
|
Loading…
Reference in a new issue