Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "optcomp.hxx"
21 :
22 : #include "docsh.hxx"
23 : #include "swmodule.hxx"
24 : #include "swtypes.hxx"
25 : #include "uiitems.hxx"
26 : #include "view.hxx"
27 : #include "wrtsh.hxx"
28 :
29 : #include "globals.hrc"
30 : #include <unotools/configmgr.hxx>
31 : #include <vcl/layout.hxx>
32 : #include <sfx2/docfile.hxx>
33 : #include <sfx2/docfilt.hxx>
34 : #include <sfx2/fcontnr.hxx>
35 : #include <svtools/treelistentry.hxx>
36 : #include <IDocumentSettingAccess.hxx>
37 :
38 : using namespace ::com::sun::star::beans;
39 : using namespace ::com::sun::star::document;
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::std;
42 :
43 0 : struct CompatibilityItem
44 : {
45 : OUString m_sName;
46 : OUString m_sModule;
47 : bool m_bUsePrtMetrics;
48 : bool m_bAddSpacing;
49 : bool m_bAddSpacingAtPages;
50 : bool m_bUseOurTabStops;
51 : bool m_bNoExtLeading;
52 : bool m_bUseLineSpacing;
53 : bool m_bAddTableSpacing;
54 : bool m_bUseObjPos;
55 : bool m_bUseOurTextWrapping;
56 : bool m_bConsiderWrappingStyle;
57 : bool m_bExpandWordSpace;
58 : bool m_bIsDefault;
59 : bool m_bIsUser;
60 :
61 0 : CompatibilityItem( const OUString& _rName, const OUString& _rModule,
62 : bool _bUsePrtMetrics, bool _bAddSpacing, bool _bAddSpacingAtPages,
63 : bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing,
64 : bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping,
65 : bool _bConsiderWrappingStyle, bool _bExpandWordSpace,
66 : bool _bIsDefault, bool _bIsUser ) :
67 :
68 : m_sName ( _rName ),
69 : m_sModule ( _rModule ),
70 : m_bUsePrtMetrics ( _bUsePrtMetrics ),
71 : m_bAddSpacing ( _bAddSpacing ),
72 : m_bAddSpacingAtPages ( _bAddSpacingAtPages ),
73 : m_bUseOurTabStops ( _bUseOurTabStops ),
74 : m_bNoExtLeading ( _bNoExtLeading ),
75 : m_bUseLineSpacing ( _bUseLineSpacing ),
76 : m_bAddTableSpacing ( _bAddTableSpacing ),
77 : m_bUseObjPos ( _bUseObjPos ),
78 : m_bUseOurTextWrapping ( _bUseOurTextWrapping ),
79 : m_bConsiderWrappingStyle( _bConsiderWrappingStyle ),
80 : m_bExpandWordSpace ( _bExpandWordSpace ),
81 : m_bIsDefault ( _bIsDefault ),
82 0 : m_bIsUser ( _bIsUser ) {}
83 : };
84 :
85 : #include <vector>
86 :
87 0 : struct SwCompatibilityOptPage_Impl
88 : {
89 : typedef vector< CompatibilityItem > SwCompatibilityItemList;
90 :
91 : SwCompatibilityItemList m_aList;
92 : };
93 :
94 0 : SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxItemSet& rSet)
95 : : SfxTabPage(pParent, "OptCompatPage",
96 : "modules/swriter/ui/optcompatpage.ui", &rSet)
97 : , m_pWrtShell(NULL)
98 0 : , m_pImpl(new SwCompatibilityOptPage_Impl)
99 0 : , m_nSavedOptions(0)
100 : {
101 0 : get(m_pMain, "compatframe");
102 0 : get(m_pFormattingLB, "format");
103 0 : get(m_pOptionsLB, "options");
104 0 : get(m_pDefaultPB, "default");
105 :
106 0 : for (sal_Int32 nId = COPT_USE_PRINTERDEVICE; nId <= COPT_EXPAND_WORDSPACE; ++nId)
107 : {
108 0 : const OUString sEntry = m_pFormattingLB->GetEntry(nId);
109 0 : SvTreeListEntry* pEntry = m_pOptionsLB->SvTreeListBox::InsertEntry( sEntry );
110 0 : if ( pEntry )
111 : {
112 0 : m_pOptionsLB->SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
113 : }
114 0 : }
115 0 : m_sUserEntry = m_pFormattingLB->GetEntry(m_pFormattingLB->GetEntryCount()-1);
116 :
117 0 : m_pFormattingLB->Clear();
118 :
119 0 : m_pOptionsLB->SetStyle( m_pOptionsLB->GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
120 0 : m_pOptionsLB->SetHighlightRange();
121 :
122 0 : InitControls( rSet );
123 :
124 : // set handler
125 0 : m_pFormattingLB->SetSelectHdl( LINK( this, SwCompatibilityOptPage, SelectHdl ) );
126 0 : m_pDefaultPB->SetClickHdl( LINK( this, SwCompatibilityOptPage, UseAsDefaultHdl ) );
127 0 : }
128 :
129 0 : SwCompatibilityOptPage::~SwCompatibilityOptPage()
130 : {
131 0 : disposeOnce();
132 0 : }
133 :
134 0 : void SwCompatibilityOptPage::dispose()
135 : {
136 0 : delete m_pImpl;
137 0 : m_pMain.clear();
138 0 : m_pFormattingLB.clear();
139 0 : m_pOptionsLB.clear();
140 0 : m_pDefaultPB.clear();
141 0 : SfxTabPage::dispose();
142 0 : }
143 :
144 0 : sal_uLong convertBools2Ulong_Impl
145 : (
146 : bool _bUsePrtMetrics,
147 : bool _bAddSpacing,
148 : bool _bAddSpacingAtPages,
149 : bool _bUseOurTabStops,
150 : bool _bNoExtLeading,
151 : bool _bUseLineSpacing,
152 : bool _bAddTableSpacing,
153 : bool _bUseObjPos,
154 : bool _bUseOurTextWrapping,
155 : bool _bConsiderWrappingStyle,
156 : bool _bExpandWordSpace
157 : )
158 : {
159 0 : sal_uLong nRet = 0;
160 0 : sal_uLong nSetBit = 1;
161 :
162 0 : if ( _bUsePrtMetrics )
163 0 : nRet |= nSetBit;
164 0 : nSetBit = nSetBit << 1;
165 0 : if ( _bAddSpacing )
166 0 : nRet |= nSetBit;
167 0 : nSetBit = nSetBit << 1;
168 0 : if ( _bAddSpacingAtPages )
169 0 : nRet |= nSetBit;
170 0 : nSetBit = nSetBit << 1;
171 0 : if ( _bUseOurTabStops )
172 0 : nRet |= nSetBit;
173 0 : nSetBit = nSetBit << 1;
174 0 : if ( _bNoExtLeading )
175 0 : nRet |= nSetBit;
176 0 : nSetBit = nSetBit << 1;
177 0 : if ( _bUseLineSpacing )
178 0 : nRet |= nSetBit;
179 0 : nSetBit = nSetBit << 1;
180 0 : if ( _bAddTableSpacing )
181 0 : nRet |= nSetBit;
182 0 : nSetBit = nSetBit << 1;
183 0 : if ( _bUseObjPos )
184 0 : nRet |= nSetBit;
185 0 : nSetBit = nSetBit << 1;
186 0 : if ( _bUseOurTextWrapping )
187 0 : nRet |= nSetBit;
188 0 : nSetBit = nSetBit << 1;
189 0 : if ( _bConsiderWrappingStyle )
190 0 : nRet |= nSetBit;
191 0 : nSetBit = nSetBit << 1;
192 0 : if ( _bExpandWordSpace )
193 0 : nRet |= nSetBit;
194 :
195 0 : return nRet;
196 : }
197 :
198 0 : void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
199 : {
200 : // init objectshell and detect document name
201 0 : OUString sDocTitle;
202 0 : const SfxPoolItem* pItem = NULL;
203 0 : SfxObjectShell* pObjShell = NULL;
204 0 : if ( SfxItemState::SET == rSet.GetItemState( FN_PARAM_WRTSHELL, false, &pItem ) )
205 0 : m_pWrtShell = static_cast<SwWrtShell*>(static_cast<const SwPtrItem*>(pItem)->GetValue());
206 0 : if ( m_pWrtShell )
207 : {
208 0 : pObjShell = m_pWrtShell->GetView().GetDocShell();
209 0 : if ( pObjShell )
210 0 : sDocTitle = pObjShell->GetTitle( SFX_TITLE_TITLE );
211 : }
212 : else
213 : {
214 0 : m_pMain->Disable();
215 : }
216 0 : const OUString& rText = m_pMain->get_label();
217 0 : m_pMain->set_label(rText.replaceAll("%DOCNAME", sDocTitle));
218 :
219 : // loading file formats
220 0 : Sequence< Sequence< PropertyValue > > aList = m_aConfigItem.GetList();
221 0 : OUString sName;
222 0 : OUString sModule;
223 0 : bool bUsePrtMetrics = false;
224 0 : bool bAddSpacing = false;
225 0 : bool bAddSpacingAtPages = false;
226 0 : bool bUseOurTabStops = false;
227 0 : bool bNoExtLeading = false;
228 0 : bool bUseLineSpacing = false;
229 0 : bool bAddTableSpacing = false;
230 0 : bool bUseObjPos = false;
231 0 : bool bUseOurTextWrapping = false;
232 0 : bool bConsiderWrappingStyle = false;
233 0 : bool bExpandWordSpace = false;
234 0 : const sal_Int32 nCount = aList.getLength();
235 0 : for ( sal_Int32 i = 0; i < nCount; ++i )
236 : {
237 0 : const Sequence< PropertyValue >& rEntry = aList[i];
238 0 : const sal_Int32 nEntries = rEntry.getLength();
239 0 : for ( sal_Int32 j = 0; j < nEntries; j++ )
240 : {
241 0 : PropertyValue aValue = rEntry[j];
242 0 : if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NAME )
243 0 : aValue.Value >>= sName;
244 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MODULE )
245 0 : aValue.Value >>= sModule;
246 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS )
247 0 : aValue.Value >>= bUsePrtMetrics;
248 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACING )
249 0 : aValue.Value >>= bAddSpacing;
250 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES )
251 0 : aValue.Value >>= bAddSpacingAtPages;
252 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS )
253 0 : aValue.Value >>= bUseOurTabStops;
254 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NOEXTLEADING )
255 0 : aValue.Value >>= bNoExtLeading;
256 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USELINESPACING )
257 0 : aValue.Value >>= bUseLineSpacing;
258 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING )
259 0 : aValue.Value >>= bAddTableSpacing;
260 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING )
261 0 : aValue.Value >>= bUseObjPos;
262 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING )
263 0 : aValue.Value >>= bUseOurTextWrapping;
264 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE )
265 0 : aValue.Value >>= bConsiderWrappingStyle;
266 0 : else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE )
267 0 : aValue.Value >>= bExpandWordSpace;
268 0 : }
269 :
270 0 : const bool bIsUserEntry = sName == "_user";
271 0 : const bool bIsDefaultEntry = sName == COMPATIBILITY_DEFAULT_NAME;
272 :
273 : CompatibilityItem aItem(
274 : sName, sModule, bUsePrtMetrics, bAddSpacing,
275 : bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
276 : bUseLineSpacing, bAddTableSpacing, bUseObjPos,
277 : bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace,
278 : bIsDefaultEntry,
279 0 : bIsUserEntry );
280 0 : m_pImpl->m_aList.push_back( aItem );
281 :
282 0 : if ( aItem.m_bIsDefault )
283 0 : continue;
284 :
285 0 : OUString sNewEntry;
286 0 : if ( bIsUserEntry )
287 0 : sNewEntry = m_sUserEntry;
288 0 : else if ( pObjShell && !sName.isEmpty() )
289 : {
290 0 : SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer();
291 0 : const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName );
292 0 : if ( pFilter )
293 0 : sNewEntry = pFilter->GetUIName();
294 : }
295 :
296 0 : if ( sNewEntry.isEmpty() )
297 0 : sNewEntry = sName;
298 :
299 0 : const sal_Int32 nPos = m_pFormattingLB->InsertEntry( sNewEntry );
300 : sal_uLong nOptions = convertBools2Ulong_Impl(
301 : bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages,
302 : bUseOurTabStops, bNoExtLeading, bUseLineSpacing,
303 : bAddTableSpacing, bUseObjPos, bUseOurTextWrapping,
304 0 : bConsiderWrappingStyle, bExpandWordSpace );
305 0 : m_pFormattingLB->SetEntryData( nPos, reinterpret_cast<void*>((sal_IntPtr)nOptions) );
306 0 : }
307 :
308 0 : m_pFormattingLB->SetDropDownLineCount( m_pFormattingLB->GetEntryCount() );
309 0 : }
310 :
311 0 : IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl)
312 : {
313 0 : const sal_Int32 nPos = m_pFormattingLB->GetSelectEntryPos();
314 0 : sal_uLong nOptions = reinterpret_cast<sal_uLong>(m_pFormattingLB->GetEntryData( nPos ));
315 0 : SetCurrentOptions( nOptions );
316 :
317 0 : return 0;
318 : }
319 :
320 0 : IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl)
321 : {
322 : ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog",
323 0 : "modules/swriter/ui/querydefaultcompatdialog.ui");
324 0 : if (aQuery->Execute() == RET_YES)
325 : {
326 0 : for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin();
327 0 : pItem != m_pImpl->m_aList.end(); ++pItem )
328 : {
329 0 : if ( pItem->m_bIsDefault )
330 : {
331 0 : const sal_Int32 nCount = m_pOptionsLB->GetEntryCount();
332 0 : for ( sal_Int32 i = 0; i < nCount; ++i )
333 : {
334 0 : bool bChecked = m_pOptionsLB->IsChecked(static_cast< sal_uLong >( i ));
335 0 : CompatibilityOptions eOption = static_cast< CompatibilityOptions >(i);
336 0 : switch ( eOption )
337 : {
338 0 : case COPT_USE_PRINTERDEVICE : pItem->m_bUsePrtMetrics = bChecked; break;
339 0 : case COPT_ADD_SPACING : pItem->m_bAddSpacing = bChecked; break;
340 0 : case COPT_ADD_SPACING_AT_PAGES : pItem->m_bAddSpacingAtPages = bChecked; break;
341 0 : case COPT_USE_OUR_TABSTOPS : pItem->m_bUseOurTabStops = bChecked; break;
342 0 : case COPT_NO_EXTLEADING : pItem->m_bNoExtLeading = bChecked; break;
343 0 : case COPT_USE_LINESPACING : pItem->m_bUseLineSpacing = bChecked; break;
344 0 : case COPT_ADD_TABLESPACING : pItem->m_bAddTableSpacing = bChecked; break;
345 0 : case COPT_USE_OBJECTPOSITIONING: pItem->m_bUseObjPos = bChecked; break;
346 0 : case COPT_USE_OUR_TEXTWRAPPING: pItem->m_bUseOurTextWrapping = bChecked; break;
347 0 : case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break;
348 0 : case COPT_EXPAND_WORDSPACE: pItem->m_bExpandWordSpace = bChecked; break;
349 : default:
350 : {
351 : OSL_FAIL("SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" );
352 : }
353 : }
354 : }
355 0 : break;
356 : }
357 : }
358 :
359 0 : WriteOptions();
360 : }
361 :
362 0 : return 0;
363 : }
364 :
365 0 : void SwCompatibilityOptPage::SetCurrentOptions( sal_uLong nOptions )
366 : {
367 0 : const sal_uLong nCount = m_pOptionsLB->GetEntryCount();
368 : OSL_ENSURE( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
369 0 : for ( sal_uLong i = 0; i < nCount; ++i )
370 : {
371 0 : bool bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 );
372 0 : m_pOptionsLB->CheckEntryPos( i, bChecked );
373 0 : nOptions = nOptions >> 1;
374 : }
375 0 : }
376 :
377 0 : sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const
378 : {
379 0 : sal_uLong nRet = 0;
380 0 : if ( m_pWrtShell )
381 : {
382 0 : const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess();
383 : nRet = convertBools2Ulong_Impl(
384 0 : !rIDocumentSettingAccess.get(DocumentSettingId::USE_VIRTUAL_DEVICE),
385 0 : rIDocumentSettingAccess.get(DocumentSettingId::PARA_SPACE_MAX),
386 0 : rIDocumentSettingAccess.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES),
387 0 : !rIDocumentSettingAccess.get(DocumentSettingId::TAB_COMPAT),
388 0 : !rIDocumentSettingAccess.get(DocumentSettingId::ADD_EXT_LEADING),
389 0 : rIDocumentSettingAccess.get(DocumentSettingId::OLD_LINE_SPACING),
390 0 : rIDocumentSettingAccess.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS),
391 0 : rIDocumentSettingAccess.get(DocumentSettingId::USE_FORMER_OBJECT_POS),
392 0 : rIDocumentSettingAccess.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING),
393 0 : rIDocumentSettingAccess.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION),
394 0 : !rIDocumentSettingAccess.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) );
395 : }
396 0 : return nRet;
397 : }
398 :
399 0 : void SwCompatibilityOptPage::WriteOptions()
400 : {
401 0 : m_aConfigItem.Clear();
402 0 : for ( vector< CompatibilityItem >::const_iterator pItem = m_pImpl->m_aList.begin();
403 0 : pItem != m_pImpl->m_aList.end(); ++pItem )
404 : m_aConfigItem.AppendItem(
405 0 : pItem->m_sName, pItem->m_sModule, pItem->m_bUsePrtMetrics, pItem->m_bAddSpacing,
406 0 : pItem->m_bAddSpacingAtPages, pItem->m_bUseOurTabStops,
407 0 : pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing,
408 0 : pItem->m_bAddTableSpacing, pItem->m_bUseObjPos,
409 0 : pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle,
410 0 : pItem->m_bExpandWordSpace );
411 0 : }
412 :
413 0 : VclPtr<SfxTabPage> SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
414 : {
415 0 : return VclPtr<SwCompatibilityOptPage>::Create( pParent, *rAttrSet );
416 : }
417 :
418 0 : bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* )
419 : {
420 0 : bool bModified = false;
421 0 : if ( m_pWrtShell )
422 : {
423 0 : sal_uLong nSavedOptions = m_nSavedOptions;
424 0 : const sal_uLong nCount = m_pOptionsLB->GetEntryCount();
425 : OSL_ENSURE( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
426 :
427 0 : bool bSetParaSpaceMax = false;
428 :
429 0 : for ( sal_uLong i = 0; i < nCount; ++i )
430 : {
431 0 : CompatibilityOptions nOption = static_cast< CompatibilityOptions >(i);
432 0 : bool bChecked = m_pOptionsLB->IsChecked(i);
433 0 : bool bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 );
434 0 : if ( bChecked != bSavedChecked )
435 : {
436 0 : if ( COPT_USE_PRINTERDEVICE == nOption )
437 : {
438 0 : m_pWrtShell->SetUseVirDev( !bChecked );
439 0 : bModified = true;
440 : }
441 0 : else if ( ( COPT_ADD_SPACING == nOption || COPT_ADD_SPACING_AT_PAGES == nOption ) && !bSetParaSpaceMax )
442 0 : bSetParaSpaceMax = true;
443 0 : else if ( COPT_USE_OUR_TABSTOPS == nOption )
444 : {
445 0 : m_pWrtShell->SetTabCompat( !bChecked );
446 0 : bModified = true;
447 : }
448 0 : else if ( COPT_NO_EXTLEADING == nOption )
449 : {
450 0 : m_pWrtShell->SetAddExtLeading( !bChecked );
451 0 : bModified = true;
452 : }
453 0 : else if ( COPT_USE_LINESPACING == nOption )
454 : {
455 0 : m_pWrtShell->SetUseFormerLineSpacing( bChecked );
456 0 : bModified = true;
457 : }
458 0 : else if ( COPT_ADD_TABLESPACING == nOption )
459 : {
460 0 : m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
461 0 : bModified = true;
462 : }
463 0 : else if ( COPT_USE_OBJECTPOSITIONING == nOption )
464 : {
465 0 : m_pWrtShell->SetUseFormerObjectPositioning( bChecked );
466 0 : bModified = true;
467 : }
468 0 : else if ( COPT_USE_OUR_TEXTWRAPPING == nOption )
469 : {
470 0 : m_pWrtShell->SetUseFormerTextWrapping( bChecked );
471 0 : bModified = true;
472 : }
473 0 : else if ( COPT_CONSIDER_WRAPPINGSTYLE == nOption )
474 : {
475 0 : m_pWrtShell->SetConsiderWrapOnObjPos( bChecked );
476 0 : bModified = true;
477 : }
478 0 : else if ( COPT_EXPAND_WORDSPACE == nOption )
479 : {
480 0 : m_pWrtShell->SetDoNotJustifyLinesWithManualBreak( !bChecked );
481 0 : bModified = true;
482 : }
483 : }
484 :
485 0 : nSavedOptions = nSavedOptions >> 1;
486 : }
487 :
488 0 : if ( bSetParaSpaceMax )
489 : {
490 0 : m_pWrtShell->SetParaSpaceMax( m_pOptionsLB->IsChecked( (sal_uLong)COPT_ADD_SPACING ) );
491 0 : m_pWrtShell->SetParaSpaceMaxAtPages( m_pOptionsLB->IsChecked( (sal_uLong)COPT_ADD_SPACING_AT_PAGES ) );
492 0 : bModified = true;
493 : }
494 : }
495 :
496 0 : if ( bModified )
497 0 : WriteOptions();
498 :
499 0 : return bModified;
500 : }
501 :
502 0 : void SwCompatibilityOptPage::Reset( const SfxItemSet* )
503 : {
504 0 : m_pOptionsLB->SelectEntryPos( 0 );
505 :
506 0 : sal_uLong nOptions = GetDocumentOptions();
507 0 : SetCurrentOptions( nOptions );
508 0 : m_nSavedOptions = nOptions;
509 0 : }
510 :
511 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|