[Libreoffice-commits] core.git: sw/source

Szymon Kłos szymon.klos at collabora.com
Tue May 23 18:17:05 UTC 2017


 sw/source/core/edit/edfcol.cxx |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit b535d31f95809906c8eef5a8e8096e137f32a533
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Tue May 23 13:40:24 2017 +0200

    Watermark: read angle value
    
    Change-Id: Ib6b98c58b1251c27476cbbbd03a2f7ed97e68c45
    Reviewed-on: https://gerrit.libreoffice.org/37947
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

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)
             {


More information about the Libreoffice-commits mailing list