diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-28 14:41:53 +0100 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2020-05-13 19:52:46 +0200 |
commit | 4ae1bdbff19b127d2e9d2a7533478c424d1520f5 (patch) | |
tree | 421d8bd1c7e7ef3ab10874ad5e34c24b76499bf7 | |
parent | 0cb031d2253647aab3bfbc889a1949be0e47f164 (diff) |
jsdialog: migrate left/right margin to generic items dump
Change-Id: Ie687393ae4b9a7f8350eea07c1d417c11fc532bd
Reviewed-on: https://gerrit.libreoffice.org/84000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | editeng/source/items/frmitems.cxx | 28 | ||||
-rw-r--r-- | include/editeng/lrspitem.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/shells/txtattr.cxx | 28 |
4 files changed, 34 insertions, 48 deletions
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: */ |