diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/fmmodel.hxx | 10 | ||||
-rw-r--r-- | svx/source/form/fmcontrollayout.cxx | 10 | ||||
-rw-r--r-- | svx/source/form/fmmodel.cxx | 40 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 4 | ||||
-rw-r--r-- | svx/source/inc/fmcontrollayout.hxx | 5 |
5 files changed, 51 insertions, 18 deletions
diff --git a/svx/inc/svx/fmmodel.hxx b/svx/inc/svx/fmmodel.hxx index 2f61967bc3ac..f831729b5006 100644 --- a/svx/inc/svx/fmmodel.hxx +++ b/svx/inc/svx/fmmodel.hxx @@ -89,14 +89,16 @@ public: /** check whether the OpenInDesignMode has been set explicitly or been loaded (<FALSE/>) or if it still has the default value from construction (<TRUE/>) */ - sal_Bool OpenInDesignModeIsDefaulted( ); + sal_Bool OpenInDesignModeIsDefaulted(); -//#if 0 // _SOLAR__PRIVATE - void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); + /** determines whether form controls should use the SdrModel's reference device for text rendering + */ + sal_Bool ControlsUseRefDevice() const; FmXUndoEnvironment& GetUndoEnv(); -//#endif +private: + void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); }; #endif // _FM_FMMODEL_HXX diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 92e987db796c..8cf6ccd2a84d 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -141,6 +141,16 @@ namespace svxform return bDynamicBorderColor; } + //-------------------------------------------------------------------- + bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType ) + { + OConfigurationNode aConfig = getLayoutSettings( _eDocType ); + Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) ); + bool bUseRefDevice = false; + OSL_VERIFY( aUseRefDevice >>= bUseRefDevice ); + return bUseRefDevice; + } + //........................................................................ } // namespace svxform //........................................................................ diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 09008ae220b9..15932d4d93cc 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -30,30 +30,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + +#include "fmundo.hxx" +#include "fmdocumentclassification.hxx" +#include "fmcontrollayout.hxx" + +#include <svx/fmmodel.hxx> +#include <svx/fmpage.hxx> +#include <svx/svdobj.hxx> #include <tools/debug.hxx> #ifndef SVX_LIGHT -#ifndef _SFX_OBJSH_HXX //autogen #include <sfx2/objsh.hxx> -#endif #else class SfxObjectShell; #endif -#ifndef _FM_FMMODEL_HXX -#include <svx/fmmodel.hxx> -#endif - -#ifndef _FM_PAGE_HXX -#include <svx/fmpage.hxx> -#endif -#include "fmundo.hxx" -#ifndef _SVX_SVDOBJ_HXX -#include <svx/svdobj.hxx> -#endif +#include <boost/optional.hpp> using ::com::sun::star::uno::Reference; using ::com::sun::star::container::XNameContainer; +using namespace svxform; TYPEINIT1(FmFormModel, SdrModel); @@ -62,11 +59,14 @@ struct FmFormModelImplData FmXUndoEnvironment* pUndoEnv; sal_Bool bOpenInDesignIsDefaulted; sal_Bool bMovingPage; + ::boost::optional< sal_Bool > + aControlsUseRefDevice; FmFormModelImplData() :pUndoEnv( NULL ) ,bOpenInDesignIsDefaulted( sal_True ) ,bMovingPage( sal_False ) + ,aControlsUseRefDevice() { } }; @@ -314,6 +314,20 @@ sal_Bool FmFormModel::OpenInDesignModeIsDefaulted( ) #endif //------------------------------------------------------------------------ +sal_Bool FmFormModel::ControlsUseRefDevice() const +{ + if ( !m_pImpl->aControlsUseRefDevice ) + { + OSL_PRECOND( m_pObjShell, "FmFormModel::ControlsUseRefDevice: no object shell -> no document -> no document type -> no way!" ); + DocumentType eDocType = eUnknownDocumentType; + if ( m_pObjShell ) + eDocType = DocumentClassification::classifyHostDocument( m_pObjShell->GetModel() ); + m_pImpl->aControlsUseRefDevice.reset( ControlLayouter::useDocumentReferenceDevice( eDocType ) ); + } + return *m_pImpl->aControlsUseRefDevice; +} + +//------------------------------------------------------------------------ void FmFormModel::SetAutoControlFocus( sal_Bool _bAutoControlFocus ) { #ifndef SVX_LIGHT diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 95b0e151e078..b5a055730f71 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -131,8 +131,10 @@ void FmFormObj::ClearObjEnv() void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) { const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); - OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; + if ( !pFormModel || !pFormModel->ControlsUseRefDevice() ) + return; + OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force ) return; diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx index 1110c274b9f8..c370e8547f0e 100644 --- a/svx/source/inc/fmcontrollayout.hxx +++ b/svx/source/inc/fmcontrollayout.hxx @@ -62,6 +62,11 @@ namespace svxform */ static bool useDynamicBorderColor( DocumentType _eDocType ); + /** determines whether for the given document type, form controls should use the document's reference device + for text rendering + */ + static bool useDocumentReferenceDevice( DocumentType _eDocType ); + private: ControlLayouter(); // never implemented |