diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-10 18:44:22 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-10 18:44:22 +0100 |
commit | 6fc01200941161b365c953a182ccc8b9e5365104 (patch) | |
tree | f97f37818168c23d0b9cf6bde53170d03a5b2599 /sfx2 | |
parent | bff3805b014f19e62edf7c6aa7716048c07cf689 (diff) |
#i107450#: split up the two different ways to detect a module field unit
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/dispatch.hxx | 4 | ||||
-rw-r--r-- | sfx2/inc/sfx2/module.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/module.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 11 |
4 files changed, 28 insertions, 2 deletions
diff --git a/sfx2/inc/sfx2/dispatch.hxx b/sfx2/inc/sfx2/dispatch.hxx index 363c9280fd5a..e0d25fb121d7 100644 --- a/sfx2/inc/sfx2/dispatch.hxx +++ b/sfx2/inc/sfx2/dispatch.hxx @@ -51,7 +51,7 @@ class SfxViewFrame; class SfxBindings; class SfxItemSet; class SfxPopupMenuManager; - +class SfxModule; struct SfxDispatcher_Impl; struct SfxPlugInInfo_Impl; @@ -202,7 +202,7 @@ public: SfxShell* GetShell(USHORT nIdx) const; SfxViewFrame* GetFrame() const; - + SfxModule* GetModule() const; // caller has to clean up the Manager on his own static SfxPopupMenuManager* Popup( sal_uInt16 nConfigId,Window *pWin, const Point *pPos ); diff --git a/sfx2/inc/sfx2/module.hxx b/sfx2/inc/sfx2/module.hxx index f59832085dc6..f8e3f9c7163a 100644 --- a/sfx2/inc/sfx2/module.hxx +++ b/sfx2/inc/sfx2/module.hxx @@ -36,6 +36,8 @@ #include <sfx2/shell.hxx> #include <sfx2/imgdef.hxx> #include <sal/types.h> +#include <vcl/fldunit.hxx> + class ImageList; class SfxAcceleratorManager; @@ -96,6 +98,7 @@ public: BOOL IsActive() const; static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL ); + FieldUnit GetModuleFieldUnit() const; //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl(); diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 566d1af69242..e74d1805a3ef 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -51,6 +51,7 @@ #include <sfx2/docfac.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> +#include <svl/intitem.hxx> #define SfxModule #include "sfxslots.hxx" @@ -411,3 +412,14 @@ SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) pSh = pFrame->GetObjectShell(); return pSh ? pSh->GetModule() : 0; } + +FieldUnit SfxModule::GetModuleFieldUnit() const +{ + FieldUnit eUnit = FUNIT_INCH; + const SfxPoolItem* _pItem = GetItem( SID_ATTR_METRIC ); + if ( _pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)_pItem )->GetValue(); + else + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + return eUnit; +} diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index fa3330059859..907bd49c1df2 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -3215,3 +3215,14 @@ sal_uInt32 SfxDispatcher::GetDisableFlags() const return pImp->nDisableFlags; } +SfxModule* SfxDispatcher::GetModule() const +{ + for ( sal_uInt16 nShell = 0;; ++nShell ) + { + SfxShell *pSh = GetShell(nShell); + if ( pSh == NULL ) + return 0; + if ( pSh->ISA(SfxModule) ) + return (SfxModule*) pSh; + } +}
\ No newline at end of file |