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_unotools.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 32*cdf0e10cSrcweir // includes 33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <unotools/compatibility.hxx> 36*cdf0e10cSrcweir #include <unotools/configmgr.hxx> 37*cdf0e10cSrcweir #include <unotools/configitem.hxx> 38*cdf0e10cSrcweir #include <tools/debug.hxx> 39*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 40*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #ifndef __SGI_STL_VECTOR 43*cdf0e10cSrcweir #include <vector> 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #include <itemholder1.hxx> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include <algorithm> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 51*cdf0e10cSrcweir // namespaces 52*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir using namespace ::std; 55*cdf0e10cSrcweir using namespace ::utl; 56*cdf0e10cSrcweir using namespace ::rtl; 57*cdf0e10cSrcweir using namespace ::osl; 58*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 59*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 62*cdf0e10cSrcweir // const 63*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #define ROOTNODE_OPTIONS OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Compatibility/" ) ) 66*cdf0e10cSrcweir #define PATHDELIMITER OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) 67*cdf0e10cSrcweir #define SETNODE_ALLFILEFORMATS OUString( RTL_CONSTASCII_USTRINGPARAM( "AllFileFormats" ) ) 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #define PROPERTYNAME_NAME COMPATIBILITY_PROPERTYNAME_NAME 70*cdf0e10cSrcweir #define PROPERTYNAME_MODULE COMPATIBILITY_PROPERTYNAME_MODULE 71*cdf0e10cSrcweir #define PROPERTYNAME_USEPRTMETRICS COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS 72*cdf0e10cSrcweir #define PROPERTYNAME_ADDSPACING COMPATIBILITY_PROPERTYNAME_ADDSPACING 73*cdf0e10cSrcweir #define PROPERTYNAME_ADDSPACINGATPAGES COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES 74*cdf0e10cSrcweir #define PROPERTYNAME_USEOURTABSTOPS COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS 75*cdf0e10cSrcweir #define PROPERTYNAME_NOEXTLEADING COMPATIBILITY_PROPERTYNAME_NOEXTLEADING 76*cdf0e10cSrcweir #define PROPERTYNAME_USELINESPACING COMPATIBILITY_PROPERTYNAME_USELINESPACING 77*cdf0e10cSrcweir #define PROPERTYNAME_ADDTABLESPACING COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING 78*cdf0e10cSrcweir #define PROPERTYNAME_USEOBJPOS COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING 79*cdf0e10cSrcweir #define PROPERTYNAME_USEOURTEXTWRAP COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING 80*cdf0e10cSrcweir #define PROPERTYNAME_CONSIDERWRAPSTYLE COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE 81*cdf0e10cSrcweir #define PROPERTYNAME_EXPANDWORDSPACE COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir #define PROPERTYCOUNT 13 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #define OFFSET_NAME 0 86*cdf0e10cSrcweir #define OFFSET_MODULE 1 87*cdf0e10cSrcweir #define OFFSET_USEPRTMETRICS 2 88*cdf0e10cSrcweir #define OFFSET_ADDSPACING 3 89*cdf0e10cSrcweir #define OFFSET_ADDSPACINGATPAGES 4 90*cdf0e10cSrcweir #define OFFSET_USEOURTABSTOPS 5 91*cdf0e10cSrcweir #define OFFSET_NOEXTLEADING 6 92*cdf0e10cSrcweir #define OFFSET_USELINESPACING 7 93*cdf0e10cSrcweir #define OFFSET_ADDTABLESPACING 8 94*cdf0e10cSrcweir #define OFFSET_USEOBJPOS 9 95*cdf0e10cSrcweir #define OFFSET_USEOURTEXTWRAPPING 10 96*cdf0e10cSrcweir #define OFFSET_CONSIDERWRAPPINGSTYLE 11 97*cdf0e10cSrcweir #define OFFSET_EXPANDWORDSPACE 12 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 100*cdf0e10cSrcweir // private declarations! 101*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir /*-**************************************************************************************************************** 104*cdf0e10cSrcweir @descr struct to hold information about one compatibility entry 105*cdf0e10cSrcweir ****************************************************************************************************************-*/ 106*cdf0e10cSrcweir struct SvtCompatibilityEntry 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir public: 109*cdf0e10cSrcweir SvtCompatibilityEntry() : 110*cdf0e10cSrcweir bUsePrtMetrics( false ), bAddSpacing( false ), 111*cdf0e10cSrcweir bAddSpacingAtPages( false ), bUseOurTabStops( false ), 112*cdf0e10cSrcweir bNoExtLeading( false ), bUseLineSpacing( false ), 113*cdf0e10cSrcweir bAddTableSpacing( false ), bUseObjPos( false ), 114*cdf0e10cSrcweir bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), 115*cdf0e10cSrcweir bExpandWordSpace( true ) {} 116*cdf0e10cSrcweir SvtCompatibilityEntry( 117*cdf0e10cSrcweir const OUString& _rName, const OUString& _rNewModule ) : 118*cdf0e10cSrcweir sName( _rName ), sModule( _rNewModule ), 119*cdf0e10cSrcweir bUsePrtMetrics( false ), bAddSpacing( false ), 120*cdf0e10cSrcweir bAddSpacingAtPages( false ), bUseOurTabStops( false ), 121*cdf0e10cSrcweir bNoExtLeading( false ), bUseLineSpacing( false ), 122*cdf0e10cSrcweir bAddTableSpacing( false ), bUseObjPos( false ), 123*cdf0e10cSrcweir bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), 124*cdf0e10cSrcweir bExpandWordSpace( true ) {} 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir inline void SetUsePrtMetrics( bool _bSet ) { bUsePrtMetrics = _bSet; } 127*cdf0e10cSrcweir inline void SetAddSpacing( bool _bSet ) { bAddSpacing = _bSet; } 128*cdf0e10cSrcweir inline void SetAddSpacingAtPages( bool _bSet ) { bAddSpacingAtPages = _bSet; } 129*cdf0e10cSrcweir inline void SetUseOurTabStops( bool _bSet ) { bUseOurTabStops = _bSet; } 130*cdf0e10cSrcweir inline void SetNoExtLeading( bool _bSet ) { bNoExtLeading = _bSet; } 131*cdf0e10cSrcweir inline void SetUseLineSpacing( bool _bSet ) { bUseLineSpacing = _bSet; } 132*cdf0e10cSrcweir inline void SetAddTableSpacing( bool _bSet ) { bAddTableSpacing = _bSet; } 133*cdf0e10cSrcweir inline void SetUseObjPos( bool _bSet ) { bUseObjPos = _bSet; } 134*cdf0e10cSrcweir inline void SetUseOurTextWrapping( bool _bSet ) { bUseOurTextWrapping = _bSet; } 135*cdf0e10cSrcweir inline void SetConsiderWrappingStyle( bool _bSet ) { bConsiderWrappingStyle = _bSet; } 136*cdf0e10cSrcweir inline void SetExpandWordSpace( bool _bSet ) { bExpandWordSpace = _bSet; } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir public: 139*cdf0e10cSrcweir OUString sName; 140*cdf0e10cSrcweir OUString sModule; 141*cdf0e10cSrcweir bool bUsePrtMetrics; 142*cdf0e10cSrcweir bool bAddSpacing; 143*cdf0e10cSrcweir bool bAddSpacingAtPages; 144*cdf0e10cSrcweir bool bUseOurTabStops; 145*cdf0e10cSrcweir bool bNoExtLeading; 146*cdf0e10cSrcweir bool bUseLineSpacing; 147*cdf0e10cSrcweir bool bAddTableSpacing; 148*cdf0e10cSrcweir bool bUseObjPos; 149*cdf0e10cSrcweir bool bUseOurTextWrapping; 150*cdf0e10cSrcweir bool bConsiderWrappingStyle; 151*cdf0e10cSrcweir bool bExpandWordSpace; 152*cdf0e10cSrcweir }; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir /*-**************************************************************************************************************** 155*cdf0e10cSrcweir @descr support simple menu structures and operations on it 156*cdf0e10cSrcweir ****************************************************************************************************************-*/ 157*cdf0e10cSrcweir class SvtCompatibility 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir public: 160*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 161*cdf0e10cSrcweir // append one entry 162*cdf0e10cSrcweir void AppendEntry( const SvtCompatibilityEntry& rEntry ) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir lEntries.push_back( rEntry ); 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 168*cdf0e10cSrcweir // the only way to free memory! 169*cdf0e10cSrcweir void Clear() 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir lEntries.clear(); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 175*cdf0e10cSrcweir // convert internal list to external format 176*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > GetList() const 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir sal_Int32 nCount = (sal_Int32)lEntries.size(); 179*cdf0e10cSrcweir sal_Int32 nStep = 0; 180*cdf0e10cSrcweir Sequence< PropertyValue > lProperties( PROPERTYCOUNT ); 181*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > lResult( nCount ); 182*cdf0e10cSrcweir const vector< SvtCompatibilityEntry >* pList = &lEntries; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir lProperties[ OFFSET_NAME ].Name = PROPERTYNAME_NAME; 185*cdf0e10cSrcweir lProperties[ OFFSET_MODULE ].Name = PROPERTYNAME_MODULE; 186*cdf0e10cSrcweir lProperties[ OFFSET_USEPRTMETRICS ].Name = PROPERTYNAME_USEPRTMETRICS; 187*cdf0e10cSrcweir lProperties[ OFFSET_ADDSPACING ].Name = PROPERTYNAME_ADDSPACING; 188*cdf0e10cSrcweir lProperties[ OFFSET_ADDSPACINGATPAGES ].Name = PROPERTYNAME_ADDSPACINGATPAGES; 189*cdf0e10cSrcweir lProperties[ OFFSET_USEOURTABSTOPS ].Name = PROPERTYNAME_USEOURTABSTOPS; 190*cdf0e10cSrcweir lProperties[ OFFSET_NOEXTLEADING ].Name = PROPERTYNAME_NOEXTLEADING; 191*cdf0e10cSrcweir lProperties[ OFFSET_USELINESPACING ].Name = PROPERTYNAME_USELINESPACING; 192*cdf0e10cSrcweir lProperties[ OFFSET_ADDTABLESPACING ].Name = PROPERTYNAME_ADDTABLESPACING; 193*cdf0e10cSrcweir lProperties[ OFFSET_USEOBJPOS ].Name = PROPERTYNAME_USEOBJPOS; 194*cdf0e10cSrcweir lProperties[ OFFSET_USEOURTEXTWRAPPING ].Name = PROPERTYNAME_USEOURTEXTWRAP; 195*cdf0e10cSrcweir lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Name = PROPERTYNAME_CONSIDERWRAPSTYLE; 196*cdf0e10cSrcweir lProperties[ OFFSET_EXPANDWORDSPACE ].Name = PROPERTYNAME_EXPANDWORDSPACE; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir for ( vector< SvtCompatibilityEntry >::const_iterator pItem = pList->begin(); 199*cdf0e10cSrcweir pItem != pList->end(); ++pItem ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir lProperties[ OFFSET_NAME ].Value <<= pItem->sName; 202*cdf0e10cSrcweir lProperties[ OFFSET_MODULE ].Value <<= pItem->sModule; 203*cdf0e10cSrcweir lProperties[ OFFSET_USEPRTMETRICS ].Value <<= pItem->bUsePrtMetrics; 204*cdf0e10cSrcweir lProperties[ OFFSET_ADDSPACING ].Value <<= pItem->bAddSpacing; 205*cdf0e10cSrcweir lProperties[ OFFSET_ADDSPACINGATPAGES ].Value <<= pItem->bAddSpacingAtPages; 206*cdf0e10cSrcweir lProperties[ OFFSET_USEOURTABSTOPS ].Value <<= pItem->bUseOurTabStops; 207*cdf0e10cSrcweir lProperties[ OFFSET_NOEXTLEADING ].Value <<= pItem->bNoExtLeading; 208*cdf0e10cSrcweir lProperties[ OFFSET_USELINESPACING ].Value <<= pItem->bUseLineSpacing; 209*cdf0e10cSrcweir lProperties[ OFFSET_ADDTABLESPACING ].Value <<= pItem->bAddTableSpacing; 210*cdf0e10cSrcweir lProperties[ OFFSET_USEOBJPOS ].Value <<= pItem->bUseObjPos; 211*cdf0e10cSrcweir lProperties[ OFFSET_USEOURTEXTWRAPPING ].Value <<= pItem->bUseOurTextWrapping; 212*cdf0e10cSrcweir lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Value <<= pItem->bConsiderWrappingStyle; 213*cdf0e10cSrcweir lProperties[ OFFSET_EXPANDWORDSPACE ].Value <<= pItem->bExpandWordSpace; 214*cdf0e10cSrcweir lResult[ nStep ] = lProperties; 215*cdf0e10cSrcweir ++nStep; 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir return lResult; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir int size() const 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir return lEntries.size(); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir const SvtCompatibilityEntry& operator[]( int i ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir return lEntries[i]; 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir private: 232*cdf0e10cSrcweir vector< SvtCompatibilityEntry > lEntries; 233*cdf0e10cSrcweir }; 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir class SvtCompatibilityOptions_Impl : public ConfigItem 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 238*cdf0e10cSrcweir // public methods 239*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir public: 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 244*cdf0e10cSrcweir // constructor / destructor 245*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir SvtCompatibilityOptions_Impl(); 248*cdf0e10cSrcweir ~SvtCompatibilityOptions_Impl(); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 251*cdf0e10cSrcweir // overloaded methods of baseclass 252*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir /*-****************************************************************************************************//** 255*cdf0e10cSrcweir @short called for notify of configmanager 256*cdf0e10cSrcweir @descr These method is called from the ConfigManager before application ends or from the 257*cdf0e10cSrcweir PropertyChangeListener if the sub tree broadcasts changes. You must update your 258*cdf0e10cSrcweir internal values. 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir @seealso baseclass ConfigItem 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir @param "lPropertyNames" is the list of properties which should be updated. 263*cdf0e10cSrcweir @return - 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir @onerror - 266*cdf0e10cSrcweir *//*-*****************************************************************************************************/ 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir virtual void Notify( const Sequence< OUString >& lPropertyNames ); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir /*-****************************************************************************************************//** 271*cdf0e10cSrcweir @short write changes to configuration 272*cdf0e10cSrcweir @descr These method writes the changed values into the sub tree 273*cdf0e10cSrcweir and should always called in our destructor to guarantee consistency of config data. 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir @seealso baseclass ConfigItem 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir @param - 278*cdf0e10cSrcweir @return - 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir @onerror - 281*cdf0e10cSrcweir *//*-*****************************************************************************************************/ 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir virtual void Commit(); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 286*cdf0e10cSrcweir // public interface 287*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir /*-****************************************************************************************************//** 290*cdf0e10cSrcweir @short base implementation of public interface for "SvtCompatibilityOptions"! 291*cdf0e10cSrcweir @descr These class is used as static member of "SvtCompatibilityOptions" ... 292*cdf0e10cSrcweir => The code exist only for one time and isn't duplicated for every instance! 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir @seealso - 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir @param - 297*cdf0e10cSrcweir @return - 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir @onerror - 300*cdf0e10cSrcweir *//*-*****************************************************************************************************/ 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir void Clear(); 303*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > GetList() const; 304*cdf0e10cSrcweir void AppendItem( const ::rtl::OUString& _sName, 305*cdf0e10cSrcweir const ::rtl::OUString& _sModule, 306*cdf0e10cSrcweir bool _bUsePrtMetrics, 307*cdf0e10cSrcweir bool _bAddSpacing, 308*cdf0e10cSrcweir bool _bAddSpacingAtPages, 309*cdf0e10cSrcweir bool _bUseOurTabStops, 310*cdf0e10cSrcweir bool _bNoExtLeading, 311*cdf0e10cSrcweir bool _bUseLineSpacing, 312*cdf0e10cSrcweir bool _bAddTableSpacing, 313*cdf0e10cSrcweir bool _bUseObjPos, 314*cdf0e10cSrcweir bool _bUseOurTextWrapping, 315*cdf0e10cSrcweir bool _bConsiderWrappingStyle, 316*cdf0e10cSrcweir bool _bExpandWordSpace ); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir inline bool IsUsePrtDevice() const { return m_aDefOptions.bUsePrtMetrics; } 319*cdf0e10cSrcweir inline bool IsAddSpacing() const { return m_aDefOptions.bAddSpacing; } 320*cdf0e10cSrcweir inline bool IsAddSpacingAtPages() const { return m_aDefOptions.bAddSpacingAtPages; } 321*cdf0e10cSrcweir inline bool IsUseOurTabStops() const { return m_aDefOptions.bUseOurTabStops; } 322*cdf0e10cSrcweir inline bool IsNoExtLeading() const { return m_aDefOptions.bNoExtLeading; } 323*cdf0e10cSrcweir inline bool IsUseLineSpacing() const { return m_aDefOptions.bUseLineSpacing; } 324*cdf0e10cSrcweir inline bool IsAddTableSpacing() const { return m_aDefOptions.bAddTableSpacing; } 325*cdf0e10cSrcweir inline bool IsUseObjPos() const { return m_aDefOptions.bUseObjPos; } 326*cdf0e10cSrcweir inline bool IsUseOurTextWrapping() const { return m_aDefOptions.bUseOurTextWrapping; } 327*cdf0e10cSrcweir inline bool IsConsiderWrappingStyle() const { return m_aDefOptions.bConsiderWrappingStyle; } 328*cdf0e10cSrcweir inline bool IsExpandWordSpace() const { return m_aDefOptions.bExpandWordSpace; } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 331*cdf0e10cSrcweir // private methods 332*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir private: 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir /*-****************************************************************************************************//** 337*cdf0e10cSrcweir @short return list of key names of our configuration management which represent one module tree 338*cdf0e10cSrcweir @descr These methods return the current list of key names! We need it to get needed values from our 339*cdf0e10cSrcweir configuration management and support dynamical menu item lists! 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir @seealso - 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir @param - 344*cdf0e10cSrcweir @return A list of configuration key names is returned. 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir @onerror - 347*cdf0e10cSrcweir *//*-*****************************************************************************************************/ 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir Sequence< OUString > impl_GetPropertyNames( Sequence< OUString >& rItems ); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir /*-****************************************************************************************************//** 352*cdf0e10cSrcweir @short expand the list for all well known properties to destination 353*cdf0e10cSrcweir @descr - 354*cdf0e10cSrcweir @attention - 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir @seealso method impl_GetPropertyNames() 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir @param "lSource" , original list 359*cdf0e10cSrcweir @param "lDestination" , destination of operation 360*cdf0e10cSrcweir @return A list of configuration key names is returned. 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir @onerror - 363*cdf0e10cSrcweir *//*-*****************************************************************************************************/ 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir void impl_ExpandPropertyNames( const Sequence< OUString >& lSource, 366*cdf0e10cSrcweir Sequence< OUString >& lDestination ); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 369*cdf0e10cSrcweir // private member 370*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir private: 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir SvtCompatibility m_aOptions; 375*cdf0e10cSrcweir SvtCompatibilityEntry m_aDefOptions; 376*cdf0e10cSrcweir }; 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 379*cdf0e10cSrcweir // definitions 380*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir //***************************************************************************************************************** 383*cdf0e10cSrcweir // constructor 384*cdf0e10cSrcweir //***************************************************************************************************************** 385*cdf0e10cSrcweir SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() 386*cdf0e10cSrcweir // Init baseclasses first 387*cdf0e10cSrcweir : ConfigItem( ROOTNODE_OPTIONS ) 388*cdf0e10cSrcweir // Init member then... 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir // Get names and values of all accessable menu entries and fill internal structures. 391*cdf0e10cSrcweir // See impl_GetPropertyNames() for further informations. 392*cdf0e10cSrcweir Sequence< OUString > lNodes; 393*cdf0e10cSrcweir Sequence< OUString > lNames = impl_GetPropertyNames( lNodes ); 394*cdf0e10cSrcweir sal_uInt32 nCount = lNodes.getLength(); 395*cdf0e10cSrcweir Sequence< Any > lValues = GetProperties( lNames ); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir // Safe impossible cases. 398*cdf0e10cSrcweir // We need values from ALL configuration keys. 399*cdf0e10cSrcweir // Follow assignment use order of values in relation to our list of key names! 400*cdf0e10cSrcweir DBG_ASSERT( !( lNames.getLength()!=lValues.getLength() ), "SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()\nI miss some values of configuration keys!\n" ); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir SvtCompatibilityEntry aItem; 403*cdf0e10cSrcweir sal_uInt32 nItem = 0; 404*cdf0e10cSrcweir sal_uInt32 nPosition = 0; 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // Get names/values for new menu. 407*cdf0e10cSrcweir // 4 subkeys for every item! 408*cdf0e10cSrcweir bool bDefaultFound = false; 409*cdf0e10cSrcweir for( nItem = 0; nItem < nCount; ++nItem ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir aItem.sName = lNodes[ nItem ]; 412*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.sModule; 413*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bUsePrtMetrics; 414*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bAddSpacing; 415*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bAddSpacingAtPages; 416*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bUseOurTabStops; 417*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bNoExtLeading; 418*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bUseLineSpacing; 419*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bAddTableSpacing; 420*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bUseObjPos; 421*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bUseOurTextWrapping; 422*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bConsiderWrappingStyle; 423*cdf0e10cSrcweir lValues[ nPosition++ ] >>= aItem.bExpandWordSpace; 424*cdf0e10cSrcweir m_aOptions.AppendEntry( aItem ); 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir if ( !bDefaultFound && aItem.sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir m_aDefOptions = aItem; 429*cdf0e10cSrcweir bDefaultFound = true; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir //***************************************************************************************************************** 435*cdf0e10cSrcweir // destructor 436*cdf0e10cSrcweir //***************************************************************************************************************** 437*cdf0e10cSrcweir SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl() 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir // We must save our current values .. if user forget it! 440*cdf0e10cSrcweir if( IsModified() == sal_True ) 441*cdf0e10cSrcweir { 442*cdf0e10cSrcweir Commit(); 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir //***************************************************************************************************************** 447*cdf0e10cSrcweir // public method 448*cdf0e10cSrcweir //***************************************************************************************************************** 449*cdf0e10cSrcweir void SvtCompatibilityOptions_Impl::Notify( const Sequence< OUString >& ) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir DBG_ASSERT( sal_False, "SvtCompatibilityOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir //***************************************************************************************************************** 455*cdf0e10cSrcweir // public method 456*cdf0e10cSrcweir //***************************************************************************************************************** 457*cdf0e10cSrcweir void SvtCompatibilityOptions_Impl::Commit() 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir // Write all properties! 460*cdf0e10cSrcweir // Delete complete set first. 461*cdf0e10cSrcweir ClearNodeSet( SETNODE_ALLFILEFORMATS ); 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir SvtCompatibilityEntry aItem; 464*cdf0e10cSrcweir OUString sNode; 465*cdf0e10cSrcweir Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT - 1 ); 466*cdf0e10cSrcweir sal_uInt32 nItem = 0; 467*cdf0e10cSrcweir sal_uInt32 nNewCount = m_aOptions.size(); 468*cdf0e10cSrcweir for( nItem = 0; nItem < nNewCount; ++nItem ) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir aItem = m_aOptions[ nItem ]; 471*cdf0e10cSrcweir sNode = SETNODE_ALLFILEFORMATS + PATHDELIMITER + aItem.sName + PATHDELIMITER; 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir lPropertyValues[ OFFSET_MODULE - 1 ].Name = sNode + PROPERTYNAME_MODULE; 474*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Name = sNode + PROPERTYNAME_USEPRTMETRICS; 475*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDSPACING - 1 ].Name = sNode + PROPERTYNAME_ADDSPACING; 476*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Name = sNode + PROPERTYNAME_ADDSPACINGATPAGES; 477*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Name = sNode + PROPERTYNAME_USEOURTABSTOPS; 478*cdf0e10cSrcweir lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Name = sNode + PROPERTYNAME_NOEXTLEADING; 479*cdf0e10cSrcweir lPropertyValues[ OFFSET_USELINESPACING - 1 ].Name = sNode + PROPERTYNAME_USELINESPACING; 480*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Name = sNode + PROPERTYNAME_ADDTABLESPACING; 481*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Name = sNode + PROPERTYNAME_USEOBJPOS; 482*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Name = sNode + PROPERTYNAME_USEOURTEXTWRAP; 483*cdf0e10cSrcweir lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Name = sNode + PROPERTYNAME_CONSIDERWRAPSTYLE; 484*cdf0e10cSrcweir lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Name = sNode + PROPERTYNAME_EXPANDWORDSPACE; 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir lPropertyValues[ OFFSET_MODULE - 1 ].Value <<= aItem.sModule; 487*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Value <<= aItem.bUsePrtMetrics; 488*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDSPACING - 1 ].Value <<= aItem.bAddSpacing; 489*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Value <<= aItem.bAddSpacingAtPages; 490*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Value <<= aItem.bUseOurTabStops; 491*cdf0e10cSrcweir lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Value <<= aItem.bNoExtLeading; 492*cdf0e10cSrcweir lPropertyValues[ OFFSET_USELINESPACING - 1 ].Value <<= aItem.bUseLineSpacing; 493*cdf0e10cSrcweir lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Value <<= aItem.bAddTableSpacing; 494*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Value <<= aItem.bUseObjPos; 495*cdf0e10cSrcweir lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Value <<= aItem.bUseOurTextWrapping; 496*cdf0e10cSrcweir lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Value <<= aItem.bConsiderWrappingStyle; 497*cdf0e10cSrcweir lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Value <<= aItem.bExpandWordSpace; 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues ); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir //***************************************************************************************************************** 504*cdf0e10cSrcweir // public method 505*cdf0e10cSrcweir //***************************************************************************************************************** 506*cdf0e10cSrcweir void SvtCompatibilityOptions_Impl::Clear() 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir m_aOptions.Clear(); 509*cdf0e10cSrcweir SetModified(); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir //***************************************************************************************************************** 513*cdf0e10cSrcweir // public method 514*cdf0e10cSrcweir //***************************************************************************************************************** 515*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions_Impl::GetList() const 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > lReturn; 518*cdf0e10cSrcweir lReturn = m_aOptions.GetList(); 519*cdf0e10cSrcweir return lReturn; 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir //***************************************************************************************************************** 523*cdf0e10cSrcweir // public method 524*cdf0e10cSrcweir //***************************************************************************************************************** 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir void SvtCompatibilityOptions_Impl::AppendItem( const ::rtl::OUString& _sName, 527*cdf0e10cSrcweir const ::rtl::OUString& _sModule, 528*cdf0e10cSrcweir bool _bUsePrtMetrics, 529*cdf0e10cSrcweir bool _bAddSpacing, 530*cdf0e10cSrcweir bool _bAddSpacingAtPages, 531*cdf0e10cSrcweir bool _bUseOurTabStops, 532*cdf0e10cSrcweir bool _bNoExtLeading, 533*cdf0e10cSrcweir bool _bUseLineSpacing, 534*cdf0e10cSrcweir bool _bAddTableSpacing, 535*cdf0e10cSrcweir bool _bUseObjPos, 536*cdf0e10cSrcweir bool _bUseOurTextWrapping, 537*cdf0e10cSrcweir bool _bConsiderWrappingStyle, 538*cdf0e10cSrcweir bool _bExpandWordSpace ) 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir SvtCompatibilityEntry aItem( _sName, _sModule ); 541*cdf0e10cSrcweir aItem.SetUsePrtMetrics( _bUsePrtMetrics ); 542*cdf0e10cSrcweir aItem.SetAddSpacing( _bAddSpacing ); 543*cdf0e10cSrcweir aItem.SetAddSpacingAtPages( _bAddSpacingAtPages ); 544*cdf0e10cSrcweir aItem.SetUseOurTabStops( _bUseOurTabStops ); 545*cdf0e10cSrcweir aItem.SetNoExtLeading( _bNoExtLeading ); 546*cdf0e10cSrcweir aItem.SetUseLineSpacing( _bUseLineSpacing ); 547*cdf0e10cSrcweir aItem.SetAddTableSpacing( _bAddTableSpacing ); 548*cdf0e10cSrcweir aItem.SetUseObjPos( _bUseObjPos ); 549*cdf0e10cSrcweir aItem.SetUseOurTextWrapping( _bUseOurTextWrapping ); 550*cdf0e10cSrcweir aItem.SetConsiderWrappingStyle( _bConsiderWrappingStyle ); 551*cdf0e10cSrcweir aItem.SetExpandWordSpace( _bExpandWordSpace ); 552*cdf0e10cSrcweir m_aOptions.AppendEntry( aItem ); 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir // default item reset? 555*cdf0e10cSrcweir if ( _sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) 556*cdf0e10cSrcweir m_aDefOptions = aItem; 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir SetModified(); 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir //***************************************************************************************************************** 562*cdf0e10cSrcweir // private method 563*cdf0e10cSrcweir //***************************************************************************************************************** 564*cdf0e10cSrcweir Sequence< OUString > SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequence< OUString >& rItems ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir // First get ALL names of current existing list items in configuration! 567*cdf0e10cSrcweir rItems = GetNodeNames( SETNODE_ALLFILEFORMATS ); 568*cdf0e10cSrcweir // expand list to result list ... 569*cdf0e10cSrcweir Sequence< OUString > lProperties( rItems.getLength() * ( PROPERTYCOUNT - 1 ) ); 570*cdf0e10cSrcweir impl_ExpandPropertyNames( rItems, lProperties ); 571*cdf0e10cSrcweir // Return result. 572*cdf0e10cSrcweir return lProperties; 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir //***************************************************************************************************************** 576*cdf0e10cSrcweir // private method 577*cdf0e10cSrcweir //***************************************************************************************************************** 578*cdf0e10cSrcweir void SvtCompatibilityOptions_Impl::impl_ExpandPropertyNames( 579*cdf0e10cSrcweir const Sequence< OUString >& lSource, Sequence< OUString >& lDestination ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir OUString sFixPath; 582*cdf0e10cSrcweir sal_Int32 nDestStep = 0; 583*cdf0e10cSrcweir sal_Int32 nSourceCount = lSource.getLength(); 584*cdf0e10cSrcweir // Copy entries to destination and expand every item with 2 supported sub properties. 585*cdf0e10cSrcweir for( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir sFixPath = SETNODE_ALLFILEFORMATS; 588*cdf0e10cSrcweir sFixPath += PATHDELIMITER; 589*cdf0e10cSrcweir sFixPath += lSource[ nSourceStep ]; 590*cdf0e10cSrcweir sFixPath += PATHDELIMITER; 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 593*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_MODULE; 594*cdf0e10cSrcweir ++nDestStep; 595*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 596*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_USEPRTMETRICS; 597*cdf0e10cSrcweir ++nDestStep; 598*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 599*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_ADDSPACING; 600*cdf0e10cSrcweir ++nDestStep; 601*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 602*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_ADDSPACINGATPAGES; 603*cdf0e10cSrcweir ++nDestStep; 604*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 605*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_USEOURTABSTOPS; 606*cdf0e10cSrcweir ++nDestStep; 607*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 608*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_NOEXTLEADING; 609*cdf0e10cSrcweir ++nDestStep; 610*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 611*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_USELINESPACING; 612*cdf0e10cSrcweir ++nDestStep; 613*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 614*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_ADDTABLESPACING; 615*cdf0e10cSrcweir ++nDestStep; 616*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 617*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_USEOBJPOS; 618*cdf0e10cSrcweir ++nDestStep; 619*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 620*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_USEOURTEXTWRAP; 621*cdf0e10cSrcweir ++nDestStep; 622*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 623*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_CONSIDERWRAPSTYLE; 624*cdf0e10cSrcweir ++nDestStep; 625*cdf0e10cSrcweir lDestination[nDestStep] = sFixPath; 626*cdf0e10cSrcweir lDestination[nDestStep] += PROPERTYNAME_EXPANDWORDSPACE; 627*cdf0e10cSrcweir ++nDestStep; 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir //***************************************************************************************************************** 632*cdf0e10cSrcweir // initialize static member 633*cdf0e10cSrcweir // DON'T DO IT IN YOUR HEADER! 634*cdf0e10cSrcweir // see definition for further informations 635*cdf0e10cSrcweir //***************************************************************************************************************** 636*cdf0e10cSrcweir SvtCompatibilityOptions_Impl* SvtCompatibilityOptions::m_pDataContainer = NULL; 637*cdf0e10cSrcweir sal_Int32 SvtCompatibilityOptions::m_nRefCount = 0; 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir //***************************************************************************************************************** 640*cdf0e10cSrcweir // constructor 641*cdf0e10cSrcweir //***************************************************************************************************************** 642*cdf0e10cSrcweir SvtCompatibilityOptions::SvtCompatibilityOptions() 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir // Global access, must be guarded (multithreading!). 645*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 646*cdf0e10cSrcweir // Increase ouer refcount ... 647*cdf0e10cSrcweir ++m_nRefCount; 648*cdf0e10cSrcweir // ... and initialize ouer data container only if it not already exist! 649*cdf0e10cSrcweir if( m_pDataContainer == NULL ) 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir m_pDataContainer = new SvtCompatibilityOptions_Impl; 652*cdf0e10cSrcweir ItemHolder1::holdConfigItem(E_COMPATIBILITY); 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir //***************************************************************************************************************** 657*cdf0e10cSrcweir // destructor 658*cdf0e10cSrcweir //***************************************************************************************************************** 659*cdf0e10cSrcweir SvtCompatibilityOptions::~SvtCompatibilityOptions() 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir // Global access, must be guarded (multithreading!) 662*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 663*cdf0e10cSrcweir // Decrease ouer refcount. 664*cdf0e10cSrcweir --m_nRefCount; 665*cdf0e10cSrcweir // If last instance was deleted ... 666*cdf0e10cSrcweir // we must destroy ouer static data container! 667*cdf0e10cSrcweir if( m_nRefCount <= 0 ) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir delete m_pDataContainer; 670*cdf0e10cSrcweir m_pDataContainer = NULL; 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir //***************************************************************************************************************** 675*cdf0e10cSrcweir // public method 676*cdf0e10cSrcweir //***************************************************************************************************************** 677*cdf0e10cSrcweir void SvtCompatibilityOptions::Clear() 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 680*cdf0e10cSrcweir m_pDataContainer->Clear(); 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir //***************************************************************************************************************** 684*cdf0e10cSrcweir // public method 685*cdf0e10cSrcweir //***************************************************************************************************************** 686*cdf0e10cSrcweir void SvtCompatibilityOptions::AppendItem( const ::rtl::OUString& sName, 687*cdf0e10cSrcweir const ::rtl::OUString& sModule, 688*cdf0e10cSrcweir bool bUsePrtMetrics, 689*cdf0e10cSrcweir bool bAddSpacing, 690*cdf0e10cSrcweir bool bAddSpacingAtPages, 691*cdf0e10cSrcweir bool bUseOurTabStops, 692*cdf0e10cSrcweir bool bNoExtLeading, 693*cdf0e10cSrcweir bool bUseLineSpacing, 694*cdf0e10cSrcweir bool bAddTableSpacing, 695*cdf0e10cSrcweir bool bUseObjPos, 696*cdf0e10cSrcweir bool bUseOurTextWrapping, 697*cdf0e10cSrcweir bool bConsiderWrappingStyle, 698*cdf0e10cSrcweir bool bExpandWordSpace ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 701*cdf0e10cSrcweir m_pDataContainer->AppendItem( 702*cdf0e10cSrcweir sName, sModule, bUsePrtMetrics, bAddSpacing, 703*cdf0e10cSrcweir bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, 704*cdf0e10cSrcweir bUseLineSpacing, bAddTableSpacing, bUseObjPos, 705*cdf0e10cSrcweir bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace ); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsUsePrtDevice() const 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 711*cdf0e10cSrcweir return m_pDataContainer->IsUsePrtDevice(); 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsAddSpacing() const 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 717*cdf0e10cSrcweir return m_pDataContainer->IsAddSpacing(); 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsAddSpacingAtPages() const 721*cdf0e10cSrcweir { 722*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 723*cdf0e10cSrcweir return m_pDataContainer->IsAddSpacingAtPages(); 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsUseOurTabStops() const 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 729*cdf0e10cSrcweir return m_pDataContainer->IsUseOurTabStops(); 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsNoExtLeading() const 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 735*cdf0e10cSrcweir return m_pDataContainer->IsNoExtLeading(); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsUseLineSpacing() const 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 741*cdf0e10cSrcweir return m_pDataContainer->IsUseLineSpacing(); 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsAddTableSpacing() const 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 747*cdf0e10cSrcweir return m_pDataContainer->IsAddTableSpacing(); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsUseObjectPositioning() const 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 753*cdf0e10cSrcweir return m_pDataContainer->IsUseObjPos(); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsUseOurTextWrapping() const 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 759*cdf0e10cSrcweir return m_pDataContainer->IsUseOurTextWrapping(); 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsConsiderWrappingStyle() const 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 765*cdf0e10cSrcweir return m_pDataContainer->IsConsiderWrappingStyle(); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir bool SvtCompatibilityOptions::IsExpandWordSpace() const 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 771*cdf0e10cSrcweir return m_pDataContainer->IsExpandWordSpace(); 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir MutexGuard aGuard( GetOwnStaticMutex() ); 777*cdf0e10cSrcweir return m_pDataContainer->GetList(); 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir //***************************************************************************************************************** 781*cdf0e10cSrcweir // private method 782*cdf0e10cSrcweir //***************************************************************************************************************** 783*cdf0e10cSrcweir Mutex& SvtCompatibilityOptions::GetOwnStaticMutex() 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir // Initialize static mutex only for one time! 786*cdf0e10cSrcweir static Mutex* pMutex = NULL; 787*cdf0e10cSrcweir // If these method first called (Mutex not already exist!) ... 788*cdf0e10cSrcweir if( pMutex == NULL ) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir // ... we must create a new one. Protect follow code with the global mutex - 791*cdf0e10cSrcweir // It must be - we create a static variable! 792*cdf0e10cSrcweir MutexGuard aGuard( Mutex::getGlobalMutex() ); 793*cdf0e10cSrcweir // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! 794*cdf0e10cSrcweir if( pMutex == NULL ) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir // Create the new mutex and set it for return on static variable. 797*cdf0e10cSrcweir static Mutex aMutex; 798*cdf0e10cSrcweir pMutex = &aMutex; 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir // Return new created or already existing mutex object. 802*cdf0e10cSrcweir return *pMutex; 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir 805