[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - editeng/source include/editeng sd/source sw/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 29 13:46:41 UTC 2019


 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 c5c40523eaabb7d07fb49983ebcf9b0636d34389
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 14:41:53 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 29 14:45:33 2019 +0100

    jsdialog: migrate left/right margin to generic items dump
    
    Change-Id: Ie687393ae4b9a7f8350eea07c1d417c11fc532bd
    Reviewed-on: https://gerrit.libreoffice.org/84000
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 9c728636d85d..0e1c22731ad7 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -686,6 +686,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 a1b768dda66d..5584fe698d83 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -118,7 +118,9 @@ public:
                     { return nPropFirstLineOfst; }
     void SetTextFirstLineOfstValue( const short nValue )
                     { nFirstLineOfst = nValue; }
+
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
+    virtual boost::property_tree::ptree dumpAsJSON() const override;
 };
 
 inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy )
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 997bbe1d8620..fa0e40d1461f 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -49,8 +49,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>
 
@@ -572,28 +570,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 70ef0ba431f7..5af84af21eff 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -39,8 +39,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>
@@ -725,28 +723,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);
@@ -840,6 +816,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: */


More information about the Libreoffice-commits mailing list