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