[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 12:44:36 UTC 2019


 editeng/source/items/frmitems.cxx   |   23 +++++++++++++++++++++++
 include/editeng/ulspitem.hxx        |    2 ++
 sd/source/ui/view/drtxtob.cxx       |   23 -----------------------
 sw/source/uibase/uiview/viewtab.cxx |   24 ++++--------------------
 4 files changed, 29 insertions(+), 43 deletions(-)

New commits:
commit 4ebb86309b39b3d02b56d82ce710f57c0871e621
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 14:22:26 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 29 13:43:26 2019 +0100

    jsdialog: migrate after/before spacing to generic items dump
    
    Change-Id: I18f0596baa8e1136f4546a943eafab9a13929c06
    Reviewed-on: https://gerrit.libreoffice.org/83998
    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 57c462d7d122..9c728636d85d 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -912,6 +912,29 @@ void SvxULSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
     xmlTextWriterEndElement(pWriter);
 }
 
+boost::property_tree::ptree SvxULSpaceItem::dumpAsJSON() const
+{
+    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+    boost::property_tree::ptree aState;
+
+    MapUnit eTargetUnit = MapUnit::MapInch;
+
+    OUString sUpper = GetMetricText(GetUpper(),
+                        MapUnit::MapTwip, eTargetUnit, nullptr);
+
+    OUString sLower = GetMetricText(GetLower(),
+                        MapUnit::MapTwip, eTargetUnit, nullptr);
+
+    aState.put("upper", sUpper);
+    aState.put("lower", sLower);
+    aState.put("unit", "inch");
+
+    aTree.push_back(std::make_pair("state", aState));
+
+    return aTree;
+}
+
 
 SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const
 {
diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx
index d93aa47d5094..140717317f22 100644
--- a/include/editeng/ulspitem.hxx
+++ b/include/editeng/ulspitem.hxx
@@ -77,7 +77,9 @@ public:
     bool GetContext() const { return bContext; }
     sal_uInt16 GetPropUpper() const { return nPropUpper; }
     sal_uInt16 GetPropLower() const { return nPropLower; }
+
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
+    virtual boost::property_tree::ptree dumpAsJSON() const override;
 };
 
 inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index b1faba5c269d..997bbe1d8620 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -460,38 +460,15 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
                 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
             }
             long nUpper = 0;
-            OUString sUpper, sLower;
-            // TODO: set correct unit
-            MapUnit eTargetUnit = MapUnit::MapInch;
 
             for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
             {
                 const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara );
                 const SvxULSpaceItem& rItem = rItems.Get( EE_PARA_ULSPACE );
                 nUpper = std::max( nUpper, static_cast<long>(rItem.GetUpper()) );
-
-                if (nPara == nStartPara)
-                {
-                    sUpper = GetMetricText(rItem.GetUpper(),
-                        MapUnit::MapTwip, eTargetUnit, nullptr);
-                }
-                if (nPara == nEndPara)
-                {
-                    sLower = GetMetricText(rItem.GetLower(),
-                        MapUnit::MapTwip, eTargetUnit, nullptr);
-                }
             }
             if( nUpper == 0 )
                 rSet.DisableItem( SID_PARASPACE_DECREASE );
-
-            if (comphelper::LibreOfficeKit::isActive())
-            {
-                OUString sPayload = ".uno:ULSpacing={\"upper\": \"" + sUpper +
-                    "\", \"lower\": \"" + sLower + "\"}";
-
-                GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                    OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
-            }
         }
         else
         {
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 96c322aa5d33..befdddd48c0a 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -57,8 +57,6 @@
 #include <ndtxt.hxx>
 #include <pam.hxx>
 #include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
 
 #include <IDocumentSettingAccess.hxx>
 
@@ -1581,24 +1579,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
                     aUL.SetWhich( nWhich );
                     rSet.Put( aUL );
                 }
-
-                if (comphelper::LibreOfficeKit::isActive())
-                {
-                    // TODO: set correct unit
-                    MapUnit eTargetUnit = MapUnit::MapInch;
-
-                    OUString sUpper = GetMetricText(aUL.GetUpper(),
-                                        MapUnit::MapTwip, eTargetUnit, nullptr);
-
-                    OUString sLower = GetMetricText(aUL.GetLower(),
-                                        MapUnit::MapTwip, eTargetUnit, nullptr);
-
-                    OUString sPayload = ".uno:ULSpacing={\"upper\": \"" + sUpper +
-                        "\", \"lower\": \"" + sLower + "\"}";
-
-                    GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                        OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
-                }
             }
             else
             {
@@ -2444,6 +2424,10 @@ void SwView::StateTabWin(SfxItemSet& rSet)
         }
         nWhich = aIter.NextWhich();
     }
+
+    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