LCOV - code coverage report
Current view: top level - sw/source/ui/config - optcomp.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 266 0.0 %
Date: 2014-11-03 Functions: 0 22 0.0 %
Legend: Lines: hit not hit

          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 :     delete m_pImpl;
     132           0 : }
     133             : 
     134           0 : sal_uLong convertBools2Ulong_Impl
     135             : (
     136             :     bool _bUsePrtMetrics,
     137             :     bool _bAddSpacing,
     138             :     bool _bAddSpacingAtPages,
     139             :     bool _bUseOurTabStops,
     140             :     bool _bNoExtLeading,
     141             :     bool _bUseLineSpacing,
     142             :     bool _bAddTableSpacing,
     143             :     bool _bUseObjPos,
     144             :     bool _bUseOurTextWrapping,
     145             :     bool _bConsiderWrappingStyle,
     146             :     bool _bExpandWordSpace
     147             : )
     148             : {
     149           0 :     sal_uLong nRet = 0;
     150           0 :     sal_uLong nSetBit = 1;
     151             : 
     152           0 :     if ( _bUsePrtMetrics )
     153           0 :         nRet |= nSetBit;
     154           0 :     nSetBit = nSetBit << 1;
     155           0 :     if ( _bAddSpacing )
     156           0 :         nRet |= nSetBit;
     157           0 :     nSetBit = nSetBit << 1;
     158           0 :     if ( _bAddSpacingAtPages )
     159           0 :         nRet |= nSetBit;
     160           0 :     nSetBit = nSetBit << 1;
     161           0 :     if ( _bUseOurTabStops )
     162           0 :         nRet |= nSetBit;
     163           0 :     nSetBit = nSetBit << 1;
     164           0 :     if ( _bNoExtLeading )
     165           0 :         nRet |= nSetBit;
     166           0 :     nSetBit = nSetBit << 1;
     167           0 :     if ( _bUseLineSpacing )
     168           0 :         nRet |= nSetBit;
     169           0 :     nSetBit = nSetBit << 1;
     170           0 :     if ( _bAddTableSpacing )
     171           0 :         nRet |= nSetBit;
     172           0 :     nSetBit = nSetBit << 1;
     173           0 :     if ( _bUseObjPos )
     174           0 :         nRet |= nSetBit;
     175           0 :     nSetBit = nSetBit << 1;
     176           0 :     if ( _bUseOurTextWrapping )
     177           0 :         nRet |= nSetBit;
     178           0 :     nSetBit = nSetBit << 1;
     179           0 :     if ( _bConsiderWrappingStyle )
     180           0 :         nRet |= nSetBit;
     181           0 :     nSetBit = nSetBit << 1;
     182           0 :     if ( _bExpandWordSpace )
     183           0 :         nRet |= nSetBit;
     184             : 
     185           0 :     return nRet;
     186             : }
     187             : 
     188           0 : void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
     189             : {
     190             :     // init objectshell and detect document name
     191           0 :     OUString sDocTitle;
     192           0 :     const SfxPoolItem* pItem = NULL;
     193           0 :     SfxObjectShell* pObjShell = NULL;
     194           0 :     if ( SfxItemState::SET == rSet.GetItemState( FN_PARAM_WRTSHELL, false, &pItem ) )
     195           0 :         m_pWrtShell = (SwWrtShell*)( (const SwPtrItem*)pItem )->GetValue();
     196           0 :     if ( m_pWrtShell )
     197             :     {
     198           0 :         pObjShell = m_pWrtShell->GetView().GetDocShell();
     199           0 :         if ( pObjShell )
     200           0 :             sDocTitle = pObjShell->GetTitle( SFX_TITLE_TITLE );
     201             :     }
     202             :     else
     203             :     {
     204           0 :         m_pMain->Disable();
     205             :     }
     206           0 :     const OUString& rText = m_pMain->get_label();
     207           0 :     m_pMain->set_label(rText.replaceAll("%DOCNAME", sDocTitle));
     208             : 
     209             :     // loading file formats
     210           0 :     Sequence< Sequence< PropertyValue > > aList = m_aConfigItem.GetList();
     211           0 :     OUString sName;
     212           0 :     OUString sModule;
     213           0 :     bool bUsePrtMetrics = false;
     214           0 :     bool bAddSpacing = false;
     215           0 :     bool bAddSpacingAtPages = false;
     216           0 :     bool bUseOurTabStops = false;
     217           0 :     bool bNoExtLeading = false;
     218           0 :     bool bUseLineSpacing = false;
     219           0 :     bool bAddTableSpacing = false;
     220           0 :     bool bUseObjPos = false;
     221           0 :     bool bUseOurTextWrapping = false;
     222           0 :     bool bConsiderWrappingStyle = false;
     223           0 :     bool bExpandWordSpace = false;
     224           0 :     const sal_Int32 nCount = aList.getLength();
     225           0 :     for ( sal_Int32 i = 0; i < nCount; ++i )
     226             :     {
     227           0 :         const Sequence< PropertyValue >& rEntry = aList[i];
     228           0 :         const sal_Int32 nEntries = rEntry.getLength();
     229           0 :         for ( sal_Int32 j = 0; j < nEntries; j++ )
     230             :         {
     231           0 :             PropertyValue aValue = rEntry[j];
     232           0 :             if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NAME )
     233           0 :                 aValue.Value >>= sName;
     234           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MODULE )
     235           0 :                 aValue.Value >>= sModule;
     236           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS )
     237           0 :                 aValue.Value >>= bUsePrtMetrics;
     238           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACING )
     239           0 :                 aValue.Value >>= bAddSpacing;
     240           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES )
     241           0 :                 aValue.Value >>= bAddSpacingAtPages;
     242           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS )
     243           0 :                 aValue.Value >>= bUseOurTabStops;
     244           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NOEXTLEADING )
     245           0 :                 aValue.Value >>= bNoExtLeading;
     246           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USELINESPACING )
     247           0 :                 aValue.Value >>= bUseLineSpacing;
     248           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING )
     249           0 :                 aValue.Value >>= bAddTableSpacing;
     250           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING )
     251           0 :                 aValue.Value >>= bUseObjPos;
     252           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING )
     253           0 :                 aValue.Value >>= bUseOurTextWrapping;
     254           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE )
     255           0 :                 aValue.Value >>= bConsiderWrappingStyle;
     256           0 :             else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE )
     257           0 :                 aValue.Value >>= bExpandWordSpace;
     258           0 :         }
     259             : 
     260           0 :         const bool bIsUserEntry = sName == "_user";
     261           0 :         const bool bIsDefaultEntry = sName == COMPATIBILITY_DEFAULT_NAME;
     262             : 
     263             :         CompatibilityItem aItem(
     264             :             sName, sModule, bUsePrtMetrics, bAddSpacing,
     265             :             bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
     266             :             bUseLineSpacing, bAddTableSpacing, bUseObjPos,
     267             :             bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace,
     268             :             bIsDefaultEntry,
     269           0 :             bIsUserEntry );
     270           0 :         m_pImpl->m_aList.push_back( aItem );
     271             : 
     272           0 :         if ( aItem.m_bIsDefault )
     273           0 :             continue;
     274             : 
     275           0 :         OUString sNewEntry;
     276           0 :         if ( bIsUserEntry )
     277           0 :             sNewEntry = m_sUserEntry;
     278           0 :         else if ( pObjShell && !sName.isEmpty() )
     279             :         {
     280           0 :             SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer();
     281           0 :             const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName );
     282           0 :             if ( pFilter )
     283           0 :                 sNewEntry = pFilter->GetUIName();
     284             :         }
     285             : 
     286           0 :         if ( sNewEntry.isEmpty() )
     287           0 :             sNewEntry = sName;
     288             : 
     289           0 :         const sal_Int32 nPos = m_pFormattingLB->InsertEntry( sNewEntry );
     290             :         sal_uLong nOptions = convertBools2Ulong_Impl(
     291             :             bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages,
     292             :             bUseOurTabStops, bNoExtLeading, bUseLineSpacing,
     293             :             bAddTableSpacing, bUseObjPos, bUseOurTextWrapping,
     294           0 :             bConsiderWrappingStyle, bExpandWordSpace );
     295           0 :         m_pFormattingLB->SetEntryData( nPos, (void*)(sal_IntPtr)nOptions );
     296           0 :     }
     297             : 
     298           0 :     m_pFormattingLB->SetDropDownLineCount( m_pFormattingLB->GetEntryCount() );
     299           0 : }
     300             : 
     301           0 : IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl)
     302             : {
     303           0 :     const sal_Int32 nPos = m_pFormattingLB->GetSelectEntryPos();
     304           0 :     sal_uLong nOptions = (sal_uLong)(void*)m_pFormattingLB->GetEntryData( nPos );
     305           0 :     SetCurrentOptions( nOptions );
     306             : 
     307           0 :     return 0;
     308             : }
     309             : 
     310           0 : IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl)
     311             : {
     312             :     MessageDialog aQuery(this, "QueryDefaultCompatDialog",
     313           0 :         "modules/swriter/ui/querydefaultcompatdialog.ui");
     314           0 :     if (aQuery.Execute() == RET_YES)
     315             :     {
     316           0 :         for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin();
     317           0 :               pItem != m_pImpl->m_aList.end(); ++pItem )
     318             :         {
     319           0 :             if ( pItem->m_bIsDefault )
     320             :             {
     321           0 :                 const sal_Int32 nCount = m_pOptionsLB->GetEntryCount();
     322           0 :                 for ( sal_Int32 i = 0; i < nCount; ++i )
     323             :                 {
     324           0 :                     bool bChecked = m_pOptionsLB->IsChecked(static_cast< sal_uLong >( i ));
     325           0 :                     CompatibilityOptions eOption = static_cast< CompatibilityOptions >(i);
     326           0 :                     switch ( eOption )
     327             :                     {
     328           0 :                         case COPT_USE_PRINTERDEVICE : pItem->m_bUsePrtMetrics = bChecked; break;
     329           0 :                         case COPT_ADD_SPACING : pItem->m_bAddSpacing = bChecked; break;
     330           0 :                         case COPT_ADD_SPACING_AT_PAGES : pItem->m_bAddSpacingAtPages = bChecked; break;
     331           0 :                         case COPT_USE_OUR_TABSTOPS : pItem->m_bUseOurTabStops = bChecked; break;
     332           0 :                         case COPT_NO_EXTLEADING : pItem->m_bNoExtLeading = bChecked; break;
     333           0 :                         case COPT_USE_LINESPACING : pItem->m_bUseLineSpacing = bChecked; break;
     334           0 :                         case COPT_ADD_TABLESPACING : pItem->m_bAddTableSpacing = bChecked; break;
     335           0 :                         case COPT_USE_OBJECTPOSITIONING: pItem->m_bUseObjPos = bChecked; break;
     336           0 :                         case COPT_USE_OUR_TEXTWRAPPING: pItem->m_bUseOurTextWrapping = bChecked; break;
     337           0 :                         case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break;
     338           0 :                         case COPT_EXPAND_WORDSPACE:  pItem->m_bExpandWordSpace = bChecked; break;
     339             :                         default:
     340             :                         {
     341             :                             OSL_FAIL("SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" );
     342             :                         }
     343             :                     }
     344             :                 }
     345           0 :                 break;
     346             :             }
     347             :         }
     348             : 
     349           0 :         WriteOptions();
     350             :     }
     351             : 
     352           0 :     return 0;
     353             : }
     354             : 
     355           0 : void SwCompatibilityOptPage::SetCurrentOptions( sal_uLong nOptions )
     356             : {
     357           0 :     const sal_uLong nCount = m_pOptionsLB->GetEntryCount();
     358             :     OSL_ENSURE( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
     359           0 :     for ( sal_uLong i = 0; i < nCount; ++i )
     360             :     {
     361           0 :         bool bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 );
     362           0 :         m_pOptionsLB->CheckEntryPos( i, bChecked );
     363           0 :         nOptions = nOptions >> 1;
     364             :     }
     365           0 : }
     366             : 
     367           0 : sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const
     368             : {
     369           0 :     sal_uLong nRet = 0;
     370           0 :     if ( m_pWrtShell )
     371             :     {
     372           0 :         const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess();
     373             :         nRet = convertBools2Ulong_Impl(
     374           0 :                 !rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE),
     375           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX),
     376           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES),
     377           0 :                 !rIDocumentSettingAccess.get(IDocumentSettingAccess::TAB_COMPAT),
     378           0 :                 !rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_EXT_LEADING),
     379           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::OLD_LINE_SPACING),
     380           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS),
     381           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS),
     382           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING),
     383           0 :                 rIDocumentSettingAccess.get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION),
     384           0 :                 !rIDocumentSettingAccess.get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) );
     385             :     }
     386           0 :     return nRet;
     387             : }
     388             : 
     389           0 : void SwCompatibilityOptPage::WriteOptions()
     390             : {
     391           0 :     m_aConfigItem.Clear();
     392           0 :     for ( vector< CompatibilityItem >::const_iterator pItem = m_pImpl->m_aList.begin();
     393           0 :           pItem != m_pImpl->m_aList.end(); ++pItem )
     394             :         m_aConfigItem.AppendItem(
     395           0 :             pItem->m_sName, pItem->m_sModule, pItem->m_bUsePrtMetrics, pItem->m_bAddSpacing,
     396           0 :             pItem->m_bAddSpacingAtPages, pItem->m_bUseOurTabStops,
     397           0 :             pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing,
     398           0 :             pItem->m_bAddTableSpacing, pItem->m_bUseObjPos,
     399           0 :             pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle,
     400           0 :             pItem->m_bExpandWordSpace );
     401           0 : }
     402             : 
     403           0 : SfxTabPage* SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
     404             : {
     405           0 :     return new SwCompatibilityOptPage( pParent, *rAttrSet );
     406             : }
     407             : 
     408           0 : bool SwCompatibilityOptPage::FillItemSet( SfxItemSet*  )
     409             : {
     410           0 :     bool bModified = false;
     411           0 :     if ( m_pWrtShell )
     412             :     {
     413           0 :         sal_uLong nSavedOptions = m_nSavedOptions;
     414           0 :         const sal_uLong nCount = m_pOptionsLB->GetEntryCount();
     415             :         OSL_ENSURE( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
     416             : 
     417           0 :         bool bSetParaSpaceMax = false;
     418             : 
     419           0 :         for ( sal_uLong i = 0; i < nCount; ++i )
     420             :         {
     421           0 :             CompatibilityOptions nOption = static_cast< CompatibilityOptions >(i);
     422           0 :             bool bChecked = m_pOptionsLB->IsChecked(i);
     423           0 :             bool bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 );
     424           0 :             if ( bChecked != bSavedChecked )
     425             :             {
     426           0 :                 if ( COPT_USE_PRINTERDEVICE == nOption )
     427             :                 {
     428           0 :                     m_pWrtShell->SetUseVirDev( !bChecked );
     429           0 :                     bModified = true;
     430             :                 }
     431           0 :                 else if ( ( COPT_ADD_SPACING == nOption || COPT_ADD_SPACING_AT_PAGES == nOption ) && !bSetParaSpaceMax )
     432           0 :                     bSetParaSpaceMax = true;
     433           0 :                 else if ( COPT_USE_OUR_TABSTOPS == nOption )
     434             :                 {
     435           0 :                     m_pWrtShell->SetTabCompat( !bChecked );
     436           0 :                     bModified = true;
     437             :                 }
     438           0 :                 else if ( COPT_NO_EXTLEADING == nOption )
     439             :                 {
     440           0 :                     m_pWrtShell->SetAddExtLeading( !bChecked );
     441           0 :                     bModified = true;
     442             :                 }
     443           0 :                 else if ( COPT_USE_LINESPACING == nOption )
     444             :                 {
     445           0 :                        m_pWrtShell->SetUseFormerLineSpacing( bChecked );
     446           0 :                     bModified = true;
     447             :                 }
     448           0 :                 else if ( COPT_ADD_TABLESPACING == nOption )
     449             :                 {
     450           0 :                     m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
     451           0 :                     bModified = true;
     452             :                 }
     453           0 :                 else if ( COPT_USE_OBJECTPOSITIONING == nOption )
     454             :                 {
     455           0 :                     m_pWrtShell->SetUseFormerObjectPositioning( bChecked );
     456           0 :                     bModified = true;
     457             :                 }
     458           0 :                 else if ( COPT_USE_OUR_TEXTWRAPPING == nOption )
     459             :                 {
     460           0 :                     m_pWrtShell->SetUseFormerTextWrapping( bChecked );
     461           0 :                     bModified = true;
     462             :                 }
     463           0 :                 else if ( COPT_CONSIDER_WRAPPINGSTYLE == nOption )
     464             :                 {
     465           0 :                     m_pWrtShell->SetConsiderWrapOnObjPos( bChecked );
     466           0 :                     bModified = true;
     467             :                 }
     468           0 :                 else if ( COPT_EXPAND_WORDSPACE == nOption )
     469             :                 {
     470           0 :                     m_pWrtShell->SetDoNotJustifyLinesWithManualBreak( !bChecked );
     471           0 :                     bModified = true;
     472             :                 }
     473             :             }
     474             : 
     475           0 :             nSavedOptions = nSavedOptions >> 1;
     476             :         }
     477             : 
     478           0 :         if ( bSetParaSpaceMax )
     479             :         {
     480           0 :             m_pWrtShell->SetParaSpaceMax( m_pOptionsLB->IsChecked( (sal_uLong)COPT_ADD_SPACING ) );
     481           0 :             m_pWrtShell->SetParaSpaceMaxAtPages( m_pOptionsLB->IsChecked( (sal_uLong)COPT_ADD_SPACING_AT_PAGES ) );
     482           0 :             bModified = true;
     483             :         }
     484             :     }
     485             : 
     486           0 :     if ( bModified )
     487           0 :         WriteOptions();
     488             : 
     489           0 :     return bModified;
     490             : }
     491             : 
     492           0 : void SwCompatibilityOptPage::Reset( const SfxItemSet*  )
     493             : {
     494           0 :     m_pOptionsLB->SelectEntryPos( 0 );
     495             : 
     496           0 :     sal_uLong nOptions = GetDocumentOptions();
     497           0 :     SetCurrentOptions( nOptions );
     498           0 :     m_nSavedOptions = nOptions;
     499           0 : }
     500             : 
     501             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10