diff options
-rw-r--r-- | sfx2/inc/sfx2/ctrlitem.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/ctrlitem.cxx | 39 |
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: */ |