Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
libreoffice.15777
bsc1165849-3.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc1165849-3.diff of Package libreoffice.15777
From 74f3a7b9161ede870fbe2642158601ea3eaa073e Mon Sep 17 00:00:00 2001 From: Miklos Vajna <vmiklos@collabora.com> Date: Wed, 20 Nov 2019 10:18:37 +0100 Subject: [PATCH] drawinglayer: handle more primitives in the xml dump In preparation of writing a test for semi-transparent shape text. Change-Id: I2dac94a6cd9da48de9a5e407ceab78fb8be933d7 Reviewed-on: https://gerrit.libreoffice.org/83264 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit b6d794e14e65697fbf47a5b425d9d264e26e0161) tdf#129916 svx: fix origin of scaled shadow We assumed that the top left corner is the origin for scaling, but that is not necessarily the case. The intention is that the shadow direction can be determined from its x and y offset, and the origin is the opposite corner of the shape. (cherry picked from commit e21d522dddce2590ed435890ae8d5fe39658a71a) Conflicts: svx/CppunitTest_svx_unit.mk Change-Id: I6759302767d20739b6e2be79d379740dd06f70f5 --- .../source/tools/primitive2dxmldump.cxx | 83 ++++++++++++++- svx/qa/unit/sdr.cxx | 96 ++++++++++++++++++ .../sdr/primitive2d/sdrdecompositiontools.cxx | 14 ++- 4 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 svx/qa/unit/data/shadow-scale-origin.pptx create mode 100644 svx/qa/unit/sdr.cxx diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 65170ae096f2..64117de878bd 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -34,6 +34,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> using namespace drawinglayer::primitive2d; @@ -155,7 +156,7 @@ void Primitive2dXmlDump::decomposeAndWrite( if (!pBasePrimitive) continue; sal_uInt32 nId = pBasePrimitive->getPrimitive2DID(); - if (maFilter[nId]) + if (nId < maFilter.size() && maFilter[nId]) continue; OUString sCurrentElementTag = drawinglayer::primitive2d::idToString(nId); @@ -336,9 +337,87 @@ void Primitive2dXmlDump::decomposeAndWrite( break; + case PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D: + { + // SdrRectanglePrimitive2D is private to us. + rWriter.startElement("sdrrectangle"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + + case PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D: + { + // SdrBlockTextPrimitive2D is private to us. + rWriter.startElement("sdrblocktext"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + + case PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D: + { + // TextHierarchyBlockPrimitive2D. + rWriter.startElement("texthierarchyblock"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + + case PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D: + { + // TextHierarchyParagraphPrimitive2D. + rWriter.startElement("texthierarchyparagraph"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + + case PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D: + { + // TextHierarchyLinePrimitive2D. + rWriter.startElement("texthierarchyline"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + + case PRIMITIVE2D_ID_SHADOWPRIMITIVE2D: + { + // ShadowPrimitive2D. + rWriter.startElement("shadow"); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); + break; + } + default: { - rWriter.element(OUStringToOString(sCurrentElementTag, RTL_TEXTENCODING_UTF8)); + rWriter.startElement("unhandled"); + rWriter.attribute("id", OUStringToOString(sCurrentElementTag, RTL_TEXTENCODING_UTF8)); + drawinglayer::primitive2d::Primitive2DContainer aPrimitiveContainer; + pBasePrimitive->get2DDecomposition(aPrimitiveContainer, + drawinglayer::geometry::ViewInformation2D()); + decomposeAndWrite(aPrimitiveContainer, rWriter); + rWriter.endElement(); } break; } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 42c0bb60ecc9..48575d3b4917 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -499,9 +499,19 @@ namespace drawinglayer double fShearX = 0; rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); // Scale the shadow - aShadowOffset.translate(-aTranslate.getX(), -aTranslate.getY()); + 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); aShadowOffset.scale(rShadow.getSize().getX() * 0.00001, rShadow.getSize().getY() * 0.00001); - aShadowOffset.translate(aTranslate.getX(), aTranslate.getY()); + aShadowOffset.translate(nTranslateX, nTranslateY); } aShadowOffset.translate(rShadow.getOffset().getX(), rShadow.getOffset().getY()); -- 2.26.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor