diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-28 14:22:26 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-29 13:43:28 +0100 |
commit | 88b0cb4c31d0631ff8db1e4842dc1431ae6d0234 (patch) | |
tree | 373efb887765bfa05029308917694734d2e2f0f9 | |
parent | 5e55f7a54170b25aaf82520c1cde307ece362eef (diff) |
jsdialog: migrate after/before spacing to generic items dump
Change-Id: I18f0596baa8e1136f4546a943eafab9a13929c06
Reviewed-on: https://gerrit.libreoffice.org/83999
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | editeng/source/items/frmitems.cxx | 23 | ||||
-rw-r--r-- | include/editeng/ulspitem.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 23 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewtab.cxx | 24 |
4 files changed, 29 insertions, 43 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 7ee4258df96f..ef9b39999fc6 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -843,6 +843,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 da4eacf7bc06..c9196bafcece 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -74,7 +74,9 @@ public: bool GetContext() const { return bContext; } sal_uInt16 GetPropUpper() const { return nPropUpper; } sal_uInt16 GetPropLower() const { return nPropLower; } + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; }; inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 2c7df774cbf6..94679765eb73 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -482,38 +482,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 f52cf5617664..f5941793eadb 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -62,8 +62,6 @@ #include <ndtxt.hxx> #include <pam.hxx> #include <comphelper/lok.hxx> -#include <LibreOfficeKit/LibreOfficeKitEnums.h> -#include <editeng/itemtype.hxx> #include <IDocumentSettingAccess.hxx> @@ -1584,24 +1582,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 { @@ -2455,6 +2435,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: */ |