summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-04-22 14:06:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-04-22 14:26:48 +0100
commit2174bb1af65d61904d3f45f2121416e7fb33b612 (patch)
treeb8611e9e2d73464e32d7fa9f179cba438db43587 /sfx2
parent81f336879b79d20ea82e7677c8332659c1fb454f (diff)
Restore SfxControllerItem::GetCoreMetric
was correctly removed by 9c2f7056a82c4d7719715ca1c77f8dd4c17aa24c but we will need it again soon Change-Id: I7b2af6a17fc1c34d9313428e759e93fdde9ba0d7
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/ctrlitem.hxx2
-rw-r--r--sfx2/source/control/ctrlitem.cxx39
2 files changed, 41 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/ctrlitem.hxx b/sfx2/inc/sfx2/ctrlitem.hxx
index bb7b61b9d4c8..af6288e772e9 100644
--- a/sfx2/inc/sfx2/ctrlitem.hxx
+++ b/sfx2/inc/sfx2/ctrlitem.hxx
@@ -71,6 +71,8 @@ public:
const SfxPoolItem* pState );
virtual void DeleteFloatingWindow();
+ SfxMapUnit GetCoreMetric() const;
+
static SfxItemState GetItemState( const SfxPoolItem* pState );
SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index 317c16ae51ce..2b241c6b9045 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -353,4 +353,43 @@ SfxItemState SfxControllerItem::GetItemState
: SFX_ITEM_AVAILABLE;
}
+//--------------------------------------------------------------------
+
+SfxMapUnit SfxControllerItem::GetCoreMetric() const
+
+/* [Description]
+
+ Gets the measurement unit from the competent pool, in which the Status
+ item exist.
+*/
+
+{
+ SfxStateCache *pCache = pBindings->GetStateCache( nId );
+ SfxDispatcher *pDispat = pBindings->GetDispatcher_Impl();
+
+ if ( !pDispat )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( !pViewFrame )
+ SfxViewFrame::GetFirst();
+ if ( pViewFrame )
+ pDispat = pViewFrame->GetDispatcher();
+ }
+
+ if ( pDispat && pCache )
+ {
+ const SfxSlotServer *pServer = pCache->GetSlotServer( *pDispat );
+ if ( pServer )
+ {
+ SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() );
+ SfxItemPool &rPool = pSh->GetPool();
+ sal_uInt16 nWhich = rPool.GetWhich( nId );
+ return rPool.GetMetric( nWhich );
+ }
+ }
+
+ DBG_WARNING( "W1: Can not find ItemPool!" );
+ return SFX_MAPUNIT_100TH_MM;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */