desktop/source/lib/init.cxx                         |    6 +++-
 include/vcl/weld.hxx                                |    1 
 sfx2/source/control/unoctitm.cxx                    |   27 +++++++++++++++++---
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |   23 ++++++++++++++++-
 4 files changed, 52 insertions(+), 5 deletions(-)

New commits:
commit cb1a0ee587d48888f080e9e2036151471517d472
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Mar 27 19:36:11 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Apr 6 04:33:45 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

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4cf69495f10c..a8bf2cb94042 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2674,7 +2674,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/include/vcl/weld.hxx b/include/vcl/weld.hxx
index eda59f01783f..e8536e4a5660 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1802,6 +1802,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); }
     // set the width of the underlying widget in characters, this setting is
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" ||
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx 
b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 47bb5f8a4686..ccdfc1ee3f8c 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -761,8 +761,29 @@ void PosSizePropertyPanel::NotifyItemUpdate(
     mxCbxScale->set_active(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