1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10*f6e50924SAndrew Rist * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f6e50924SAndrew Rist * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19*f6e50924SAndrew Rist * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "fmcontrollayout.hxx" 28cdf0e10cSrcweir #include "fmprop.hrc" 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** === begin UNO includes === **/ 31cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp> 32cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp> 33cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 35cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 36cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> 37cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 38cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 39cdf0e10cSrcweir /** === end UNO includes === **/ 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 42cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 43cdf0e10cSrcweir #include <unotools/syslocale.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 46cdf0e10cSrcweir #include <tools/debug.hxx> 47cdf0e10cSrcweir #include <tools/diagnose_ex.h> 48cdf0e10cSrcweir #include <vcl/outdev.hxx> 49cdf0e10cSrcweir 50cdf0e10cSrcweir //........................................................................ 51cdf0e10cSrcweir namespace svxform 52cdf0e10cSrcweir { 53cdf0e10cSrcweir //........................................................................ 54cdf0e10cSrcweir 55cdf0e10cSrcweir using namespace ::utl; 56cdf0e10cSrcweir /** === begin UNO using === **/ 57cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 58cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 59cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 60cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 61cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 62cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 63cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 64cdf0e10cSrcweir using ::com::sun::star::uno::Any; 65cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 66cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 67cdf0e10cSrcweir using ::com::sun::star::uno::Type; 68cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet; 69cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySetInfo; 70cdf0e10cSrcweir using ::com::sun::star::lang::Locale; 71cdf0e10cSrcweir using ::com::sun::star::awt::FontDescriptor; 72cdf0e10cSrcweir using ::com::sun::star::style::XStyleFamiliesSupplier; 73cdf0e10cSrcweir using ::com::sun::star::lang::XServiceInfo; 74cdf0e10cSrcweir using ::com::sun::star::container::XNameAccess; 75cdf0e10cSrcweir using ::com::sun::star::container::XChild; 76cdf0e10cSrcweir /** === end UNO using === **/ 77cdf0e10cSrcweir namespace FormComponentType = ::com::sun::star::form::FormComponentType; 78cdf0e10cSrcweir namespace VisualEffect = ::com::sun::star::awt::VisualEffect; 79cdf0e10cSrcweir namespace ScriptType = ::com::sun::star::i18n::ScriptType; 80cdf0e10cSrcweir 81cdf0e10cSrcweir //-------------------------------------------------------------------- 82cdf0e10cSrcweir namespace 83cdf0e10cSrcweir { 84cdf0e10cSrcweir //.................................................................... 85cdf0e10cSrcweir template< class INTERFACE_TYPE > getTypedModelNode(const Reference<XInterface> & _rxModelNode)86cdf0e10cSrcweir Reference< INTERFACE_TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode ) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir Reference< INTERFACE_TYPE > xTypedNode( _rxModelNode, UNO_QUERY ); 89cdf0e10cSrcweir if ( xTypedNode.is() ) 90cdf0e10cSrcweir return xTypedNode; 91cdf0e10cSrcweir else 92cdf0e10cSrcweir { 93cdf0e10cSrcweir Reference< XChild > xChild( _rxModelNode, UNO_QUERY ); 94cdf0e10cSrcweir if ( xChild.is() ) 95cdf0e10cSrcweir return getTypedModelNode< INTERFACE_TYPE >( xChild->getParent() ); 96cdf0e10cSrcweir else 97cdf0e10cSrcweir return NULL; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir //.................................................................... lcl_getDocumentDefaultStyleAndFamily(const Reference<XInterface> & _rxDocument,::rtl::OUString & _rFamilyName,::rtl::OUString & _rStyleName)102cdf0e10cSrcweir static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception )) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir bool bSuccess = true; 105cdf0e10cSrcweir Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY ); 106cdf0e10cSrcweir if ( xDocumentSI.is() ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) 109cdf0e10cSrcweir || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) 110cdf0e10cSrcweir ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); 113cdf0e10cSrcweir _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ); 118cdf0e10cSrcweir _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) 121cdf0e10cSrcweir || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) 122cdf0e10cSrcweir ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); 125cdf0e10cSrcweir _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); 126cdf0e10cSrcweir } 127cdf0e10cSrcweir else 128cdf0e10cSrcweir bSuccess = false; 129cdf0e10cSrcweir } 130cdf0e10cSrcweir return bSuccess; 131cdf0e10cSrcweir } 132cdf0e10cSrcweir 133cdf0e10cSrcweir //.................................................................... lcl_initializeControlFont(const Reference<XPropertySet> & _rxModel)134cdf0e10cSrcweir static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir try 137cdf0e10cSrcweir { 138cdf0e10cSrcweir Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW ); 139cdf0e10cSrcweir Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir // determine the script type associated with the system locale 142cdf0e10cSrcweir const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData(); 143cdf0e10cSrcweir const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir // depending on this script type, use the right property from the document's style which controls the 146cdf0e10cSrcweir // default locale for document content 147cdf0e10cSrcweir const sal_Char* pCharLocalePropertyName = "CharLocale"; 148cdf0e10cSrcweir switch ( eSysLocaleScriptType ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir case ScriptType::LATIN: 151cdf0e10cSrcweir // already defaulted above 152cdf0e10cSrcweir break; 153cdf0e10cSrcweir case ScriptType::ASIAN: 154cdf0e10cSrcweir pCharLocalePropertyName = "CharLocaleAsian"; 155cdf0e10cSrcweir break; 156cdf0e10cSrcweir case ScriptType::COMPLEX: 157cdf0e10cSrcweir pCharLocalePropertyName = "CharLocaleComplex"; 158cdf0e10cSrcweir break; 159cdf0e10cSrcweir default: 160cdf0e10cSrcweir OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" ); 161cdf0e10cSrcweir break; 162cdf0e10cSrcweir } 163cdf0e10cSrcweir 164cdf0e10cSrcweir ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName ); 165cdf0e10cSrcweir Locale aDocumentCharLocale; 166cdf0e10cSrcweir if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir // fall back to CharLocale property at the style 171cdf0e10cSrcweir if ( !aDocumentCharLocale.Language.getLength() ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); 174cdf0e10cSrcweir if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir } 179cdf0e10cSrcweir // fall back to the system locale 180cdf0e10cSrcweir if ( !aDocumentCharLocale.Language.getLength() ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir aDocumentCharLocale = rSysLocaleData.getLocale(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir // retrieve a default font for this locale, and set it at the control 186cdf0e10cSrcweir Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE ); 187cdf0e10cSrcweir FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont ); 188cdf0e10cSrcweir _rxModel->setPropertyValue( 189cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), 190cdf0e10cSrcweir makeAny( aFontDesc ) 191cdf0e10cSrcweir ); 192cdf0e10cSrcweir } 193cdf0e10cSrcweir catch( const Exception& ) 194cdf0e10cSrcweir { 195cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 196cdf0e10cSrcweir } 197cdf0e10cSrcweir } 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir //==================================================================== 201cdf0e10cSrcweir //= ControlLayouter 202cdf0e10cSrcweir //==================================================================== 203cdf0e10cSrcweir //-------------------------------------------------------------------- getDefaultDocumentTextStyle(const Reference<XPropertySet> & _rxModel)204cdf0e10cSrcweir Reference< XPropertySet > ControlLayouter::getDefaultDocumentTextStyle( const Reference< XPropertySet >& _rxModel ) 205cdf0e10cSrcweir { 206cdf0e10cSrcweir // the style family collection 207cdf0e10cSrcweir Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW ); 208cdf0e10cSrcweir Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW ); 209cdf0e10cSrcweir 210cdf0e10cSrcweir // the names of the family, and the style - depends on the document type we live in 211cdf0e10cSrcweir ::rtl::OUString sFamilyName, sStyleName; 212cdf0e10cSrcweir if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) ) 213cdf0e10cSrcweir throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL ); 214cdf0e10cSrcweir 215cdf0e10cSrcweir // the concrete style 216cdf0e10cSrcweir Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); 217cdf0e10cSrcweir return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW ); 218cdf0e10cSrcweir } 219cdf0e10cSrcweir 220cdf0e10cSrcweir //-------------------------------------------------------------------- initializeControlLayout(const Reference<XPropertySet> & _rxControlModel,DocumentType _eDocType)221cdf0e10cSrcweir void ControlLayouter::initializeControlLayout( const Reference< XPropertySet >& _rxControlModel, DocumentType _eDocType ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir DBG_ASSERT( _rxControlModel.is(), "ControlLayouter::initializeControlLayout: invalid model!" ); 224cdf0e10cSrcweir if ( !_rxControlModel.is() ) 225cdf0e10cSrcweir return; 226cdf0e10cSrcweir 227cdf0e10cSrcweir try 228cdf0e10cSrcweir { 229cdf0e10cSrcweir Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW ); 230cdf0e10cSrcweir 231cdf0e10cSrcweir // the control type 232cdf0e10cSrcweir sal_Int16 nClassId = FormComponentType::CONTROL; 233cdf0e10cSrcweir _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId; 234cdf0e10cSrcweir 235cdf0e10cSrcweir // the document type 236cdf0e10cSrcweir if ( _eDocType == eUnknownDocumentType ) 237cdf0e10cSrcweir _eDocType = DocumentClassification::classifyHostDocument( _rxControlModel.get() ); 238cdf0e10cSrcweir 239cdf0e10cSrcweir // let's see what the configuration says about the visual effect 240cdf0e10cSrcweir OConfigurationNode aConfig = getLayoutSettings( _eDocType ); 241cdf0e10cSrcweir Any aVisualEffect = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) ) ); 242cdf0e10cSrcweir if ( aVisualEffect.hasValue() ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir ::rtl::OUString sVisualEffect; 245cdf0e10cSrcweir OSL_VERIFY( aVisualEffect >>= sVisualEffect ); 246cdf0e10cSrcweir 247cdf0e10cSrcweir sal_Int16 nVisualEffect = VisualEffect::NONE; 248cdf0e10cSrcweir if ( sVisualEffect.equalsAscii( "flat" ) ) 249cdf0e10cSrcweir nVisualEffect = VisualEffect::FLAT; 250cdf0e10cSrcweir else if ( sVisualEffect.equalsAscii( "3D" ) ) 251cdf0e10cSrcweir nVisualEffect = VisualEffect::LOOK3D; 252cdf0e10cSrcweir 253cdf0e10cSrcweir if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir if ( ( nClassId != FormComponentType::COMMANDBUTTON ) 256cdf0e10cSrcweir && ( nClassId != FormComponentType::RADIOBUTTON ) 257cdf0e10cSrcweir && ( nClassId != FormComponentType::CHECKBOX ) 258cdf0e10cSrcweir && ( nClassId != FormComponentType::GROUPBOX ) 259cdf0e10cSrcweir && ( nClassId != FormComponentType::FIXEDTEXT ) 260cdf0e10cSrcweir && ( nClassId != FormComponentType::SCROLLBAR ) 261cdf0e10cSrcweir && ( nClassId != FormComponentType::SPINBUTTON ) 262cdf0e10cSrcweir ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir _rxControlModel->setPropertyValue( FM_PROP_BORDER, makeAny( nVisualEffect ) ); 265cdf0e10cSrcweir if ( ( nVisualEffect == VisualEffect::FLAT ) 266cdf0e10cSrcweir && ( xPSI->hasPropertyByName( FM_PROP_BORDERCOLOR ) ) 267cdf0e10cSrcweir ) 268cdf0e10cSrcweir // light gray flat border 269cdf0e10cSrcweir _rxControlModel->setPropertyValue( FM_PROP_BORDERCOLOR, makeAny( (sal_Int32)0x00C0C0C0 ) ); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir } 272cdf0e10cSrcweir if ( xPSI->hasPropertyByName( FM_PROP_VISUALEFFECT ) ) 273cdf0e10cSrcweir _rxControlModel->setPropertyValue( FM_PROP_VISUALEFFECT, makeAny( nVisualEffect ) ); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir // the font (only if we use the document's ref devices for rendering control text, otherwise, the 277cdf0e10cSrcweir // default font of VCL controls is assumed to be fine) 278cdf0e10cSrcweir if ( useDocumentReferenceDevice( _eDocType ) 279cdf0e10cSrcweir && xPSI->hasPropertyByName( FM_PROP_FONT ) 280cdf0e10cSrcweir ) 281cdf0e10cSrcweir lcl_initializeControlFont( _rxControlModel ); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir catch( const Exception& ) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir OSL_ENSURE( sal_False, "ControlLayouter::initializeControlLayout: caught an exception!" ); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir //-------------------------------------------------------------------- getLayoutSettings(DocumentType _eDocType)290cdf0e10cSrcweir ::utl::OConfigurationNode ControlLayouter::getLayoutSettings( DocumentType _eDocType ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir ::rtl::OUString sConfigName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Forms/ControlLayout/" ) ); 293cdf0e10cSrcweir sConfigName += DocumentClassification::getModuleIdentifierForDocumentType( _eDocType ); 294cdf0e10cSrcweir return OConfigurationTreeRoot::createWithServiceFactory( 295cdf0e10cSrcweir ::comphelper::getProcessServiceFactory(), // TODO 296cdf0e10cSrcweir sConfigName ); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir //-------------------------------------------------------------------- useDynamicBorderColor(DocumentType _eDocType)300cdf0e10cSrcweir bool ControlLayouter::useDynamicBorderColor( DocumentType _eDocType ) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir OConfigurationNode aConfig = getLayoutSettings( _eDocType ); 303cdf0e10cSrcweir Any aDynamicBorderColor = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DynamicBorderColors" ) ) ); 304cdf0e10cSrcweir bool bDynamicBorderColor = false; 305cdf0e10cSrcweir OSL_VERIFY( aDynamicBorderColor >>= bDynamicBorderColor ); 306cdf0e10cSrcweir return bDynamicBorderColor; 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir //-------------------------------------------------------------------- useDocumentReferenceDevice(DocumentType _eDocType)310cdf0e10cSrcweir bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType ) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir if ( _eDocType == eUnknownDocumentType ) 313cdf0e10cSrcweir return false; 314cdf0e10cSrcweir OConfigurationNode aConfig = getLayoutSettings( _eDocType ); 315cdf0e10cSrcweir Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) ); 316cdf0e10cSrcweir bool bUseRefDevice = false; 317cdf0e10cSrcweir OSL_VERIFY( aUseRefDevice >>= bUseRefDevice ); 318cdf0e10cSrcweir return bUseRefDevice; 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir //........................................................................ 322cdf0e10cSrcweir } // namespace svxform 323cdf0e10cSrcweir //........................................................................ 324cdf0e10cSrcweir 325