[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sfx2/source

Szymon Kłos szymon.klos at collabora.com
Sun Jun 4 10:16:33 UTC 2017


 sfx2/source/doc/watermarkitem.cxx |   35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

New commits:
commit 4a17ebe23a88297fa2f1cd85f0bef8c266962188
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Thu May 25 15:12:46 2017 +0200

    Watermark: updated Put and QueryValue
    
    Change-Id: Ica65be783130b1981093204edd03dc793a16343b
    Reviewed-on: https://gerrit.libreoffice.org/38027
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
    (cherry picked from commit 6533c30f7f8b62671fef9e636c49b11127812ed1)
    Reviewed-on: https://gerrit.libreoffice.org/38380
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sfx2/source/doc/watermarkitem.cxx b/sfx2/source/doc/watermarkitem.cxx
index ebb794fcd73e..f54745694557 100644
--- a/sfx2/source/doc/watermarkitem.cxx
+++ b/sfx2/source/doc/watermarkitem.cxx
@@ -9,6 +9,7 @@
 
 #include <sfx2/watermarkitem.hxx>
 #include <sfx2/sfxsids.hrc>
+#include <comphelper/propertysequence.hxx>
 
 SfxWatermarkItem::SfxWatermarkItem()
 : SfxPoolItem( SID_WATERMARK )
@@ -52,26 +53,36 @@ SfxPoolItem* SfxWatermarkItem::Clone( SfxItemPool *) const
 
 bool SfxWatermarkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
 {
-    rVal <<= m_aText;
-    rVal <<= m_aFont;
-    rVal <<= m_nAngle;
-    rVal <<= m_nTransparency;
-    rVal <<= m_nColor;
+    rVal <<= comphelper::InitPropertySequence( {
+        { "Text", css::uno::makeAny( m_aText ) },
+        { "Font", css::uno::makeAny( m_aFont ) },
+        { "Angle", css::uno::makeAny( m_nAngle ) },
+        { "Transparency", css::uno::makeAny( m_nTransparency ) },
+        { "Color", css::uno::makeAny( m_nColor ) },
+    } );
 
     return true;
 }
 
 bool SfxWatermarkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
 {
-    OUString aText;
+    css::uno::Sequence<css::beans::PropertyValue> aSequence;
 
-    if ( rVal >>= aText )
+    if ( rVal >>= aSequence )
     {
-        m_aText = aText;
-        rVal >>= m_aFont;
-        rVal >>= m_nAngle;
-        rVal >>= m_nTransparency;
-        rVal >>= m_nColor;
+        for(const auto& aEntry : aSequence)
+        {
+            if(aEntry.Name == "Text")
+                aEntry.Value >>= m_aText;
+            if(aEntry.Name == "Font")
+                aEntry.Value >>= m_aFont;
+            if(aEntry.Name == "Angle")
+                aEntry.Value >>= m_nAngle;
+            if(aEntry.Name == "Transparency")
+                aEntry.Value >>= m_nTransparency;
+            if(aEntry.Name == "Color")
+                aEntry.Value >>= m_nColor;
+        }
         return true;
     }
 


More information about the Libreoffice-commits mailing list