1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optcomp.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
37 #include "optcomp.hxx"
40 #include "swmodule.hxx"
41 #include "swtypes.hxx"
42 #include "uiitems.hxx"
46 #include "optcomp.hrc"
47 #include "globals.hrc"
48 #include <tools/urlobj.hxx>
50 #include <unotools/configmgr.hxx>
52 #include <vcl/msgbox.hxx>
53 #include <sfx2/docfile.hxx>
54 #include <sfx2/docfilt.hxx>
55 #include <sfx2/fcontnr.hxx>
56 #include <IDocumentSettingAccess.hxx>
58 using namespace ::com::sun::star::beans
;
59 using namespace ::com::sun::star::document
;
60 using namespace ::com::sun::star::uno
;
61 using ::rtl::OUString
;
62 using namespace ::std
;
64 #define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM( s ) )
65 #define DEFAULT_ENTRY COMPATIBILITY_DEFAULT_NAME
66 #define USER_ENTRY ASCII_STR( "_user" )
67 #define BUTTON_BORDER 2
69 // struct CompatibilityItem ----------------------------------------------
71 struct CompatibilityItem
75 bool m_bUsePrtMetrics
;
77 bool m_bAddSpacingAtPages
;
78 bool m_bUseOurTabStops
;
80 bool m_bUseLineSpacing
;
81 bool m_bAddTableSpacing
;
83 bool m_bUseOurTextWrapping
;
84 bool m_bConsiderWrappingStyle
;
85 bool m_bExpandWordSpace
;
89 CompatibilityItem( const String
& _rName
, const String
& _rModule
,
90 bool _bUsePrtMetrics
, bool _bAddSpacing
, bool _bAddSpacingAtPages
,
91 bool _bUseOurTabStops
, bool _bNoExtLeading
, bool _bUseLineSpacing
,
92 bool _bAddTableSpacing
, bool _bUseObjPos
, bool _bUseOurTextWrapping
,
93 bool _bConsiderWrappingStyle
, bool _bExpandWordSpace
,
94 bool _bIsDefault
, bool _bIsUser
) :
97 m_sModule ( _rModule
),
98 m_bUsePrtMetrics ( _bUsePrtMetrics
),
99 m_bAddSpacing ( _bAddSpacing
),
100 m_bAddSpacingAtPages ( _bAddSpacingAtPages
),
101 m_bUseOurTabStops ( _bUseOurTabStops
),
102 m_bNoExtLeading ( _bNoExtLeading
),
103 m_bUseLineSpacing ( _bUseLineSpacing
),
104 m_bAddTableSpacing ( _bAddTableSpacing
),
105 m_bUseObjPos ( _bUseObjPos
),
106 m_bUseOurTextWrapping ( _bUseOurTextWrapping
),
107 m_bConsiderWrappingStyle( _bConsiderWrappingStyle
),
108 m_bExpandWordSpace ( _bExpandWordSpace
),
109 m_bIsDefault ( _bIsDefault
),
110 m_bIsUser ( _bIsUser
) {}
115 struct SwCompatibilityOptPage_Impl
117 typedef vector
< CompatibilityItem
> SwCompatibilityItemList
;
119 SwCompatibilityItemList m_aList
;
122 // class SwCompatibilityOptPage ------------------------------------------
124 SwCompatibilityOptPage::SwCompatibilityOptPage( Window
* pParent
, const SfxItemSet
& rSet
) :
126 SfxTabPage( pParent
, SW_RES( TP_OPTCOMPATIBILITY_PAGE
), rSet
),
128 m_aMainFL ( this, SW_RES( FL_MAIN
) ),
129 m_aFormattingFT ( this, SW_RES( FT_FORMATTING
) ),
130 m_aFormattingLB ( this, SW_RES( LB_FORMATTING
) ),
131 m_aOptionsFT ( this, SW_RES( FT_OPTIONS
) ),
132 m_aOptionsLB ( this, SW_RES( LB_OPTIONS
) ),
133 m_aResetPB ( this, SW_RES( PB_RESET
) ),
134 m_aDefaultPB ( this, SW_RES( PB_DEFAULT
) ),
135 m_sUserEntry ( SW_RES( STR_USERENTRY
) ),
136 m_sUseAsDefaultQuery( SW_RES( STR_QRYBOX_USEASDEFAULT
) ),
137 m_pWrtShell ( NULL
),
138 m_pImpl ( new SwCompatibilityOptPage_Impl
),
139 m_nSavedOptions ( 0 )
142 // init options strings with local resource ids -> so do it before FreeResource()
143 for ( USHORT nResId
= STR_COMP_OPTIONS_START
; nResId
< STR_COMP_OPTIONS_END
; ++nResId
)
145 String sEntry
= String( SW_RES( nResId
) );
146 if ( STR_TAB_ALIGNMENT
== nResId
||
147 STR_LINE_SPACING
== nResId
||
148 STR_USE_OBJPOSITIONING
== nResId
||
149 STR_USE_OURTEXTWRAPPING
== nResId
)
150 ReplaceFormatName( sEntry
);
151 SvLBoxEntry
* pEntry
= m_aOptionsLB
.SvTreeListBox::InsertEntry( sEntry
);
154 m_aOptionsLB
.SetCheckButtonState( pEntry
, SV_BUTTON_UNCHECKED
);
155 pEntry
->SetUserData( (void*)(ULONG
)nResId
);
158 m_aOptionsLB
.SetWindowBits( m_aOptionsLB
.GetStyle() | WB_HSCROLL
| WB_HIDESELECTION
);
159 m_aOptionsLB
.SetHighlightRange();
163 InitControls( rSet
);
166 m_aFormattingLB
.SetSelectHdl( LINK( this, SwCompatibilityOptPage
, SelectHdl
) );
167 m_aDefaultPB
.SetClickHdl( LINK( this, SwCompatibilityOptPage
, UseAsDefaultHdl
) );
169 // hide some controls, will be implemented later!!!
170 m_aFormattingFT
.Hide();
171 m_aFormattingLB
.Hide();
173 // so move and resize the other controls
174 Point aMovePnt
= m_aFormattingFT
.GetPosPixel();
175 Point aNewPnt
= m_aOptionsFT
.GetPosPixel();
176 aNewPnt
.Y() = aMovePnt
.Y();
177 m_aOptionsFT
.SetPosPixel( aNewPnt
);
178 aMovePnt
= m_aFormattingLB
.GetPosPixel();
179 aNewPnt
= m_aOptionsLB
.GetPosPixel();
180 long nDelta
= aNewPnt
.Y() - aMovePnt
.Y();
181 aNewPnt
.Y() = aMovePnt
.Y();
182 m_aOptionsLB
.SetPosPixel( aNewPnt
);
183 Size aNewSz
= m_aOptionsLB
.GetSizePixel();
184 aNewSz
.Height() += nDelta
;
185 m_aOptionsLB
.SetSizePixel( aNewSz
);
188 // -----------------------------------------------------------------------
190 SwCompatibilityOptPage::~SwCompatibilityOptPage()
195 // -----------------------------------------------------------------------
197 void SwCompatibilityOptPage::ReplaceFormatName( String
& rEntry
)
199 static const String sOpenOfficeName
= String::CreateFromAscii("OpenOffice.org");
200 static const String sAsianName
= String::CreateFromAscii("StarSuite");
202 Any aAny
= ::utl::ConfigManager::
203 GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME
);
207 String sFormatName
= sTmp
;
208 String sFormatVersion
;
209 bool bOpenOffice
= ( sOpenOfficeName
== sFormatName
);
211 sFormatVersion
= String::CreateFromAscii("1.1");
213 sFormatVersion
= String::CreateFromAscii("6.0/7");
214 if ( !bOpenOffice
&& ( sAsianName
!= sFormatName
) )
215 sFormatName
= String::CreateFromAscii("StarOffice");
217 rEntry
.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName
);
218 rEntry
.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion
);
222 // -----------------------------------------------------------------------
224 ULONG convertBools2Ulong_Impl
226 bool _bUsePrtMetrics
,
228 bool _bAddSpacingAtPages
,
229 bool _bUseOurTabStops
,
231 bool _bUseLineSpacing
,
232 bool _bAddTableSpacing
,
234 bool _bUseOurTextWrapping
,
235 bool _bConsiderWrappingStyle
,
236 bool _bExpandWordSpace
242 if ( _bUsePrtMetrics
)
244 nSetBit
= nSetBit
<< 1;
247 nSetBit
= nSetBit
<< 1;
248 if ( _bAddSpacingAtPages
)
250 nSetBit
= nSetBit
<< 1;
251 if ( _bUseOurTabStops
)
253 nSetBit
= nSetBit
<< 1;
254 if ( _bNoExtLeading
)
256 nSetBit
= nSetBit
<< 1;
257 if ( _bUseLineSpacing
)
259 nSetBit
= nSetBit
<< 1;
260 if ( _bAddTableSpacing
)
262 nSetBit
= nSetBit
<< 1;
265 nSetBit
= nSetBit
<< 1;
266 if ( _bUseOurTextWrapping
)
268 nSetBit
= nSetBit
<< 1;
269 if ( _bConsiderWrappingStyle
)
271 nSetBit
= nSetBit
<< 1;
272 if ( _bExpandWordSpace
)
278 // -----------------------------------------------------------------------
280 void SwCompatibilityOptPage::InitControls( const SfxItemSet
& rSet
)
282 // init objectshell and detect document name
284 const SfxPoolItem
* pItem
= NULL
;
285 SfxObjectShell
* pObjShell
= NULL
;
286 if ( SFX_ITEM_SET
== rSet
.GetItemState( FN_PARAM_WRTSHELL
, FALSE
, &pItem
) )
287 m_pWrtShell
= (SwWrtShell
*)( (const SwPtrItem
*)pItem
)->GetValue();
290 pObjShell
= m_pWrtShell
->GetView().GetDocShell();
292 sDocTitle
= pObjShell
->GetTitle( SFX_TITLE_TITLE
);
297 m_aFormattingFT
.Disable();
298 m_aFormattingLB
.Disable();
299 m_aOptionsFT
.Disable();
300 m_aOptionsLB
.Disable();
301 m_aResetPB
.Disable();
302 m_aDefaultPB
.Disable();
304 String sText
= m_aMainFL
.GetText();
305 sText
.SearchAndReplace( String::CreateFromAscii("%DOCNAME"), sDocTitle
);
306 m_aMainFL
.SetText( sText
);
308 // loading file formats
309 Sequence
< Sequence
< PropertyValue
> > aList
= m_aConfigItem
.GetList();
312 bool bUsePrtMetrics
= false;
313 bool bAddSpacing
= false;
314 bool bAddSpacingAtPages
= false;
315 bool bUseOurTabStops
= false;
316 bool bNoExtLeading
= false;
317 bool bUseLineSpacing
= false;
318 bool bAddTableSpacing
= false;
319 bool bUseObjPos
= false;
320 bool bUseOurTextWrapping
= false;
321 bool bConsiderWrappingStyle
= false;
322 bool bExpandWordSpace
= false;
323 int i
, j
, nCount
= aList
.getLength();
324 for ( i
= 0; i
< nCount
; ++i
)
327 const Sequence
< PropertyValue
>& rEntry
= aList
[i
];
328 for ( j
= 0; j
< rEntry
.getLength(); j
++ )
330 PropertyValue aValue
= rEntry
[j
];
331 if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_NAME
)
332 aValue
.Value
>>= sName
;
333 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_MODULE
)
334 aValue
.Value
>>= sModule
;
335 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS
)
336 aValue
.Value
>>= bUsePrtMetrics
;
337 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_ADDSPACING
)
338 aValue
.Value
>>= bAddSpacing
;
339 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES
)
340 aValue
.Value
>>= bAddSpacingAtPages
;
341 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS
)
342 aValue
.Value
>>= bUseOurTabStops
;
343 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_NOEXTLEADING
)
344 aValue
.Value
>>= bNoExtLeading
;
345 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_USELINESPACING
)
346 aValue
.Value
>>= bUseLineSpacing
;
347 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING
)
348 aValue
.Value
>>= bAddTableSpacing
;
349 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING
)
350 aValue
.Value
>>= bUseObjPos
;
351 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING
)
352 aValue
.Value
>>= bUseOurTextWrapping
;
353 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE
)
354 aValue
.Value
>>= bConsiderWrappingStyle
;
355 else if ( aValue
.Name
== COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE
)
356 aValue
.Value
>>= bExpandWordSpace
;
359 CompatibilityItem
aItem(
360 sName
, sModule
, bUsePrtMetrics
, bAddSpacing
,
361 bAddSpacingAtPages
, bUseOurTabStops
, bNoExtLeading
,
362 bUseLineSpacing
, bAddTableSpacing
, bUseObjPos
,
363 bUseOurTextWrapping
, bConsiderWrappingStyle
, bExpandWordSpace
,
364 ( sName
.equals( DEFAULT_ENTRY
) != sal_False
),
365 ( sName
.equals( USER_ENTRY
) != sal_False
) );
366 m_pImpl
->m_aList
.push_back( aItem
);
368 if ( aItem
.m_bIsDefault
)
371 if ( sName
.equals( USER_ENTRY
) )
372 sNewEntry
= m_sUserEntry
;
373 else if ( pObjShell
&& sName
.getLength() > 0 )
375 SfxFilterContainer
* pFacCont
= pObjShell
->GetFactory().GetFilterContainer();
376 const SfxFilter
* pFilter
= pFacCont
->GetFilter4FilterName( sName
);
378 sNewEntry
= pFilter
->GetUIName();
381 if ( sNewEntry
.Len() == 0 )
384 USHORT nPos
= m_aFormattingLB
.InsertEntry( sNewEntry
);
385 ULONG nOptions
= convertBools2Ulong_Impl(
386 bUsePrtMetrics
, bAddSpacing
, bAddSpacingAtPages
,
387 bUseOurTabStops
, bNoExtLeading
, bUseLineSpacing
,
388 bAddTableSpacing
, bUseObjPos
, bUseOurTextWrapping
,
389 bConsiderWrappingStyle
, bExpandWordSpace
);
390 m_aFormattingLB
.SetEntryData( nPos
, (void*)(long)nOptions
);
393 m_aFormattingLB
.SetDropDownLineCount( m_aFormattingLB
.GetEntryCount() );
395 // check if the default button text is not too wide otherwise we have to stretch the button
396 // and move its position and the position of the reset button
397 long nTxtWidth
= m_aDefaultPB
.GetTextWidth( m_aDefaultPB
.GetText() );
398 Size aBtnSz
= m_aDefaultPB
.GetSizePixel();
399 if ( nTxtWidth
> aBtnSz
.Width() )
401 long nDelta
= nTxtWidth
- aBtnSz
.Width() + 2 * BUTTON_BORDER
;
402 aBtnSz
.Width() += nDelta
;
403 Point aBtnPnt
= m_aDefaultPB
.GetPosPixel();
404 aBtnPnt
.X() -= nDelta
;
405 m_aDefaultPB
.SetPosSizePixel( aBtnPnt
, aBtnSz
);
406 aBtnPnt
= m_aResetPB
.GetPosPixel();
407 aBtnPnt
.X() -= 2 * nDelta
;
408 m_aResetPB
.SetPosSizePixel( aBtnPnt
, aBtnSz
);
412 // -----------------------------------------------------------------------
414 IMPL_LINK( SwCompatibilityOptPage
, SelectHdl
, ListBox
*, EMPTYARG
)
416 USHORT nPos
= m_aFormattingLB
.GetSelectEntryPos();
417 ULONG nOptions
= (ULONG
)(void*)m_aFormattingLB
.GetEntryData( nPos
);
418 SetCurrentOptions( nOptions
);
423 // -----------------------------------------------------------------------
425 IMPL_LINK( SwCompatibilityOptPage
, UseAsDefaultHdl
, PushButton
*, EMPTYARG
)
427 QueryBox
aBox( this, WinBits( WB_YES_NO
| WB_DEF_YES
), m_sUseAsDefaultQuery
);
428 if ( aBox
.Execute() == RET_YES
)
430 for ( vector
< CompatibilityItem
>::iterator pItem
= m_pImpl
->m_aList
.begin();
431 pItem
!= m_pImpl
->m_aList
.end(); ++pItem
)
433 if ( pItem
->m_bIsDefault
)
435 USHORT nCount
= static_cast< USHORT
>( m_aOptionsLB
.GetEntryCount() );
436 for ( USHORT i
= 0; i
< nCount
; ++i
)
438 bool bChecked
= ( m_aOptionsLB
.IsChecked(i
) != FALSE
);
439 CompatibilityOptions eOption
= static_cast< CompatibilityOptions
>(i
);
442 case COPT_USE_PRINTERDEVICE
: pItem
->m_bUsePrtMetrics
= bChecked
; break;
443 case COPT_ADD_SPACING
: pItem
->m_bAddSpacing
= bChecked
; break;
444 case COPT_ADD_SPACING_AT_PAGES
: pItem
->m_bAddSpacingAtPages
= bChecked
; break;
445 case COPT_USE_OUR_TABSTOPS
: pItem
->m_bUseOurTabStops
= bChecked
; break;
446 case COPT_NO_EXTLEADING
: pItem
->m_bNoExtLeading
= bChecked
; break;
447 case COPT_USE_LINESPACING
: pItem
->m_bUseLineSpacing
= bChecked
; break;
448 case COPT_ADD_TABLESPACING
: pItem
->m_bAddTableSpacing
= bChecked
; break;
449 case COPT_USE_OBJECTPOSITIONING
: pItem
->m_bUseObjPos
= bChecked
; break;
450 case COPT_USE_OUR_TEXTWRAPPING
: pItem
->m_bUseOurTextWrapping
= bChecked
; break;
451 case COPT_CONSIDER_WRAPPINGSTYLE
: pItem
->m_bConsiderWrappingStyle
= bChecked
; break;
452 case COPT_EXPAND_WORDSPACE
: pItem
->m_bExpandWordSpace
= bChecked
; break;
455 DBG_ERRORFILE( "SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" );
469 // -----------------------------------------------------------------------
471 void SwCompatibilityOptPage::SetCurrentOptions( ULONG nOptions
)
473 ULONG nCount
= m_aOptionsLB
.GetEntryCount();
474 DBG_ASSERT( nCount
<= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
475 for ( USHORT i
= 0; i
< nCount
; ++i
)
477 BOOL bChecked
= ( ( nOptions
& 0x00000001 ) == 0x00000001 );
478 m_aOptionsLB
.CheckEntryPos( i
, bChecked
);
479 nOptions
= nOptions
>> 1;
483 // -----------------------------------------------------------------------
485 ULONG
SwCompatibilityOptPage::GetDocumentOptions() const
490 const IDocumentSettingAccess
& rIDocumentSettingAccess
= *m_pWrtShell
->getIDocumentSettingAccess();
491 nRet
= convertBools2Ulong_Impl(
492 rIDocumentSettingAccess
.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE
) == sal_False
,
493 rIDocumentSettingAccess
.get(IDocumentSettingAccess::PARA_SPACE_MAX
) != sal_False
,
494 rIDocumentSettingAccess
.get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES
) != sal_False
,
495 rIDocumentSettingAccess
.get(IDocumentSettingAccess::TAB_COMPAT
) == sal_False
,
496 rIDocumentSettingAccess
.get(IDocumentSettingAccess::ADD_EXT_LEADING
) == sal_False
,
497 rIDocumentSettingAccess
.get(IDocumentSettingAccess::OLD_LINE_SPACING
) != sal_False
,
498 rIDocumentSettingAccess
.get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS
) != sal_False
,
499 rIDocumentSettingAccess
.get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS
) != sal_False
,
500 rIDocumentSettingAccess
.get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING
) != sal_False
,
501 rIDocumentSettingAccess
.get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION
) != sal_False
,
502 rIDocumentSettingAccess
.get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
) != sal_True
);
507 // -----------------------------------------------------------------------
509 void SwCompatibilityOptPage::WriteOptions()
511 m_aConfigItem
.Clear();
512 for ( vector
< CompatibilityItem
>::const_iterator pItem
= m_pImpl
->m_aList
.begin();
513 pItem
!= m_pImpl
->m_aList
.end(); ++pItem
)
514 m_aConfigItem
.AppendItem(
515 pItem
->m_sName
, pItem
->m_sModule
, pItem
->m_bUsePrtMetrics
, pItem
->m_bAddSpacing
,
516 pItem
->m_bAddSpacingAtPages
, pItem
->m_bUseOurTabStops
,
517 pItem
->m_bNoExtLeading
, pItem
->m_bUseLineSpacing
,
518 pItem
->m_bAddTableSpacing
, pItem
->m_bUseObjPos
,
519 pItem
->m_bUseOurTextWrapping
, pItem
->m_bConsiderWrappingStyle
,
520 pItem
->m_bExpandWordSpace
);
523 // -----------------------------------------------------------------------
525 SfxTabPage
* SwCompatibilityOptPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
527 return new SwCompatibilityOptPage( pParent
, rAttrSet
);
530 // -----------------------------------------------------------------------
532 BOOL
SwCompatibilityOptPage::FillItemSet( SfxItemSet
& )
534 BOOL bModified
= FALSE
;
537 ULONG nSavedOptions
= m_nSavedOptions
;
538 ULONG nCount
= m_aOptionsLB
.GetEntryCount();
539 DBG_ASSERT( nCount
<= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
541 bool bSetParaSpaceMax
= false;
543 for ( USHORT i
= 0; i
< nCount
; ++i
)
545 CompatibilityOptions nOption
= static_cast< CompatibilityOptions
>(i
);
546 BOOL bChecked
= m_aOptionsLB
.IsChecked(i
);
547 BOOL bSavedChecked
= ( ( nSavedOptions
& 0x00000001 ) == 0x00000001 );
548 if ( bChecked
!= bSavedChecked
)
550 if ( COPT_USE_PRINTERDEVICE
== nOption
)
552 m_pWrtShell
->SetUseVirDev( !bChecked
);
555 else if ( ( COPT_ADD_SPACING
== nOption
|| COPT_ADD_SPACING_AT_PAGES
== nOption
) && !bSetParaSpaceMax
)
556 bSetParaSpaceMax
= true;
557 else if ( COPT_USE_OUR_TABSTOPS
== nOption
)
559 m_pWrtShell
->SetTabCompat( !bChecked
);
562 else if ( COPT_NO_EXTLEADING
== nOption
)
564 m_pWrtShell
->SetAddExtLeading( !bChecked
);
567 else if ( COPT_USE_LINESPACING
== nOption
)
569 m_pWrtShell
->SetUseFormerLineSpacing( bChecked
);
572 else if ( COPT_ADD_TABLESPACING
== nOption
)
574 m_pWrtShell
->SetAddParaSpacingToTableCells( bChecked
);
577 else if ( COPT_ADD_TABLESPACING
== nOption
)
579 m_pWrtShell
->SetAddParaSpacingToTableCells( bChecked
);
582 else if ( COPT_USE_OBJECTPOSITIONING
== nOption
)
584 m_pWrtShell
->SetUseFormerObjectPositioning( bChecked
);
587 else if ( COPT_USE_OUR_TEXTWRAPPING
== nOption
)
589 m_pWrtShell
->SetUseFormerTextWrapping( bChecked
);
592 else if ( COPT_CONSIDER_WRAPPINGSTYLE
== nOption
)
594 m_pWrtShell
->SetConsiderWrapOnObjPos( bChecked
);
597 else if ( COPT_EXPAND_WORDSPACE
== nOption
)
599 m_pWrtShell
->SetDoNotJustifyLinesWithManualBreak( !bChecked
);
604 nSavedOptions
= nSavedOptions
>> 1;
607 if ( bSetParaSpaceMax
)
609 m_pWrtShell
->SetParaSpaceMax( m_aOptionsLB
.IsChecked( (USHORT
)COPT_ADD_SPACING
) );
610 m_pWrtShell
->SetParaSpaceMaxAtPages( m_aOptionsLB
.IsChecked( (USHORT
)COPT_ADD_SPACING_AT_PAGES
) );
621 // -----------------------------------------------------------------------
623 void SwCompatibilityOptPage::Reset( const SfxItemSet
& )
625 m_aOptionsLB
.SelectEntryPos( 0 );
627 ULONG nOptions
= GetDocumentOptions();
628 SetCurrentOptions( nOptions
);
629 m_nSavedOptions
= nOptions
;