diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/dlgutil.hxx | 1 | ||||
-rw-r--r-- | svx/source/dialog/dlgutil.cxx | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/svx/inc/dlgutil.hxx b/svx/inc/dlgutil.hxx index 861203c2bd..3e4f736394 100644 --- a/svx/inc/dlgutil.hxx +++ b/svx/inc/dlgutil.hxx @@ -39,6 +39,7 @@ class SfxItemSet; SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& ); +SVX_DLLPUBLIC BOOL GetApplyCharUnit( const SfxItemSet& ); #define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT) #define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT) diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx index 5fa005d0dc..884b49e899 100644 --- a/svx/source/dialog/dlgutil.cxx +++ b/svx/source/dialog/dlgutil.cxx @@ -35,6 +35,9 @@ #include <sfx2/sfxsids.hrc> #include <sfx2/module.hxx> #include <svl/intitem.hxx> +#include <svl/eitem.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/objsh.hxx> // ----------------------------------------------------------------------- @@ -53,3 +56,33 @@ FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet ) return eUnit; } +BOOL GetApplyCharUnit( const SfxItemSet& rSet ) +{ + BOOL bUseCharUnit = FALSE; + const SfxPoolItem* pItem = NULL; + if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_APPLYCHARUNIT, FALSE, &pItem ) ) + bUseCharUnit = (BOOL)( (const SfxBoolItem*)pItem )->GetValue(); + else + { + // FIXME - this might be wrong, cf. the DEV300 changes in GetModuleFieldUnit() + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) // #93209# the object shell is not always available during reload + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + pItem = pModule->GetItem( SID_ATTR_APPLYCHARUNIT ); + if ( pItem ) + bUseCharUnit = (BOOL)( (SfxBoolItem*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "GetApplyCharUnit(): no module found" ); + } + } + } + return bUseCharUnit; +} |