diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:26 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:26 +0100 |
commit | 3b7ab82aee60aec1e47c1e253d3977a3fc011f5b (patch) | |
tree | 1ebee7adb28ba3175deee3948aee8f5489d9b509 /sfx2/source/appl | |
parent | 486dd9082e177aa63294f76d6a75b08dde5957e5 (diff) | |
parent | 61879c218dd0e6e94884e7c6e06e3c5c18540b4a (diff) |
Merge commit 'ooo/DEV300_m103'
Conflicts:
basic/source/runtime/makefile.mk
basic/source/runtime/step2.cxx
desktop/prj/build.lst
desktop/source/app/app.cxx
desktop/source/deployment/registry/dp_backend.cxx
drawinglayer/source/attribute/fontattribute.cxx
editeng/inc/editeng/fontitem.hxx
editeng/source/editeng/edtspell.cxx
editeng/source/misc/svxacorr.cxx
framework/inc/services/substitutepathvars.hxx
framework/source/services/substitutepathvars.cxx
sfx2/qa/cppunit/makefile.mk
sfx2/source/doc/SfxDocumentMetaData.cxx
sfx2/source/doc/objxtor.cxx
svx/source/dialog/svxruler.cxx
sysui/desktop/icons/so9_base_app.ico
sysui/desktop/icons/so9_calc_app.ico
sysui/desktop/icons/so9_draw_app.ico
sysui/desktop/icons/so9_impress_app.ico
sysui/desktop/icons/so9_main_app.ico
sysui/desktop/icons/so9_math_app.ico
sysui/desktop/icons/so9_writer_app.ico
xmlhelp/source/cxxhelp/provider/databases.cxx
xmlhelp/source/cxxhelp/provider/db.cxx
xmlhelp/source/cxxhelp/provider/db.hxx
Diffstat (limited to 'sfx2/source/appl')
-rwxr-xr-x | sfx2/source/appl/module.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 1a92d59ea464..62e7f0547808 100755 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -49,6 +49,7 @@ #include <svl/intitem.hxx> #include "sfx2/taskpane.hxx" #include <tools/diagnose_ex.h> +#include <rtl/strbuf.hxx> #define SfxModule #include "sfxslots.hxx" @@ -399,6 +400,39 @@ SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) return pSh ? pSh->GetModule() : 0; } +FieldUnit SfxModule::GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame ) +{ + ENSURE_OR_RETURN( i_frame.is(), "SfxModule::GetModuleFieldUnit: invalid frame!", FUNIT_100TH_MM ); + + // find SfxViewFrame for the given XFrame + SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(); + while ( pViewFrame != NULL ) + { + if ( pViewFrame->GetFrame().GetFrameInterface() == i_frame ) + break; + pViewFrame = SfxViewFrame::GetNext( *pViewFrame ); + } + ENSURE_OR_RETURN( pViewFrame != NULL, "SfxModule::GetModuleFieldUnit: unable to find an SfxViewFrame for the given XFrame", FUNIT_100TH_MM ); + + // find the module + SfxModule const * pModule = GetActiveModule( pViewFrame ); + ENSURE_OR_RETURN( pModule != NULL, "SfxModule::GetModuleFieldUnit: no SfxModule for the given frame!", FUNIT_100TH_MM ); + + SfxPoolItem const * pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem == NULL ) + { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer message; + message.append( "SfxModule::GetFieldUnit: no metric item in the module implemented by '" ); + message.append( typeid( *pModule ).name() ); + message.append( "'!" ); + OSL_ENSURE( false, message.makeStringAndClear().getStr() ); +#endif + return FUNIT_100TH_MM; + } + return (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); +} + FieldUnit SfxModule::GetCurrentFieldUnit() { FieldUnit eUnit = FUNIT_INCH; |