summaryrefslogtreecommitdiff
path: root/svx/source/table/viewcontactoftableobj.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-02 14:09:31 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-02 17:19:47 +0100
commita75bf43a8d6c5dec6dcc86908c142ceec541aa8c (patch)
tree8a88986f2f6620ccd6f707c93125d94716274ae1 /svx/source/table/viewcontactoftableobj.cxx
parent5b464179c19310504e5a6f900811b7cc523120b6 (diff)
tdf#129961 svx: add rendering for table shadow as direct format
There was already shadow support in ViewContactOfTableObj::createViewIndependentPrimitive2DSequence(), but the UNO API and UI could only set the shadow properties on a shape style, so shadow-as-direct-format is new. One difference between the PowerPoint shadow and our shadow is that we draw shadow for table text as well, while PowerPoint only does it for the borders / cell fill style. This means we're either backwards-compatible or compatible with PowerPoint. Solve this problem by leaving the style case unchanged, but render direct formatting like PowerPoint. Change-Id: I2bc64fea8062f9d8162b95d1eaccb49c3466b5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107073 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx/source/table/viewcontactoftableobj.cxx')
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx34
1 files changed, 33 insertions, 1 deletions
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index fe6d03f1d900..bd950a02f7fb 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -36,6 +36,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/framelink.hxx>
#include <svx/framelinkarray.hxx>
+#include <svx/sdooitm.hxx>
#include <vcl/canvastools.hxx>
#include <cell.hxx>
@@ -205,6 +206,7 @@ namespace sdr::contact
// directly to aRetval, Border info to aBorderSequence and added
// later to get the correct overlapping
drawinglayer::primitive2d::Primitive2DContainer aRetval;
+ drawinglayer::primitive2d::Primitive2DContainer aRetvalForShadow;
const sal_Int32 nRowCount(xTable->getRowCount());
const sal_Int32 nColCount(xTable->getColumnCount());
const sal_Int32 nAllCount(nRowCount * nColCount);
@@ -317,6 +319,16 @@ namespace sdr::contact
aCellMatrix, aAttribute));
aRetval.append(xCellReference);
}
+
+ // Create cell primitive without text.
+ aAttribute
+ = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
+ rCellItemSet, nullptr);
+ const drawinglayer::primitive2d::Primitive2DReference
+ xCellReference(
+ new drawinglayer::primitive2d::SdrCellPrimitive2D(
+ aCellMatrix, aAttribute));
+ aRetvalForShadow.append(xCellReference);
}
}
}
@@ -364,6 +376,10 @@ namespace sdr::contact
new drawinglayer::primitive2d::TransformPrimitive2D(
aTransform,
aCellBorderPrimitives));
+
+ // Borders are always the same for shadow as well.
+ aRetvalForShadow.append(new drawinglayer::primitive2d::TransformPrimitive2D(
+ aTransform, aCellBorderPrimitives));
}
}
@@ -376,7 +392,23 @@ namespace sdr::contact
if(!aNewShadowAttribute.isDefault())
{
- aRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(aRetval, aNewShadowAttribute);
+ bool bDirectShadow
+ = rObjectItemSet.Get(SDRATTR_SHADOW, /*bSrchInParent=*/false)
+ .GetValue();
+ if (bDirectShadow)
+ {
+ // Shadow as direct formatting: no shadow for text, to be compatible
+ // with PowerPoint.
+ basegfx::B2DHomMatrix aMatrix;
+ aRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(
+ aRetval, aNewShadowAttribute, aMatrix, &aRetvalForShadow);
+ }
+ else
+ {
+ // Shadow as style: shadow for text, to be backwards-compatible.
+ aRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(
+ aRetval, aNewShadowAttribute);
+ }
}
}