xref: /AOO41X/main/sw/source/ui/config/optcomp.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
31*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include "optcomp.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include "docsh.hxx"
37*cdf0e10cSrcweir #include "swmodule.hxx"
38*cdf0e10cSrcweir #include "swtypes.hxx"
39*cdf0e10cSrcweir #include "uiitems.hxx"
40*cdf0e10cSrcweir #include "view.hxx"
41*cdf0e10cSrcweir #include "wrtsh.hxx"
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include "optcomp.hrc"
44*cdf0e10cSrcweir #include "globals.hrc"
45*cdf0e10cSrcweir #include <tools/urlobj.hxx>
46*cdf0e10cSrcweir #ifndef _UTL__HXX_
47*cdf0e10cSrcweir #include <unotools/configmgr.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
50*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
51*cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
52*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
53*cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
56*cdf0e10cSrcweir using namespace ::com::sun::star::document;
57*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58*cdf0e10cSrcweir using ::rtl::OUString;
59*cdf0e10cSrcweir using namespace ::std;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #define ASCII_STR(s)		OUString( RTL_CONSTASCII_USTRINGPARAM( s ) )
62*cdf0e10cSrcweir #define DEFAULT_ENTRY		COMPATIBILITY_DEFAULT_NAME
63*cdf0e10cSrcweir #define USER_ENTRY			ASCII_STR( "_user" )
64*cdf0e10cSrcweir #define BUTTON_BORDER		2
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir // struct CompatibilityItem ----------------------------------------------
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir struct CompatibilityItem
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir 	String		m_sName;
71*cdf0e10cSrcweir 	String		m_sModule;
72*cdf0e10cSrcweir 	bool		m_bUsePrtMetrics;
73*cdf0e10cSrcweir 	bool		m_bAddSpacing;
74*cdf0e10cSrcweir 	bool		m_bAddSpacingAtPages;
75*cdf0e10cSrcweir 	bool		m_bUseOurTabStops;
76*cdf0e10cSrcweir 	bool		m_bNoExtLeading;
77*cdf0e10cSrcweir 	bool		m_bUseLineSpacing;
78*cdf0e10cSrcweir 	bool		m_bAddTableSpacing;
79*cdf0e10cSrcweir 	bool		m_bUseObjPos;
80*cdf0e10cSrcweir 	bool		m_bUseOurTextWrapping;
81*cdf0e10cSrcweir 	bool		m_bConsiderWrappingStyle;
82*cdf0e10cSrcweir     bool        m_bExpandWordSpace;
83*cdf0e10cSrcweir 	bool		m_bIsDefault;
84*cdf0e10cSrcweir 	bool		m_bIsUser;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	CompatibilityItem( const String& _rName, const String& _rModule,
87*cdf0e10cSrcweir 					   bool _bUsePrtMetrics, bool _bAddSpacing, bool _bAddSpacingAtPages,
88*cdf0e10cSrcweir 					   bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing,
89*cdf0e10cSrcweir 					   bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping,
90*cdf0e10cSrcweir                        bool _bConsiderWrappingStyle, bool _bExpandWordSpace,
91*cdf0e10cSrcweir                        bool _bIsDefault, bool _bIsUser ) :
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 		m_sName					( _rName ),
94*cdf0e10cSrcweir 		m_sModule				( _rModule ),
95*cdf0e10cSrcweir 		m_bUsePrtMetrics		( _bUsePrtMetrics ),
96*cdf0e10cSrcweir 		m_bAddSpacing			( _bAddSpacing ),
97*cdf0e10cSrcweir 		m_bAddSpacingAtPages	( _bAddSpacingAtPages ),
98*cdf0e10cSrcweir 		m_bUseOurTabStops		( _bUseOurTabStops ),
99*cdf0e10cSrcweir 		m_bNoExtLeading			( _bNoExtLeading ),
100*cdf0e10cSrcweir 		m_bUseLineSpacing		( _bUseLineSpacing ),
101*cdf0e10cSrcweir 		m_bAddTableSpacing		( _bAddTableSpacing ),
102*cdf0e10cSrcweir 		m_bUseObjPos			( _bUseObjPos ),
103*cdf0e10cSrcweir 		m_bUseOurTextWrapping	( _bUseOurTextWrapping ),
104*cdf0e10cSrcweir 		m_bConsiderWrappingStyle( _bConsiderWrappingStyle ),
105*cdf0e10cSrcweir         m_bExpandWordSpace      ( _bExpandWordSpace ),
106*cdf0e10cSrcweir 		m_bIsDefault			( _bIsDefault ),
107*cdf0e10cSrcweir 		m_bIsUser				( _bIsUser ) {}
108*cdf0e10cSrcweir };
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir #include <vector>
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir struct SwCompatibilityOptPage_Impl
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir 	typedef vector< CompatibilityItem > SwCompatibilityItemList;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	SwCompatibilityItemList		m_aList;
117*cdf0e10cSrcweir };
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir // class SwCompatibilityOptPage ------------------------------------------
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir SwCompatibilityOptPage::SwCompatibilityOptPage( Window* pParent, const SfxItemSet& rSet ) :
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 	SfxTabPage( pParent, SW_RES( TP_OPTCOMPATIBILITY_PAGE ), rSet ),
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	m_aMainFL			( this, SW_RES( FL_MAIN ) ),
126*cdf0e10cSrcweir 	m_aFormattingFT		( this, SW_RES( FT_FORMATTING ) ),
127*cdf0e10cSrcweir 	m_aFormattingLB		( this, SW_RES( LB_FORMATTING ) ),
128*cdf0e10cSrcweir 	m_aOptionsFT		( this, SW_RES( FT_OPTIONS ) ),
129*cdf0e10cSrcweir 	m_aOptionsLB		( this, SW_RES( LB_OPTIONS ) ),
130*cdf0e10cSrcweir 	m_aResetPB			( this, SW_RES( PB_RESET ) ),
131*cdf0e10cSrcweir 	m_aDefaultPB		( this, SW_RES( PB_DEFAULT ) ),
132*cdf0e10cSrcweir 	m_sUserEntry		( 		SW_RES( STR_USERENTRY ) ),
133*cdf0e10cSrcweir 	m_sUseAsDefaultQuery( 		SW_RES( STR_QRYBOX_USEASDEFAULT ) ),
134*cdf0e10cSrcweir 	m_pWrtShell			( NULL ),
135*cdf0e10cSrcweir 	m_pImpl				( new SwCompatibilityOptPage_Impl ),
136*cdf0e10cSrcweir 	m_nSavedOptions		( 0 )
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir {
139*cdf0e10cSrcweir 	// init options strings with local resource ids -> so do it before FreeResource()
140*cdf0e10cSrcweir 	for ( sal_uInt16 nResId = STR_COMP_OPTIONS_START; nResId < STR_COMP_OPTIONS_END; ++nResId )
141*cdf0e10cSrcweir 	{
142*cdf0e10cSrcweir 		String sEntry = String( SW_RES( nResId ) );
143*cdf0e10cSrcweir 		if ( STR_TAB_ALIGNMENT == nResId ||
144*cdf0e10cSrcweir 			 STR_LINE_SPACING == nResId ||
145*cdf0e10cSrcweir 			 STR_USE_OBJPOSITIONING == nResId ||
146*cdf0e10cSrcweir 			 STR_USE_OURTEXTWRAPPING == nResId )
147*cdf0e10cSrcweir 			ReplaceFormatName( sEntry );
148*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = m_aOptionsLB.SvTreeListBox::InsertEntry( sEntry );
149*cdf0e10cSrcweir 		if ( pEntry )
150*cdf0e10cSrcweir 		{
151*cdf0e10cSrcweir 			m_aOptionsLB.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
152*cdf0e10cSrcweir 			pEntry->SetUserData( (void*)(sal_uLong)nResId );
153*cdf0e10cSrcweir 		}
154*cdf0e10cSrcweir 	}
155*cdf0e10cSrcweir 	m_aOptionsLB.SetStyle( m_aOptionsLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
156*cdf0e10cSrcweir 	m_aOptionsLB.SetHighlightRange();
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 	FreeResource();
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 	InitControls( rSet );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	// set handler
163*cdf0e10cSrcweir 	m_aFormattingLB.SetSelectHdl( LINK( this, SwCompatibilityOptPage, SelectHdl ) );
164*cdf0e10cSrcweir     m_aDefaultPB.SetClickHdl( LINK( this, SwCompatibilityOptPage, UseAsDefaultHdl ) );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	// hide some controls, will be implemented later!!!
167*cdf0e10cSrcweir 	m_aFormattingFT.Hide();
168*cdf0e10cSrcweir 	m_aFormattingLB.Hide();
169*cdf0e10cSrcweir 	m_aResetPB.Hide();
170*cdf0e10cSrcweir 	// so move and resize the other controls
171*cdf0e10cSrcweir 	Point aMovePnt = m_aFormattingFT.GetPosPixel();
172*cdf0e10cSrcweir 	Point aNewPnt = m_aOptionsFT.GetPosPixel();
173*cdf0e10cSrcweir 	aNewPnt.Y() = aMovePnt.Y();
174*cdf0e10cSrcweir 	m_aOptionsFT.SetPosPixel( aNewPnt );
175*cdf0e10cSrcweir 	aMovePnt = m_aFormattingLB.GetPosPixel();
176*cdf0e10cSrcweir 	aNewPnt = m_aOptionsLB.GetPosPixel();
177*cdf0e10cSrcweir 	long nDelta = aNewPnt.Y() - aMovePnt.Y();
178*cdf0e10cSrcweir 	aNewPnt.Y() = aMovePnt.Y();
179*cdf0e10cSrcweir 	m_aOptionsLB.SetPosPixel( aNewPnt );
180*cdf0e10cSrcweir 	Size aNewSz = m_aOptionsLB.GetSizePixel();
181*cdf0e10cSrcweir 	aNewSz.Height() += nDelta;
182*cdf0e10cSrcweir 	m_aOptionsLB.SetSizePixel( aNewSz );
183*cdf0e10cSrcweir }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir // -----------------------------------------------------------------------
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir SwCompatibilityOptPage::~SwCompatibilityOptPage()
188*cdf0e10cSrcweir {
189*cdf0e10cSrcweir 	delete m_pImpl;
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir // -----------------------------------------------------------------------
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir void SwCompatibilityOptPage::ReplaceFormatName( String& rEntry )
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir 	static const String sOpenOfficeName = String::CreateFromAscii("OpenOffice.org");
197*cdf0e10cSrcweir 	static const String sAsianName = String::CreateFromAscii("StarSuite");
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 	Any aAny = ::utl::ConfigManager::
200*cdf0e10cSrcweir 		GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
201*cdf0e10cSrcweir 	rtl::OUString sTmp;
202*cdf0e10cSrcweir 	if ( aAny >>= sTmp )
203*cdf0e10cSrcweir 	{
204*cdf0e10cSrcweir 		String sFormatName = sTmp;
205*cdf0e10cSrcweir 		String sFormatVersion;
206*cdf0e10cSrcweir 		bool bOpenOffice = ( sOpenOfficeName == sFormatName );
207*cdf0e10cSrcweir 		if ( bOpenOffice )
208*cdf0e10cSrcweir 			sFormatVersion = String::CreateFromAscii("1.1");
209*cdf0e10cSrcweir 		else
210*cdf0e10cSrcweir 			sFormatVersion = String::CreateFromAscii("6.0/7");
211*cdf0e10cSrcweir 		if ( !bOpenOffice && ( sAsianName != sFormatName ) )
212*cdf0e10cSrcweir 			sFormatName = String::CreateFromAscii("StarOffice");
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 		rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName );
215*cdf0e10cSrcweir 		rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion );
216*cdf0e10cSrcweir 	}
217*cdf0e10cSrcweir }
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir // -----------------------------------------------------------------------
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir sal_uLong convertBools2Ulong_Impl
222*cdf0e10cSrcweir (
223*cdf0e10cSrcweir 	bool _bUsePrtMetrics,
224*cdf0e10cSrcweir 	bool _bAddSpacing,
225*cdf0e10cSrcweir 	bool _bAddSpacingAtPages,
226*cdf0e10cSrcweir 	bool _bUseOurTabStops,
227*cdf0e10cSrcweir 	bool _bNoExtLeading,
228*cdf0e10cSrcweir 	bool _bUseLineSpacing,
229*cdf0e10cSrcweir 	bool _bAddTableSpacing,
230*cdf0e10cSrcweir 	bool _bUseObjPos,
231*cdf0e10cSrcweir 	bool _bUseOurTextWrapping,
232*cdf0e10cSrcweir     bool _bConsiderWrappingStyle,
233*cdf0e10cSrcweir     bool _bExpandWordSpace
234*cdf0e10cSrcweir )
235*cdf0e10cSrcweir {
236*cdf0e10cSrcweir 	sal_uLong nRet = 0;
237*cdf0e10cSrcweir 	sal_uLong nSetBit = 1;
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	if ( _bUsePrtMetrics )
240*cdf0e10cSrcweir 		nRet |= nSetBit;
241*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
242*cdf0e10cSrcweir 	if ( _bAddSpacing )
243*cdf0e10cSrcweir 		nRet |= nSetBit;
244*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
245*cdf0e10cSrcweir 	if ( _bAddSpacingAtPages )
246*cdf0e10cSrcweir 		nRet |= nSetBit;
247*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
248*cdf0e10cSrcweir 	if ( _bUseOurTabStops )
249*cdf0e10cSrcweir 		nRet |= nSetBit;
250*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
251*cdf0e10cSrcweir 	if ( _bNoExtLeading )
252*cdf0e10cSrcweir 		nRet |= nSetBit;
253*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
254*cdf0e10cSrcweir 	if ( _bUseLineSpacing )
255*cdf0e10cSrcweir 		nRet |= nSetBit;
256*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
257*cdf0e10cSrcweir 	if ( _bAddTableSpacing )
258*cdf0e10cSrcweir 		nRet |= nSetBit;
259*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
260*cdf0e10cSrcweir 	if ( _bUseObjPos )
261*cdf0e10cSrcweir 		nRet |= nSetBit;
262*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
263*cdf0e10cSrcweir 	if ( _bUseOurTextWrapping )
264*cdf0e10cSrcweir 		nRet |= nSetBit;
265*cdf0e10cSrcweir 	nSetBit = nSetBit << 1;
266*cdf0e10cSrcweir 	if ( _bConsiderWrappingStyle )
267*cdf0e10cSrcweir         nRet |= nSetBit;
268*cdf0e10cSrcweir     nSetBit = nSetBit << 1;
269*cdf0e10cSrcweir     if ( _bExpandWordSpace )
270*cdf0e10cSrcweir         nRet |= nSetBit;
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 	return nRet;
273*cdf0e10cSrcweir }
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir // -----------------------------------------------------------------------
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
278*cdf0e10cSrcweir {
279*cdf0e10cSrcweir 	// init objectshell and detect document name
280*cdf0e10cSrcweir 	String sDocTitle;
281*cdf0e10cSrcweir 	const SfxPoolItem* pItem = NULL;
282*cdf0e10cSrcweir 	SfxObjectShell* pObjShell = NULL;
283*cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_WRTSHELL, sal_False, &pItem ) )
284*cdf0e10cSrcweir 		m_pWrtShell = (SwWrtShell*)( (const SwPtrItem*)pItem )->GetValue();
285*cdf0e10cSrcweir 	if ( m_pWrtShell )
286*cdf0e10cSrcweir 	{
287*cdf0e10cSrcweir 		pObjShell = m_pWrtShell->GetView().GetDocShell();
288*cdf0e10cSrcweir 		if ( pObjShell )
289*cdf0e10cSrcweir 			sDocTitle = pObjShell->GetTitle( SFX_TITLE_TITLE );
290*cdf0e10cSrcweir 	}
291*cdf0e10cSrcweir 	else
292*cdf0e10cSrcweir 	{
293*cdf0e10cSrcweir 		m_aMainFL.Disable();
294*cdf0e10cSrcweir 		m_aFormattingFT.Disable();
295*cdf0e10cSrcweir 		m_aFormattingLB.Disable();
296*cdf0e10cSrcweir 		m_aOptionsFT.Disable();
297*cdf0e10cSrcweir 		m_aOptionsLB.Disable();
298*cdf0e10cSrcweir 		m_aResetPB.Disable();
299*cdf0e10cSrcweir 		m_aDefaultPB.Disable();
300*cdf0e10cSrcweir 	}
301*cdf0e10cSrcweir 	String sText = m_aMainFL.GetText();
302*cdf0e10cSrcweir 	sText.SearchAndReplace( String::CreateFromAscii("%DOCNAME"), sDocTitle );
303*cdf0e10cSrcweir 	m_aMainFL.SetText( sText );
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 	// loading file formats
306*cdf0e10cSrcweir     Sequence< Sequence< PropertyValue > > aList = m_aConfigItem.GetList();
307*cdf0e10cSrcweir 	OUString sName;
308*cdf0e10cSrcweir 	OUString sModule;
309*cdf0e10cSrcweir     bool bUsePrtMetrics = false;
310*cdf0e10cSrcweir     bool bAddSpacing = false;
311*cdf0e10cSrcweir     bool bAddSpacingAtPages = false;
312*cdf0e10cSrcweir     bool bUseOurTabStops = false;
313*cdf0e10cSrcweir     bool bNoExtLeading = false;
314*cdf0e10cSrcweir     bool bUseLineSpacing = false;
315*cdf0e10cSrcweir     bool bAddTableSpacing = false;
316*cdf0e10cSrcweir     bool bUseObjPos = false;
317*cdf0e10cSrcweir     bool bUseOurTextWrapping = false;
318*cdf0e10cSrcweir     bool bConsiderWrappingStyle = false;
319*cdf0e10cSrcweir     bool bExpandWordSpace = false;
320*cdf0e10cSrcweir 	int i, j, nCount = aList.getLength();
321*cdf0e10cSrcweir 	for ( i = 0; i < nCount; ++i )
322*cdf0e10cSrcweir 	{
323*cdf0e10cSrcweir 		String sNewEntry;
324*cdf0e10cSrcweir 		const Sequence< PropertyValue >& rEntry = aList[i];
325*cdf0e10cSrcweir 		for ( j = 0; j < rEntry.getLength(); j++ )
326*cdf0e10cSrcweir 		{
327*cdf0e10cSrcweir 			PropertyValue aValue = rEntry[j];
328*cdf0e10cSrcweir 			if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NAME )
329*cdf0e10cSrcweir 				aValue.Value >>= sName;
330*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MODULE )
331*cdf0e10cSrcweir 				aValue.Value >>= sModule;
332*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS )
333*cdf0e10cSrcweir 				aValue.Value >>= bUsePrtMetrics;
334*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACING )
335*cdf0e10cSrcweir 				aValue.Value >>= bAddSpacing;
336*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES )
337*cdf0e10cSrcweir 				aValue.Value >>= bAddSpacingAtPages;
338*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS )
339*cdf0e10cSrcweir 				aValue.Value >>= bUseOurTabStops;
340*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NOEXTLEADING )
341*cdf0e10cSrcweir 				aValue.Value >>= bNoExtLeading;
342*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USELINESPACING )
343*cdf0e10cSrcweir 				aValue.Value >>= bUseLineSpacing;
344*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING )
345*cdf0e10cSrcweir 				aValue.Value >>= bAddTableSpacing;
346*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING )
347*cdf0e10cSrcweir 				aValue.Value >>= bUseObjPos;
348*cdf0e10cSrcweir 			else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING )
349*cdf0e10cSrcweir 				aValue.Value >>= bUseOurTextWrapping;
350*cdf0e10cSrcweir             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE )
351*cdf0e10cSrcweir 				aValue.Value >>= bConsiderWrappingStyle;
352*cdf0e10cSrcweir             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE )
353*cdf0e10cSrcweir                 aValue.Value >>= bExpandWordSpace;
354*cdf0e10cSrcweir 		}
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 		CompatibilityItem aItem(
357*cdf0e10cSrcweir 			sName, sModule, bUsePrtMetrics, bAddSpacing,
358*cdf0e10cSrcweir 			bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
359*cdf0e10cSrcweir 			bUseLineSpacing, bAddTableSpacing, bUseObjPos,
360*cdf0e10cSrcweir             bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace,
361*cdf0e10cSrcweir 			( sName.equals( DEFAULT_ENTRY ) != sal_False ),
362*cdf0e10cSrcweir 			( sName.equals( USER_ENTRY ) != sal_False ) );
363*cdf0e10cSrcweir 		m_pImpl->m_aList.push_back( aItem );
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 		if ( aItem.m_bIsDefault )
366*cdf0e10cSrcweir 			continue;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 		if ( sName.equals( USER_ENTRY ) )
369*cdf0e10cSrcweir 			sNewEntry = m_sUserEntry;
370*cdf0e10cSrcweir 		else if ( pObjShell && sName.getLength() > 0 )
371*cdf0e10cSrcweir 		{
372*cdf0e10cSrcweir 			SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer();
373*cdf0e10cSrcweir 			const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName );
374*cdf0e10cSrcweir 			if ( pFilter )
375*cdf0e10cSrcweir 				sNewEntry = pFilter->GetUIName();
376*cdf0e10cSrcweir 		}
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 		if ( sNewEntry.Len() == 0 )
379*cdf0e10cSrcweir 			sNewEntry = sName;
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 		sal_uInt16 nPos = m_aFormattingLB.InsertEntry( sNewEntry );
382*cdf0e10cSrcweir 		sal_uLong nOptions = convertBools2Ulong_Impl(
383*cdf0e10cSrcweir 			bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages,
384*cdf0e10cSrcweir 			bUseOurTabStops, bNoExtLeading, bUseLineSpacing,
385*cdf0e10cSrcweir             bAddTableSpacing, bUseObjPos, bUseOurTextWrapping,
386*cdf0e10cSrcweir             bConsiderWrappingStyle, bExpandWordSpace );
387*cdf0e10cSrcweir 		m_aFormattingLB.SetEntryData( nPos, (void*)(long)nOptions );
388*cdf0e10cSrcweir 	}
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 	m_aFormattingLB.SetDropDownLineCount( m_aFormattingLB.GetEntryCount() );
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 	// check if the default button text is not too wide otherwise we have to stretch the button
393*cdf0e10cSrcweir 	// and move its position and the position of the reset button
394*cdf0e10cSrcweir 	long nTxtWidth = m_aDefaultPB.GetTextWidth( m_aDefaultPB.GetText() );
395*cdf0e10cSrcweir 	Size aBtnSz = m_aDefaultPB.GetSizePixel();
396*cdf0e10cSrcweir 	if ( nTxtWidth > aBtnSz.Width() )
397*cdf0e10cSrcweir 	{
398*cdf0e10cSrcweir 		long nDelta = nTxtWidth - aBtnSz.Width() + 2 * BUTTON_BORDER;
399*cdf0e10cSrcweir 		aBtnSz.Width() += nDelta;
400*cdf0e10cSrcweir 		Point aBtnPnt = m_aDefaultPB.GetPosPixel();
401*cdf0e10cSrcweir 		aBtnPnt.X() -= nDelta;
402*cdf0e10cSrcweir 		m_aDefaultPB.SetPosSizePixel( aBtnPnt, aBtnSz );
403*cdf0e10cSrcweir 		aBtnPnt = m_aResetPB.GetPosPixel();
404*cdf0e10cSrcweir 		aBtnPnt.X() -= 2 * nDelta;
405*cdf0e10cSrcweir 		m_aResetPB.SetPosSizePixel( aBtnPnt, aBtnSz );
406*cdf0e10cSrcweir 	}
407*cdf0e10cSrcweir }
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir // -----------------------------------------------------------------------
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir IMPL_LINK( SwCompatibilityOptPage, SelectHdl, ListBox*, EMPTYARG )
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir 	sal_uInt16 nPos = m_aFormattingLB.GetSelectEntryPos();
414*cdf0e10cSrcweir 	sal_uLong nOptions = (sal_uLong)(void*)m_aFormattingLB.GetEntryData( nPos );
415*cdf0e10cSrcweir 	SetCurrentOptions( nOptions );
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir 	return 0;
418*cdf0e10cSrcweir }
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir // -----------------------------------------------------------------------
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir IMPL_LINK( SwCompatibilityOptPage, UseAsDefaultHdl, PushButton*, EMPTYARG )
423*cdf0e10cSrcweir {
424*cdf0e10cSrcweir 	QueryBox aBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), m_sUseAsDefaultQuery );
425*cdf0e10cSrcweir 	if ( aBox.Execute() == RET_YES )
426*cdf0e10cSrcweir 	{
427*cdf0e10cSrcweir         for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin();
428*cdf0e10cSrcweir 			  pItem != m_pImpl->m_aList.end(); ++pItem )
429*cdf0e10cSrcweir 		{
430*cdf0e10cSrcweir 			if ( pItem->m_bIsDefault )
431*cdf0e10cSrcweir 			{
432*cdf0e10cSrcweir 				sal_uInt16 nCount = static_cast< sal_uInt16 >( m_aOptionsLB.GetEntryCount() );
433*cdf0e10cSrcweir 				for ( sal_uInt16 i = 0; i < nCount; ++i )
434*cdf0e10cSrcweir 				{
435*cdf0e10cSrcweir 					bool bChecked = ( m_aOptionsLB.IsChecked(i) != sal_False );
436*cdf0e10cSrcweir 					CompatibilityOptions eOption = static_cast< CompatibilityOptions >(i);
437*cdf0e10cSrcweir 					switch ( eOption )
438*cdf0e10cSrcweir 					{
439*cdf0e10cSrcweir 						case COPT_USE_PRINTERDEVICE : pItem->m_bUsePrtMetrics = bChecked; break;
440*cdf0e10cSrcweir 						case COPT_ADD_SPACING :	pItem->m_bAddSpacing = bChecked; break;
441*cdf0e10cSrcweir 						case COPT_ADD_SPACING_AT_PAGES : pItem->m_bAddSpacingAtPages = bChecked; break;
442*cdf0e10cSrcweir 						case COPT_USE_OUR_TABSTOPS : pItem->m_bUseOurTabStops = bChecked; break;
443*cdf0e10cSrcweir 						case COPT_NO_EXTLEADING : pItem->m_bNoExtLeading = bChecked; break;
444*cdf0e10cSrcweir 						case COPT_USE_LINESPACING : pItem->m_bUseLineSpacing = bChecked; break;
445*cdf0e10cSrcweir 						case COPT_ADD_TABLESPACING : pItem->m_bAddTableSpacing = bChecked; break;
446*cdf0e10cSrcweir 						case COPT_USE_OBJECTPOSITIONING: pItem->m_bUseObjPos = bChecked; break;
447*cdf0e10cSrcweir 						case COPT_USE_OUR_TEXTWRAPPING: pItem->m_bUseOurTextWrapping = bChecked; break;
448*cdf0e10cSrcweir 						case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break;
449*cdf0e10cSrcweir                         case COPT_EXPAND_WORDSPACE:  pItem->m_bExpandWordSpace = bChecked; break;
450*cdf0e10cSrcweir 						default:
451*cdf0e10cSrcweir 						{
452*cdf0e10cSrcweir 							DBG_ERRORFILE( "SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" );
453*cdf0e10cSrcweir 						}
454*cdf0e10cSrcweir 					}
455*cdf0e10cSrcweir 				}
456*cdf0e10cSrcweir 				break;
457*cdf0e10cSrcweir 			}
458*cdf0e10cSrcweir 		}
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 		WriteOptions();
461*cdf0e10cSrcweir 	}
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 	return 0;
464*cdf0e10cSrcweir }
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir // -----------------------------------------------------------------------
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir void SwCompatibilityOptPage::SetCurrentOptions( sal_uLong nOptions )
469*cdf0e10cSrcweir {
470*cdf0e10cSrcweir 	sal_uLong nCount = m_aOptionsLB.GetEntryCount();
471*cdf0e10cSrcweir 	DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
472*cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nCount; ++i )
473*cdf0e10cSrcweir 	{
474*cdf0e10cSrcweir 		sal_Bool bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 );
475*cdf0e10cSrcweir 		m_aOptionsLB.CheckEntryPos( i, bChecked );
476*cdf0e10cSrcweir 		nOptions = nOptions >> 1;
477*cdf0e10cSrcweir 	}
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir // -----------------------------------------------------------------------
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const
483*cdf0e10cSrcweir {
484*cdf0e10cSrcweir 	sal_uLong nRet = 0;
485*cdf0e10cSrcweir 	if ( m_pWrtShell )
486*cdf0e10cSrcweir 	{
487*cdf0e10cSrcweir         const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess();
488*cdf0e10cSrcweir         nRet = convertBools2Ulong_Impl(
489*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) == sal_False,
490*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX) != sal_False,
491*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != sal_False,
492*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::TAB_COMPAT) == sal_False,
493*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_EXT_LEADING) == sal_False,
494*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::OLD_LINE_SPACING) != sal_False,
495*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != sal_False,
496*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != sal_False,
497*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != sal_False,
498*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != sal_False,
499*cdf0e10cSrcweir                 rIDocumentSettingAccess.get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != sal_True );
500*cdf0e10cSrcweir     }
501*cdf0e10cSrcweir 	return nRet;
502*cdf0e10cSrcweir }
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir // -----------------------------------------------------------------------
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir void SwCompatibilityOptPage::WriteOptions()
507*cdf0e10cSrcweir {
508*cdf0e10cSrcweir 	m_aConfigItem.Clear();
509*cdf0e10cSrcweir     for ( vector< CompatibilityItem >::const_iterator pItem = m_pImpl->m_aList.begin();
510*cdf0e10cSrcweir 		  pItem != m_pImpl->m_aList.end(); ++pItem )
511*cdf0e10cSrcweir 		m_aConfigItem.AppendItem(
512*cdf0e10cSrcweir 			pItem->m_sName, pItem->m_sModule, pItem->m_bUsePrtMetrics, pItem->m_bAddSpacing,
513*cdf0e10cSrcweir 			pItem->m_bAddSpacingAtPages, pItem->m_bUseOurTabStops,
514*cdf0e10cSrcweir 			pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing,
515*cdf0e10cSrcweir 			pItem->m_bAddTableSpacing, pItem->m_bUseObjPos,
516*cdf0e10cSrcweir             pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle,
517*cdf0e10cSrcweir             pItem->m_bExpandWordSpace );
518*cdf0e10cSrcweir }
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir // -----------------------------------------------------------------------
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir SfxTabPage*	SwCompatibilityOptPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
523*cdf0e10cSrcweir {
524*cdf0e10cSrcweir 	return new SwCompatibilityOptPage( pParent, rAttrSet );
525*cdf0e10cSrcweir }
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir // -----------------------------------------------------------------------
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir sal_Bool SwCompatibilityOptPage::FillItemSet( SfxItemSet&  )
530*cdf0e10cSrcweir {
531*cdf0e10cSrcweir 	sal_Bool bModified = sal_False;
532*cdf0e10cSrcweir 	if ( m_pWrtShell )
533*cdf0e10cSrcweir 	{
534*cdf0e10cSrcweir 		sal_uLong nSavedOptions = m_nSavedOptions;
535*cdf0e10cSrcweir 		sal_uLong nCount = m_aOptionsLB.GetEntryCount();
536*cdf0e10cSrcweir 		DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir 		bool bSetParaSpaceMax = false;
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i < nCount; ++i )
541*cdf0e10cSrcweir 		{
542*cdf0e10cSrcweir 			CompatibilityOptions nOption = static_cast< CompatibilityOptions >(i);
543*cdf0e10cSrcweir 			sal_Bool bChecked = m_aOptionsLB.IsChecked(i);
544*cdf0e10cSrcweir 			sal_Bool bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 );
545*cdf0e10cSrcweir 			if ( bChecked != bSavedChecked )
546*cdf0e10cSrcweir 			{
547*cdf0e10cSrcweir 				if ( COPT_USE_PRINTERDEVICE == nOption )
548*cdf0e10cSrcweir 				{
549*cdf0e10cSrcweir                     m_pWrtShell->SetUseVirDev( !bChecked );
550*cdf0e10cSrcweir 					bModified = sal_True;
551*cdf0e10cSrcweir 				}
552*cdf0e10cSrcweir 				else if ( ( COPT_ADD_SPACING == nOption || COPT_ADD_SPACING_AT_PAGES == nOption ) && !bSetParaSpaceMax )
553*cdf0e10cSrcweir 					bSetParaSpaceMax = true;
554*cdf0e10cSrcweir 				else if ( COPT_USE_OUR_TABSTOPS == nOption )
555*cdf0e10cSrcweir 				{
556*cdf0e10cSrcweir 		            m_pWrtShell->SetTabCompat( !bChecked );
557*cdf0e10cSrcweir 					bModified = sal_True;
558*cdf0e10cSrcweir 				}
559*cdf0e10cSrcweir 				else if ( COPT_NO_EXTLEADING == nOption )
560*cdf0e10cSrcweir 				{
561*cdf0e10cSrcweir 		            m_pWrtShell->SetAddExtLeading( !bChecked );
562*cdf0e10cSrcweir 					bModified = sal_True;
563*cdf0e10cSrcweir 				}
564*cdf0e10cSrcweir 				else if ( COPT_USE_LINESPACING == nOption )
565*cdf0e10cSrcweir 				{
566*cdf0e10cSrcweir    		            m_pWrtShell->SetUseFormerLineSpacing( bChecked );
567*cdf0e10cSrcweir 					bModified = sal_True;
568*cdf0e10cSrcweir 				}
569*cdf0e10cSrcweir 				else if ( COPT_ADD_TABLESPACING == nOption )
570*cdf0e10cSrcweir 				{
571*cdf0e10cSrcweir 		            m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
572*cdf0e10cSrcweir 					bModified = sal_True;
573*cdf0e10cSrcweir 				}
574*cdf0e10cSrcweir 				else if ( COPT_ADD_TABLESPACING == nOption )
575*cdf0e10cSrcweir 				{
576*cdf0e10cSrcweir 		            m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
577*cdf0e10cSrcweir 					bModified = sal_True;
578*cdf0e10cSrcweir 				}
579*cdf0e10cSrcweir 				else if ( COPT_USE_OBJECTPOSITIONING == nOption )
580*cdf0e10cSrcweir 				{
581*cdf0e10cSrcweir 		            m_pWrtShell->SetUseFormerObjectPositioning( bChecked );
582*cdf0e10cSrcweir 					bModified = sal_True;
583*cdf0e10cSrcweir 				}
584*cdf0e10cSrcweir 				else if ( COPT_USE_OUR_TEXTWRAPPING == nOption )
585*cdf0e10cSrcweir 				{
586*cdf0e10cSrcweir 		            m_pWrtShell->SetUseFormerTextWrapping( bChecked );
587*cdf0e10cSrcweir 					bModified = sal_True;
588*cdf0e10cSrcweir 				}
589*cdf0e10cSrcweir 				else if ( COPT_CONSIDER_WRAPPINGSTYLE == nOption )
590*cdf0e10cSrcweir 				{
591*cdf0e10cSrcweir 		            m_pWrtShell->SetConsiderWrapOnObjPos( bChecked );
592*cdf0e10cSrcweir 					bModified = sal_True;
593*cdf0e10cSrcweir 				}
594*cdf0e10cSrcweir                 else if ( COPT_EXPAND_WORDSPACE == nOption )
595*cdf0e10cSrcweir                 {
596*cdf0e10cSrcweir                     m_pWrtShell->SetDoNotJustifyLinesWithManualBreak( !bChecked );
597*cdf0e10cSrcweir                     bModified = sal_True;
598*cdf0e10cSrcweir                 }
599*cdf0e10cSrcweir 			}
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir 			nSavedOptions = nSavedOptions >> 1;
602*cdf0e10cSrcweir 		}
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir 		if ( bSetParaSpaceMax )
605*cdf0e10cSrcweir 		{
606*cdf0e10cSrcweir             m_pWrtShell->SetParaSpaceMax( m_aOptionsLB.IsChecked( (sal_uInt16)COPT_ADD_SPACING ) );
607*cdf0e10cSrcweir             m_pWrtShell->SetParaSpaceMaxAtPages( m_aOptionsLB.IsChecked( (sal_uInt16)COPT_ADD_SPACING_AT_PAGES ) );
608*cdf0e10cSrcweir             bModified = sal_True;
609*cdf0e10cSrcweir 		}
610*cdf0e10cSrcweir 	}
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 	if ( bModified )
613*cdf0e10cSrcweir 		WriteOptions();
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 	return bModified;
616*cdf0e10cSrcweir }
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir // -----------------------------------------------------------------------
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir void SwCompatibilityOptPage::Reset( const SfxItemSet&  )
621*cdf0e10cSrcweir {
622*cdf0e10cSrcweir 	m_aOptionsLB.SelectEntryPos( 0 );
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir 	sal_uLong nOptions = GetDocumentOptions();
625*cdf0e10cSrcweir 	SetCurrentOptions( nOptions );
626*cdf0e10cSrcweir 	m_nSavedOptions = nOptions;
627*cdf0e10cSrcweir }
628*cdf0e10cSrcweir 
629