diff options
author | Henry Castro <hcastro@collabora.com> | 2020-03-27 19:36:11 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-04-06 04:33:45 +0200 |
commit | cb1a0ee587d48888f080e9e2036151471517d472 (patch) | |
tree | dfa9291ce2baf7d4d1189ac1fe26526a35eb7f8c /sfx2 | |
parent | 219cb84f901676a738892e87ba6f726805d5e72c (diff) |
LOk: notify the state values of the position and size property panel
Notify to client side when the UNO commands (TransformPosX, TransformPosY,
TransformWidth,TransformHeight) have changed only valid for mobile devices.
The state values are obtained from "position and a size" property panel of
the sidebar and they have a converted units formatted text and simplify
client side not to convert the units again.
Change-Id: I0d37a9746d550e09bf2a5b182530ef7c2a0dee37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91238
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91578
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index fc6463073bbd..d6e6c8673e38 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -108,7 +108,7 @@ const char* const URLTypeNames[URLType_COUNT] = "double" }; -static void InterceptLOKStateChangeEvent( const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState ); +static void InterceptLOKStateChangeEvent( sal_uInt16 nSID, SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState ); void SfxStatusDispatcher::ReleaseAll() { @@ -956,7 +956,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt if (pDispatcher && pDispatcher->GetFrame()) { - InterceptLOKStateChangeEvent(pDispatcher->GetFrame(), aEvent, pState); + InterceptLOKStateChangeEvent(nSID, pDispatcher->GetFrame(), aEvent, pState); } const css::uno::Sequence<OUString> aContainedTypes = pDispatch->GetListeners().getContainedTypes(); @@ -972,7 +972,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt StateChanged( nSID, eState, pState, nullptr ); } -static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState) +static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState) { if (!comphelper::LibreOfficeKit::isActive()) return; @@ -1110,6 +1110,27 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c aBuffer.append(OUString::number(aInt32)); } } + else if (aEvent.FeatureURL.Path == "TransformPosX" || + aEvent.FeatureURL.Path == "TransformPosY" || + aEvent.FeatureURL.Path == "TransformWidth" || + aEvent.FeatureURL.Path == "TransformHeight") + { + if (aEvent.IsEnabled && comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) + { + boost::property_tree::ptree aTree; + boost::property_tree::ptree aState; + OUString aStr(aEvent.FeatureURL.Complete); + + aTree.put("commandName", aStr.toUtf8().getStr()); + pViewFrame->GetBindings().QueryControlState(nSID, aState); + aTree.add_child("state", aState); + + aBuffer.setLength(0); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + aBuffer.appendAscii(aStream.str().c_str()); + } + } else if (aEvent.FeatureURL.Path == "StatusDocPos" || aEvent.FeatureURL.Path == "RowColSelCount" || aEvent.FeatureURL.Path == "StatusPageStyle" || |