include/vcl/weld.hxx                                |    1 
 sfx2/source/control/unoctitm.cxx                    |   27 +++++++++++++++++---
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |   23 ++++++++++++++++-
 3 files changed, 47 insertions(+), 4 deletions(-)

New commits:
commit 43b8212464096f163316fb211e64789492542ede
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Mar 27 19:36:11 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Thu May 21 00:41:20 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91578
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94517
    Tested-by: Henry Castro <hcas...@collabora.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 5e63e7bd9804..f4a3de8fc1a4 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1679,6 +1679,7 @@ public:
     {
         m_xSpinButton->connect_focus_out(rLink);
     }
+    OString get_buildable_name() { return m_xSpinButton->get_buildable_name(); 
}
     void set_help_id(const OString& rName) { 
m_xSpinButton->set_help_id(rName); }
     void set_position(int nCursorPos) { 
m_xSpinButton->set_position(nCursorPos); }
     weld::SpinButton& get_widget() { return *m_xSpinButton; }
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 9fa1026f06d9..d2fbe28b6222 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -109,7 +109,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()
 {
@@ -957,7 +957,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();
@@ -973,7 +973,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;
@@ -1139,6 +1139,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 9c00e4602864..8965f38b56cf 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -817,8 +817,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)
 {
+    weld::MetricSpinButton* pControl = nullptr;
+    switch (nSID)
+    {
+        case SID_ATTR_TRANSFORM_POS_X:
+            pControl = mxMtrPosX.get();
+            break;
+        case SID_ATTR_TRANSFORM_POS_Y:
+            pControl = mxMtrPosY.get();
+            break;
+        case SID_ATTR_TRANSFORM_WIDTH:
+            pControl = mxMtrWidth.get();
+            break;
+        case SID_ATTR_TRANSFORM_HEIGHT:
+            pControl = mxMtrHeight.get();
+            break;
+    }
+
+    if (pControl && !pControl->get_text().isEmpty())
+    {
+        rState.put(pControl->get_buildable_name().getStr(), 
pControl->get_text().toUtf8().getStr());
+    }
 }
 
 void PosSizePropertyPanel::executeSize()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to