summaryrefslogtreecommitdiff
path: root/sfx2/source/control/ctrlitem.cxx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2001-07-17 09:45:37 +0000
committerMathias Bauer <mba@openoffice.org>2001-07-17 09:45:37 +0000
commit817dfb74d9ec9f46ba32be6d5066d534f81072a5 (patch)
treee60656d07e616cfe8f45eae30ea42d035bfdd3df /sfx2/source/control/ctrlitem.cxx
parentaa5e972489163a1611c46d6b5cff32e92c3abfd9 (diff)
#89783#: NULL-Ptr possible
Diffstat (limited to 'sfx2/source/control/ctrlitem.cxx')
-rw-r--r--sfx2/source/control/ctrlitem.cxx34
1 files changed, 27 insertions, 7 deletions
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index 2d832fd0ef80..88aa12dac30d 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ctrlitem.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:52:29 $
+ * last change: $Author: mba $ $Date: 2001-07-17 10:45:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,7 @@
#include "dispatch.hxx"
#include "msgpool.hxx"
#include "statcach.hxx"
+#include "viewfrm.hxx"
//====================================================================
@@ -464,11 +465,30 @@ SfxMapUnit SfxControllerItem::GetCoreMetric() const
{
SfxStateCache *pCache = pBindings->GetStateCache( nId );
SfxDispatcher *pDispat = pBindings->GetDispatcher_Impl();
- const SfxSlotServer *pServer = pCache->GetSlotServer( *pDispat );
- SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() );
- SfxItemPool &rPool = pSh->GetPool();
- USHORT nWhich = rPool.GetWhich( nId );
- return rPool.GetMetric( nWhich );
+
+ if ( !pDispat )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( !pViewFrame )
+ SfxViewFrame::GetFirst();
+ if ( pViewFrame )
+ pDispat = pViewFrame->GetDispatcher();
+ }
+
+ if ( pDispat )
+ {
+ const SfxSlotServer *pServer = pCache->GetSlotServer( *pDispat );
+ if ( pServer )
+ {
+ SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() );
+ SfxItemPool &rPool = pSh->GetPool();
+ USHORT nWhich = rPool.GetWhich( nId );
+ return rPool.GetMetric( nWhich );
+ }
+ }
+
+ DBG_WARNING( "W1: Can not find ItemPool!" );
+ return SFX_MAPUNIT_100TH_MM;
}
//------------------------------------------------------------------------