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