summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-05-23 13:40:24 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-05-23 21:07:35 +0200
commitc31d99bdd74144120545d408e0bf8acf506e16a1 (patch)
treec1ae2c642a279cfae03f3504b3c73c6fc7feb318 /sw
parent5b34c61bff3d1767b0d39fd13189d7a82cf591f5 (diff)
Watermark: read angle value
Change-Id: Ib6b98c58b1251c27476cbbbd03a2f7ed97e68c45 Reviewed-on: https://gerrit.libreoffice.org/37947 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> (cherry picked from commit b535d31f95809906c8eef5a8e8096e137f32a533) Reviewed-on: https://gerrit.libreoffice.org/37959
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/edit/edfcol.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 97129c354583..c39ccadf3f81 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -294,6 +294,7 @@ SfxWatermarkItem SwEditShell::GetWatermark()
sal_uInt32 nColor;
sal_Int16 nTransparency;
OUString aFont;
+ drawing::HomogenMatrix3 aMatrix;
aItem.SetText(xTextRange->getString());
@@ -301,7 +302,14 @@ SfxWatermarkItem SwEditShell::GetWatermark()
aItem.SetFont(aFont);
if (xPropertySet->getPropertyValue(UNO_NAME_FILLCOLOR) >>= nColor)
aItem.SetColor(nColor);
- // TODO: aItem.SetAngle(nAngle);
+ if (xPropertySet->getPropertyValue("Transformation") >>= aMatrix)
+ {
+ double y = aMatrix.Line2.Column1;
+ double x = aMatrix.Line1.Column1;
+ double nRad = atan2(y, x) * -1;
+ double nDeg = nRad * 180.0 / F_PI;
+ aItem.SetAngle(nDeg);
+ }
if (xPropertySet->getPropertyValue(UNO_NAME_FILL_TRANSPARENCE) >>= nTransparency)
aItem.SetTransparency(nTransparency);
@@ -347,21 +355,28 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
bool bDeleteWatermark = rWatermark.GetText().isEmpty();
if (xWatermark.is())
{
+ drawing::HomogenMatrix3 aMatrix;
sal_uInt32 nColor = 0xc0c0c0;
sal_Int16 nTransparency = 50;
+ sal_Int16 nAngle = 45;
OUString aFont = "";
uno::Reference<beans::XPropertySet> xPropertySet(xWatermark, uno::UNO_QUERY);
xPropertySet->getPropertyValue(UNO_NAME_CHAR_FONT_NAME) >>= aFont;
xPropertySet->getPropertyValue(UNO_NAME_FILLCOLOR) >>= nColor;
- // TODO: Angle
xPropertySet->getPropertyValue(UNO_NAME_FILL_TRANSPARENCE) >>= nTransparency;
+ xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
+ double y = aMatrix.Line2.Column1;
+ double x = aMatrix.Line1.Column1;
+ double nRad = atan2(y, x) * -1;
+ nAngle = nRad * 180.0 / F_PI;
// If the header already contains a watermark, see if it its text is up to date.
uno::Reference<text::XTextRange> xTextRange(xWatermark, uno::UNO_QUERY);
if (xTextRange->getString() != rWatermark.GetText()
|| aFont != rWatermark.GetFont()
|| nColor != rWatermark.GetColor()
+ || nAngle != rWatermark.GetAngle()
|| nTransparency != rWatermark.GetTransparency()
|| bDeleteWatermark)
{