desktop/source/lib/init.cxx | 6 +++- sfx2/source/control/unoctitm.cxx | 27 +++++++++++++++++--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 23 ++++++++++++++++- 3 files changed, 51 insertions(+), 5 deletions(-)
New commits: commit 52ef588267d191304138a88b962314b5dec84356 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Mar 27 19:36:11 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Mar 31 17:14:08 2020 +0200 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 <jenkinscollaboraoff...@gmail.com> Reviewed-by: Henry Castro <hcas...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4a4a10efaa65..8045eed42b75 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2672,7 +2672,11 @@ static void doc_iniUnoCommands () OUString(".uno:Orientation"), OUString(".uno:ObjectAlignLeft"), OUString(".uno:ObjectAlignRight"), - OUString(".uno:AlignCenter") + OUString(".uno:AlignCenter"), + OUString(".uno:TransformPosX"), + OUString(".uno:TransformPosY"), + OUString(".uno:TransformWidth"), + OUString(".uno:TransformHeight") }; util::URL aCommandURL; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 7bc2cad90b63..b27bb75451c8 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -107,7 +107,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() { @@ -955,7 +955,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); } for (const OUString& rName: pDispatch->GetListeners().getContainedTypes()) @@ -971,7 +971,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; @@ -1108,6 +1108,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" || diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index e684d4da2bc2..120b753a29d6 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -844,8 +844,29 @@ void PosSizePropertyPanel::NotifyItemUpdate( mpCbxScale->Check( static_cast<bool>(sUserData.toInt32()) ); } -void PosSizePropertyPanel::GetControlState(const sal_uInt16 /*nSID*/, boost::property_tree::ptree& /*rState*/) +void PosSizePropertyPanel::GetControlState(const sal_uInt16 nSID, boost::property_tree::ptree& rState) { + VclPtr<vcl::Window> pControl; + switch (nSID) + { + case SID_ATTR_TRANSFORM_POS_X: + pControl = mpMtrPosX; + break; + case SID_ATTR_TRANSFORM_POS_Y: + pControl = mpMtrPosY; + break; + case SID_ATTR_TRANSFORM_WIDTH: + pControl = mpMtrWidth; + break; + case SID_ATTR_TRANSFORM_HEIGHT: + pControl = mpMtrHeight; + break; + } + + if (pControl && !pControl->GetText().isEmpty()) + { + rState.put(pControl->get_id().toUtf8().getStr(),pControl->GetText().toUtf8().getStr()); + } } void PosSizePropertyPanel::executeSize() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits