editeng/source/items/frmitems.cxx   |   28 ++++++++++++++++++++++++++++
 include/editeng/lrspitem.hxx        |    2 ++
 sd/source/ui/view/drtxtob.cxx       |   24 ------------------------
 sw/source/uibase/shells/txtattr.cxx |   28 ++++------------------------
 4 files changed, 34 insertions(+), 48 deletions(-)

New commits:
commit db0f4b28d9f1583d9977f76114d86bac489de161
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 28 14:41:53 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Nov 29 14:45:34 2019 +0100

    jsdialog: migrate left/right margin to generic items dump
    
    Change-Id: Ie687393ae4b9a7f8350eea07c1d417c11fc532bd
    Reviewed-on: https://gerrit.libreoffice.org/84002
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index ef9b39999fc6..37f1c1a04ff7 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -625,6 +625,34 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 }
 
 
+boost::property_tree::ptree SvxLRSpaceItem::dumpAsJSON() const
+{
+    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+    boost::property_tree::ptree aState;
+
+    MapUnit eTargetUnit = MapUnit::MapInch;
+
+    OUString sLeft = GetMetricText(GetLeft(),
+                        MapUnit::MapTwip, eTargetUnit, nullptr);
+
+    OUString sRight = GetMetricText(GetRight(),
+                        MapUnit::MapTwip, eTargetUnit, nullptr);
+
+    OUString sFirstline = GetMetricText(GetTextFirstLineOfst(),
+                        MapUnit::MapTwip, eTargetUnit, nullptr);
+
+    aState.put("left", sLeft);
+    aState.put("right", sRight);
+    aState.put("firstline", sFirstline);
+    aState.put("unit", "inch");
+
+    aTree.push_back(std::make_pair("state", aState));
+
+    return aTree;
+}
+
+
 SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId )
     : SfxPoolItem(nId)
     , nUpper(0)
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index 32ad5907e2b8..3c5a06f1fe83 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -116,7 +116,9 @@ public:
                     { return nPropFirstLineOfst; }
     void SetTextFirstLineOfstValue( const short nValue )
                     { nFirstLineOfst = nValue; }
+
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+    virtual boost::property_tree::ptree dumpAsJSON() const override;
 };
 
 inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp )
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 94679765eb73..d010706ab7da 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -45,8 +45,6 @@
 #include <editeng/frmdiritem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
 
 #include <sfx2/objface.hxx>
 
@@ -594,28 +592,6 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
         rSet.Put(aLRSpace);
         Invalidate(SID_ATTR_PARA_LRSPACE);
 
-        if (comphelper::LibreOfficeKit::isActive())
-        {
-            // TODO: set correct unit
-            MapUnit eTargetUnit = MapUnit::MapInch;
-
-            OUString sLeft = GetMetricText(aLRSpace.GetLeft(),
-                                MapUnit::MapTwip, eTargetUnit, nullptr);
-
-            OUString sRight = GetMetricText(aLRSpace.GetRight(),
-                                MapUnit::MapTwip, eTargetUnit, nullptr);
-
-            OUString sFirstline = 
GetMetricText(aLRSpace.GetTextFirstLineOfst(),
-                                MapUnit::MapTwip, eTargetUnit, nullptr);
-
-            OUString sPayload = ".uno:LeftRightParaMargin={\"left\": \"" + 
sLeft +
-                "\", \"right\": \"" + sRight +
-                "\", \"firstline\": \"" + sFirstline + "\"}";
-
-            
GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                OUStringToOString(sPayload, 
RTL_TEXTENCODING_ASCII_US).getStr());
-        }
-
         //Added by xuxu
         SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
         if ( eState == SfxItemState::DONTCARE )
diff --git a/sw/source/uibase/shells/txtattr.cxx 
b/sw/source/uibase/shells/txtattr.cxx
index 737a1e094e41..1b11fcca7bad 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -40,8 +40,6 @@
 #include <editeng/cmapitem.hxx>
 #include <paratr.hxx>
 #include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
 
 #include <fmtinfmt.hxx>
 #include <docsh.hxx>
@@ -755,28 +753,6 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
                     SvxLRSpaceItem aLR = aCoreSet.Get( RES_LR_SPACE );
                     aLR.SetWhich(nSlot);
                     rSet.Put(aLR);
-
-                    if (comphelper::LibreOfficeKit::isActive())
-                    {
-                        // TODO: set correct unit
-                        MapUnit eTargetUnit = MapUnit::MapInch;
-
-                        OUString sLeft = GetMetricText(aLR.GetLeft(),
-                                            MapUnit::MapTwip, eTargetUnit, 
nullptr);
-
-                        OUString sRight = GetMetricText(aLR.GetRight(),
-                                            MapUnit::MapTwip, eTargetUnit, 
nullptr);
-
-                        OUString sFirstline = 
GetMetricText(aLR.GetTextFirstLineOfst(),
-                                            MapUnit::MapTwip, eTargetUnit, 
nullptr);
-
-                        OUString sPayload = 
".uno:LeftRightParaMargin={\"left\": \"" + sLeft +
-                            "\", \"right\": \"" + sRight +
-                            "\", \"firstline\": \"" + sFirstline + "\"}";
-
-                        
GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                            OUStringToOString(sPayload, 
RTL_TEXTENCODING_ASCII_US).getStr());
-                    }
                 }
                 else
                     rSet.InvalidateItem(nSlot);
@@ -870,6 +846,10 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
     }
 
     rSet.Put(aCoreSet,false);
+
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (pViewShell && comphelper::LibreOfficeKit::isActive())
+        pViewShell->sendUnoStatus( &rSet );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to