diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-14 11:05:40 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-14 21:36:31 +0100 |
commit | 1ed697ae5488f2174fe206a13fdbc3a1b05aadf3 (patch) | |
tree | c322517cac7ef57ca0c03a2a2f3a49561540e7b4 /sd | |
parent | 77cc0e929ee331af6b97b65e9b6ec5400ef05cd4 (diff) |
jsdialog: send paragraph margins for impress
Change-Id: Ie0d4d3dc33de66609c005b77c1ef9802446ad57c
Reviewed-on: https://gerrit.libreoffice.org/82658
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 29733bb39a16fc0e1398a7c18781226cfe755ff3)
Reviewed-on: https://gerrit.libreoffice.org/82670
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 089964333274..2c7df774cbf6 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -44,6 +44,9 @@ #include <editeng/writingmodeitem.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/fhgtitem.hxx> +#include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <editeng/itemtype.hxx> #include <sfx2/objface.hxx> @@ -479,14 +482,38 @@ 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 { @@ -589,6 +616,29 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); 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 ) |