summaryrefslogtreecommitdiff
path: root/sw/source/core/edit
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-06-01 08:10:20 +0200
commite54eb23ac824d3f08cd21f2518c153d255200f9d (patch)
tree625e9bcfad4ba43759441b9967b4be67d3a93e6c /sw/source/core/edit
parentc14fcaa5e8d4d3693e18ea8c60ddf8dde5674da3 (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>
Diffstat (limited to 'sw/source/core/edit')
-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 4f1967dc9648..df0dcfabb059 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)
{