summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-03-27 19:24:14 -0400
committerHenry Castro <hcastro@collabora.com>2020-03-31 15:26:42 +0200
commita5207e5b3230a57666cf27f4f4e54c5e5dd81605 (patch)
tree146a954819670f42ad977489601b0630af27a5a2 /sfx2
parent9e5eab8f736becc49f43b08a93d8c8690fc9b040 (diff)
lok: introduce QueryControlState function
The sidebar usually executes UNO commands to the core framework, however the controls already have formatted the text that is useful in Online client side. For example the units conversion. The QueryControlState method will retrieve the current formatted text of the sidebar control to be used in Client Side. Change-Id: I0b3e3a1462d4391ac911352f35808a5e5d9f9ffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91237 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/bindings.cxx27
-rw-r--r--sfx2/source/control/ctrlitem.cxx7
-rw-r--r--sfx2/source/control/statcach.cxx13
-rw-r--r--sfx2/source/inc/statcach.hxx1
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx7
5 files changed, 55 insertions, 0 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index c5f564444b74..5d8dfe4f9860 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1622,6 +1622,33 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, std::unique_ptr<SfxPoolI
return eState;
}
+void SfxBindings::QueryControlState( sal_uInt16 nSlot, boost::property_tree::ptree& rState )
+{
+ if ( SfxGetpApp()->IsDowning() )
+ return;
+
+ if ( pDispatcher )
+ pDispatcher->Flush();
+
+ if ( pImpl->pSubBindings )
+ pImpl->pSubBindings->QueryControlState( nSlot, rState );
+
+ SfxStateCache* pCache = GetStateCache( nSlot );
+ if ( pCache )
+ {
+ if ( pImpl->bMsgDirty )
+ {
+ UpdateSlotServer_Impl();
+ pCache = GetStateCache( nSlot );
+ }
+
+ if (pCache && pCache->GetItemLink() )
+ {
+ pCache->GetState(rState);
+ }
+ }
+}
+
void SfxBindings::SetSubBindings_Impl( SfxBindings *pSub )
{
if ( pImpl->pSubBindings )
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index 832725089e26..b9a5d9477fb9 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -234,6 +234,13 @@ void SfxControllerItem::StateChanged
{
}
+void SfxControllerItem::GetControlState
+(
+ sal_uInt16,
+ boost::property_tree::ptree&
+)
+{
+}
void SfxStatusForwarder::StateChanged
(
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index a190168ea1ce..ab4987ce44f9 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -326,6 +326,19 @@ void SfxStateCache::SetState
SetState_Impl( eState, pState, bMaybeDirty );
}
+void SfxStateCache::GetState
+(
+ boost::property_tree::ptree& rState
+)
+{
+ if ( !mxDispatch.is() && pController )
+ {
+ for ( SfxControllerItem *pCtrl = pController;
+ pCtrl;
+ pCtrl = pCtrl->GetItemLink() )
+ pCtrl->GetControlState( nId, rState );
+ }
+}
void SfxStateCache::SetVisibleState( bool bShow )
{
diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx
index dfe107940902..cc5946c5c3c2 100644
--- a/sfx2/source/inc/statcach.hxx
+++ b/sfx2/source/inc/statcach.hxx
@@ -95,6 +95,7 @@ public:
void SetCachedState(bool bAlways);
void Invalidate( bool bWithSlot );
void SetVisibleState( bool bShow );
+ void GetState( boost::property_tree::ptree& );
SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewBinding );
SfxControllerItem* GetItemLink() const;
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index b7925ac2d13c..9281169d6186 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -67,6 +67,13 @@ void ControllerItem::StateChanged (
mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState, IsEnabled(eState));
}
+void ControllerItem::GetControlState (
+ sal_uInt16 nSID,
+ boost::property_tree::ptree& rState)
+{
+ mrItemUpdateReceiver.GetControlState(nSID, rState);
+}
+
bool ControllerItem::IsEnabled (SfxItemState eState)
{
if (eState == SfxItemState::DISABLED)