LCOV - code coverage report
Current view: top level - sc/source/ui/optdlg - tpview.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 374 0.0 %
Date: 2014-04-11 Functions: 0 29 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             : 
      21             : #undef SC_DLLIMPLEMENTATION
      22             : 
      23             : 
      24             : 
      25             : #include "scitems.hxx"
      26             : #include "tpview.hxx"
      27             : #include "global.hxx"
      28             : #include "viewopti.hxx"
      29             : #include "tabvwsh.hxx"
      30             : #include "uiitems.hxx"
      31             : #include "scresid.hxx"
      32             : #include "docsh.hxx"
      33             : #include "sc.hrc"
      34             : #include "optdlg.hrc"
      35             : #include "globstr.hrc"
      36             : #include <appoptio.hxx>
      37             : #include <scmod.hxx>
      38             : #include <svx/dlgutil.hxx>
      39             : #include <svx/drawitem.hxx>
      40             : #include <svx/xtable.hxx>
      41             : 
      42             : 
      43             : // STATIC DATA -----------------------------------------------------------
      44             : 
      45           0 : ScTpContentOptions::ScTpContentOptions( Window*         pParent,
      46             :                              const SfxItemSet&  rArgSet ) :
      47             :     SfxTabPage(pParent, "TpViewPage", "modules/scalc/ui/tpviewpage.ui", rArgSet),
      48           0 :     pLocalOptions(0)
      49             : {
      50           0 :     get(pGridLB,"grid");
      51           0 :     get(pColorFT,"color_label");
      52           0 :     get(pColorLB,"color");
      53           0 :     get(pBreakCB,"break");
      54           0 :     get(pGuideLineCB,"guideline");
      55             : 
      56           0 :     get(pFormulaCB,"formula");
      57           0 :     get(pNilCB,"nil");
      58           0 :     get(pAnnotCB,"annot");
      59           0 :     get(pValueCB,"value");
      60           0 :     get(pAnchorCB,"anchor");
      61           0 :     get(pClipMarkCB,"clipmark");
      62           0 :     get(pRangeFindCB,"rangefind");
      63             : 
      64           0 :     get(pObjGrfLB,"objgrf");
      65           0 :     get(pDiagramLB,"diagram");
      66           0 :     get(pDrawLB,"draw");
      67             : 
      68           0 :     get(pSyncZoomCB,"synczoom");
      69             : 
      70           0 :     get(pRowColHeaderCB,"rowcolheader");
      71           0 :     get(pHScrollCB,"hscroll");
      72           0 :     get(pVScrollCB,"vscroll");
      73           0 :     get(pTblRegCB,"tblreg");
      74           0 :     get(pOutlineCB,"outline");
      75             : 
      76           0 :     SetExchangeSupport();
      77           0 :     Link aSelObjHdl(LINK( this, ScTpContentOptions, SelLbObjHdl ) );
      78           0 :     pObjGrfLB->  SetSelectHdl(aSelObjHdl);
      79           0 :     pDiagramLB-> SetSelectHdl(aSelObjHdl);
      80           0 :     pDrawLB->    SetSelectHdl(aSelObjHdl);
      81           0 :     pGridLB->    SetSelectHdl( LINK( this, ScTpContentOptions, GridHdl ) );
      82             : 
      83           0 :     Link aCBHdl(LINK( this, ScTpContentOptions, CBHdl ) );
      84           0 :     pFormulaCB  ->SetClickHdl(aCBHdl);
      85           0 :     pNilCB      ->SetClickHdl(aCBHdl);
      86           0 :     pAnnotCB    ->SetClickHdl(aCBHdl);
      87           0 :     pValueCB    ->SetClickHdl(aCBHdl);
      88           0 :     pAnchorCB   ->SetClickHdl(aCBHdl);
      89           0 :     pClipMarkCB ->SetClickHdl(aCBHdl);
      90             : 
      91           0 :     pVScrollCB  ->SetClickHdl(aCBHdl);
      92           0 :     pHScrollCB  ->SetClickHdl(aCBHdl);
      93           0 :     pTblRegCB   ->SetClickHdl(aCBHdl);
      94           0 :     pOutlineCB  ->SetClickHdl(aCBHdl);
      95           0 :     pBreakCB    ->SetClickHdl(aCBHdl);
      96           0 :     pGuideLineCB->SetClickHdl(aCBHdl);
      97           0 :     pRowColHeaderCB->SetClickHdl(aCBHdl);
      98             : 
      99           0 : }
     100             : 
     101           0 : ScTpContentOptions::~ScTpContentOptions()
     102             : {
     103           0 :     delete pLocalOptions;
     104           0 : }
     105             : 
     106           0 : SfxTabPage* ScTpContentOptions::Create( Window*     pParent,
     107             :                               const SfxItemSet&     rCoreSet )
     108             : {
     109           0 :     return new ScTpContentOptions(pParent, rCoreSet);
     110             : }
     111             : 
     112           0 : bool    ScTpContentOptions::FillItemSet( SfxItemSet& rCoreSet )
     113             : {
     114           0 :     sal_Bool bRet = false;
     115           0 :     if( pFormulaCB ->GetSavedValue() != TriState(pFormulaCB ->IsChecked()) ||
     116           0 :         pNilCB     ->GetSavedValue() != TriState(pNilCB     ->IsChecked()) ||
     117           0 :         pAnnotCB   ->GetSavedValue() != TriState(pAnnotCB   ->IsChecked()) ||
     118           0 :         pValueCB   ->GetSavedValue() != TriState(pValueCB   ->IsChecked()) ||
     119           0 :         pAnchorCB  ->GetSavedValue() != TriState(pAnchorCB  ->IsChecked()) ||
     120           0 :         pClipMarkCB->GetSavedValue() != TriState(pClipMarkCB->IsChecked()) ||
     121           0 :         pObjGrfLB  ->GetSavedValue() != pObjGrfLB  ->GetSelectEntryPos() ||
     122           0 :         pDiagramLB ->GetSavedValue() != pDiagramLB ->GetSelectEntryPos() ||
     123           0 :         pDrawLB    ->GetSavedValue() != pDrawLB    ->GetSelectEntryPos() ||
     124           0 :         pGridLB        ->GetSavedValue() != pGridLB->GetSelectEntryPos() ||
     125           0 :         pRowColHeaderCB->GetSavedValue() != TriState(pRowColHeaderCB->IsChecked()) ||
     126           0 :         pHScrollCB     ->GetSavedValue() != TriState(pHScrollCB     ->IsChecked()) ||
     127           0 :         pVScrollCB     ->GetSavedValue() != TriState(pVScrollCB     ->IsChecked()) ||
     128           0 :         pTblRegCB      ->GetSavedValue() != TriState(pTblRegCB      ->IsChecked()) ||
     129           0 :         pOutlineCB     ->GetSavedValue() != TriState(pOutlineCB     ->IsChecked()) ||
     130           0 :         pColorLB       ->GetSavedValue() != pColorLB       ->GetSelectEntryPos() ||
     131           0 :         pBreakCB       ->GetSavedValue() != TriState(pBreakCB       ->IsChecked()) ||
     132           0 :         pGuideLineCB   ->GetSavedValue() != TriState(pGuideLineCB   ->IsChecked()))
     133             :     {
     134           0 :         pLocalOptions->SetGridColor( pColorLB->GetSelectEntryColor(),
     135           0 :                                      pColorLB->GetSelectEntry() );
     136           0 :         rCoreSet.Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions));
     137           0 :         bRet = sal_True;
     138             :     }
     139           0 :     if(pRangeFindCB->GetSavedValue() != TriState(pRangeFindCB->IsChecked()))
     140             :     {
     141           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER, pRangeFindCB->IsChecked()));
     142           0 :         bRet = sal_True;
     143             :     }
     144           0 :     if(pSyncZoomCB->GetSavedValue() != TriState(pSyncZoomCB->IsChecked()))
     145             :     {
     146           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM, pSyncZoomCB->IsChecked()));
     147           0 :         bRet = sal_True;
     148             :     }
     149             : 
     150             : 
     151           0 :     return bRet;
     152             : }
     153             : 
     154           0 : void    ScTpContentOptions::Reset( const SfxItemSet& rCoreSet )
     155             : {
     156             :     const SfxPoolItem* pItem;
     157           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
     158             :         pLocalOptions  = new ScViewOptions(
     159           0 :                             ((const ScTpViewItem*)pItem)->GetViewOptions() );
     160             :     else
     161           0 :         pLocalOptions = new ScViewOptions;
     162           0 :     pFormulaCB ->Check(pLocalOptions->GetOption(VOPT_FORMULAS));
     163           0 :     pNilCB     ->Check(pLocalOptions->GetOption(VOPT_NULLVALS));
     164           0 :     pAnnotCB   ->Check(pLocalOptions->GetOption(VOPT_NOTES));
     165           0 :     pValueCB   ->Check(pLocalOptions->GetOption(VOPT_SYNTAX));
     166           0 :     pAnchorCB  ->Check(pLocalOptions->GetOption(VOPT_ANCHOR));
     167           0 :     pClipMarkCB->Check(pLocalOptions->GetOption(VOPT_CLIPMARKS));
     168             : 
     169           0 :     pObjGrfLB  ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_OLE) );
     170           0 :     pDiagramLB ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_CHART) );
     171           0 :     pDrawLB    ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW) );
     172             : 
     173           0 :     pRowColHeaderCB->Check( pLocalOptions->GetOption(VOPT_HEADER) );
     174           0 :     pHScrollCB->Check( pLocalOptions->GetOption(VOPT_HSCROLL) );
     175           0 :     pVScrollCB->Check( pLocalOptions->GetOption(VOPT_VSCROLL) );
     176           0 :     pTblRegCB ->Check( pLocalOptions->GetOption(VOPT_TABCONTROLS) );
     177           0 :     pOutlineCB->Check( pLocalOptions->GetOption(VOPT_OUTLINER) );
     178             : 
     179           0 :     InitGridOpt();
     180             : 
     181           0 :     pBreakCB->Check( pLocalOptions->GetOption(VOPT_PAGEBREAKS) );
     182           0 :     pGuideLineCB->Check( pLocalOptions->GetOption(VOPT_HELPLINES) );
     183             : 
     184           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_RANGEFINDER, false, &pItem))
     185           0 :         pRangeFindCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     186           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_OPT_SYNCZOOM, false, &pItem))
     187           0 :         pSyncZoomCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     188             : 
     189           0 :     pRangeFindCB->SaveValue();
     190           0 :     pSyncZoomCB->SaveValue();
     191             : 
     192           0 :     pFormulaCB->SaveValue();
     193           0 :     pNilCB->SaveValue();
     194           0 :     pAnnotCB->SaveValue();
     195           0 :     pValueCB->SaveValue();
     196           0 :     pAnchorCB->SaveValue();
     197           0 :     pClipMarkCB->SaveValue();
     198           0 :     pObjGrfLB->SaveValue();
     199           0 :     pDiagramLB->SaveValue();
     200           0 :     pDrawLB->SaveValue();
     201           0 :     pRowColHeaderCB->SaveValue();
     202           0 :     pHScrollCB->SaveValue();
     203           0 :     pVScrollCB->SaveValue();
     204           0 :     pTblRegCB->SaveValue();
     205           0 :     pOutlineCB->SaveValue();
     206           0 :     pGridLB->SaveValue();
     207           0 :     pColorLB->SaveValue();
     208           0 :     pBreakCB->SaveValue();
     209           0 :     pGuideLineCB->SaveValue();
     210           0 : }
     211             : 
     212           0 : void ScTpContentOptions::ActivatePage( const SfxItemSet& rSet)
     213             : {
     214             :     const SfxPoolItem* pItem;
     215           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
     216           0 :         *pLocalOptions = ((const ScTpViewItem*)pItem)->GetViewOptions();
     217           0 : }
     218             : 
     219           0 : int ScTpContentOptions::DeactivatePage( SfxItemSet* pSetP )
     220             : {
     221           0 :     if(pSetP)
     222           0 :         FillItemSet(*pSetP);
     223           0 :     return SfxTabPage::LEAVE_PAGE;
     224             : }
     225             : 
     226           0 : IMPL_LINK( ScTpContentOptions, SelLbObjHdl, ListBox*, pLb )
     227             : {
     228           0 :     sal_uInt16      nSelPos = pLb->GetSelectEntryPos();
     229           0 :     ScVObjMode  eMode   = ScVObjMode(nSelPos);
     230           0 :     ScVObjType  eType   = VOBJ_TYPE_OLE;
     231             : 
     232           0 :     if ( pLb == pDiagramLB )
     233           0 :         eType = VOBJ_TYPE_CHART;
     234           0 :     else if ( pLb == pDrawLB )
     235           0 :         eType = VOBJ_TYPE_DRAW;
     236             : 
     237           0 :     pLocalOptions->SetObjMode( eType, eMode );
     238             : 
     239           0 :     return 0;
     240             : }
     241             : 
     242           0 : IMPL_LINK( ScTpContentOptions, CBHdl, CheckBox*, pBtn )
     243             : {
     244           0 :     ScViewOption eOption = VOPT_FORMULAS;
     245           0 :     sal_Bool         bChecked = pBtn->IsChecked();
     246             : 
     247           0 :     if (      pFormulaCB   == pBtn )   eOption = VOPT_FORMULAS;
     248           0 :     else if ( pNilCB       == pBtn )   eOption = VOPT_NULLVALS;
     249           0 :     else if ( pAnnotCB     == pBtn )   eOption = VOPT_NOTES;
     250           0 :     else if ( pValueCB     == pBtn )   eOption = VOPT_SYNTAX;
     251           0 :     else if ( pAnchorCB    == pBtn )   eOption = VOPT_ANCHOR;
     252           0 :     else if ( pClipMarkCB  == pBtn )   eOption = VOPT_CLIPMARKS;
     253           0 :     else if ( pVScrollCB       == pBtn )   eOption = VOPT_VSCROLL;
     254           0 :     else if ( pHScrollCB       == pBtn )   eOption = VOPT_HSCROLL;
     255           0 :     else if ( pTblRegCB        == pBtn )   eOption = VOPT_TABCONTROLS;
     256           0 :     else if ( pOutlineCB       == pBtn )   eOption = VOPT_OUTLINER;
     257           0 :     else if ( pBreakCB         == pBtn )   eOption = VOPT_PAGEBREAKS;
     258           0 :     else if ( pGuideLineCB     == pBtn )   eOption = VOPT_HELPLINES;
     259           0 :     else if ( pRowColHeaderCB  == pBtn )   eOption = VOPT_HEADER;
     260             : 
     261           0 :     pLocalOptions->SetOption( eOption, bChecked );
     262             : 
     263             : 
     264           0 :     return 0;
     265             : }
     266             : 
     267           0 : void ScTpContentOptions::InitGridOpt()
     268             : {
     269           0 :     sal_Bool    bGrid = pLocalOptions->GetOption( VOPT_GRID );
     270           0 :     sal_Bool    bGridOnTop = pLocalOptions->GetOption( VOPT_GRID_ONTOP );
     271           0 :     sal_Int32   nSelPos = 0;
     272             : 
     273           0 :     if ( bGrid || bGridOnTop )
     274             :     {
     275           0 :         pColorFT->Enable(), pColorLB->Enable();
     276           0 :         if ( !bGridOnTop )
     277           0 :             nSelPos = 0;
     278             :         else
     279           0 :             nSelPos = 1;
     280             :     }
     281             :     else
     282             :     {
     283           0 :         pColorFT->Disable(), pColorLB->Disable();
     284           0 :         nSelPos = 2;
     285             :     }
     286             : 
     287           0 :     pGridLB->SelectEntryPos (nSelPos);
     288             : 
     289           0 :     if ( pColorLB->GetEntryCount() == 0 )
     290             :     {
     291           0 :         SfxObjectShell* pDocSh = SfxObjectShell::Current();
     292             :         // there might be another DocShell here
     293           0 :         pDocSh = PTR_CAST(ScDocShell, pDocSh);
     294             : 
     295           0 :         XColorListRef pColorList;
     296           0 :         if ( pDocSh  )
     297             :         {
     298           0 :             const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
     299           0 :             if ( pItem )
     300           0 :                 pColorList = ((SvxColorListItem*)pItem)->GetColorList();
     301             :         }
     302             :         else
     303           0 :             pColorList = XColorList::GetStdColorList();
     304             : 
     305           0 :         if ( !pColorList.is() )
     306           0 :             return;
     307             : 
     308           0 :         pColorLB->SetUpdateMode( false );
     309             : 
     310             :         // items from ColorTable
     311             : 
     312           0 :         long nCount = pColorList->Count();
     313           0 :         for ( long n=0; n<nCount; n++ )
     314             :         {
     315           0 :             XColorEntry* pEntry = pColorList->GetColor(n);
     316           0 :             pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
     317             :         }
     318             : 
     319             :         // default GridColor
     320             : 
     321           0 :         Color aStdCol( SC_STD_GRIDCOLOR );          // same default as in ScViewOptions
     322           0 :         if ( LISTBOX_ENTRY_NOTFOUND ==
     323           0 :                 pColorLB->GetEntryPos( aStdCol ) )
     324           0 :             pColorLB->InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) );
     325             : 
     326           0 :         pColorLB->SetUpdateMode( true );
     327             : 
     328           0 :         Invalidate();
     329             :     }
     330             : 
     331             :     //  also select grid color entry on subsequent calls
     332             : 
     333           0 :     OUString  aName;
     334           0 :     Color     aCol    = pLocalOptions->GetGridColor( &aName );
     335           0 :     nSelPos = pColorLB->GetEntryPos( aCol );
     336             : 
     337           0 :     if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
     338           0 :         pColorLB->SelectEntryPos( nSelPos );
     339             :     else
     340           0 :         pColorLB->SelectEntryPos( pColorLB->InsertEntry( aCol, aName ) );
     341             : }
     342             : 
     343           0 : IMPL_LINK( ScTpContentOptions, GridHdl, ListBox*, pLb )
     344             : {
     345           0 :     sal_Int32   nSelPos = pLb->GetSelectEntryPos();
     346           0 :     sal_Bool    bGrid = ( nSelPos <= 1 );
     347           0 :     sal_Bool    bGridOnTop = ( nSelPos == 1 );
     348             : 
     349           0 :     pColorFT->Enable(bGrid);
     350           0 :     pColorLB->Enable(bGrid);
     351           0 :     pLocalOptions->SetOption( VOPT_GRID, bGrid );
     352           0 :     pLocalOptions->SetOption( VOPT_GRID_ONTOP, bGridOnTop );
     353           0 :     return 0;
     354             : }
     355             : 
     356           0 : ScTpLayoutOptions::ScTpLayoutOptions(   Window* pParent,
     357             :                                         const SfxItemSet&   rArgSet ) :
     358             :     SfxTabPage( pParent, "ScGeneralPage",
     359             :                 "modules/scalc/ui/scgeneralpage.ui", rArgSet),
     360             :     aUnitArr(               ScResId(SCSTR_UNIT           )),
     361           0 :     pDoc(NULL)
     362             : {
     363           0 :     get( m_pUnitLB, "unitlb");
     364           0 :     get( m_pTabMF, "tabmf");
     365             : 
     366           0 :     get( m_pAlwaysRB, "alwaysrb");
     367           0 :     get( m_pRequestRB, "requestrb");
     368           0 :     get( m_pNeverRB, "neverrb");
     369             : 
     370           0 :     get( m_pAlignCB, "aligncb");
     371           0 :     get( m_pAlignLB, "alignlb");
     372           0 :     get( m_pEditModeCB, "editmodecb");
     373           0 :     get( m_pFormatCB, "formatcb");
     374           0 :     get( m_pExpRefCB, "exprefcb");
     375           0 :     get( m_pMarkHdrCB, "markhdrcb");
     376           0 :     get( m_pTextFmtCB, "textfmtcb");
     377           0 :     get( m_pReplWarnCB, "replwarncb");
     378           0 :     get( m_pLegacyCellSelectionCB, "legacy_cell_selection_cb");
     379             : 
     380           0 :     SetExchangeSupport();
     381             : 
     382           0 :     m_pUnitLB->SetSelectHdl( LINK( this, ScTpLayoutOptions, MetricHdl ) );
     383             : 
     384           0 :     m_pAlignCB->SetClickHdl(LINK(this, ScTpLayoutOptions, AlignHdl));
     385             : 
     386             : 
     387           0 :     for ( sal_uInt16 i = 0; i < aUnitArr.Count(); ++i )
     388             :     {
     389           0 :         OUString sMetric = aUnitArr.GetStringByPos( i );
     390           0 :         FieldUnit eFUnit = (FieldUnit)aUnitArr.GetValue( i );
     391             : 
     392           0 :         switch ( eFUnit )
     393             :         {
     394             :             case FUNIT_MM:
     395             :             case FUNIT_CM:
     396             :             case FUNIT_POINT:
     397             :             case FUNIT_PICA:
     398             :             case FUNIT_INCH:
     399             :             {
     400             :                 // nur diese Metriken benutzen
     401           0 :                 sal_Int32 nPos = m_pUnitLB->InsertEntry( sMetric );
     402           0 :                 m_pUnitLB->SetEntryData( nPos, (void*)(sal_IntPtr)eFUnit );
     403             :             }
     404           0 :             break;
     405             :             default:
     406             :             {
     407             :                 // added to avoid warnings
     408             :             }
     409             :         }
     410           0 :     }
     411             : 
     412           0 : }
     413             : 
     414           0 : ScTpLayoutOptions::~ScTpLayoutOptions()
     415             : {
     416           0 : }
     417             : 
     418           0 : SfxTabPage* ScTpLayoutOptions::Create( Window*          pParent,
     419             :                                     const SfxItemSet&   rCoreSet )
     420             : {
     421           0 :     ScTpLayoutOptions* pNew = new ScTpLayoutOptions(pParent, rCoreSet);
     422           0 :     ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current());
     423             : 
     424           0 :     if(pDocSh!=NULL)
     425           0 :         pNew->SetDocument(pDocSh->GetDocument());
     426           0 :     return pNew;
     427             : }
     428             : 
     429           0 : bool    ScTpLayoutOptions::FillItemSet( SfxItemSet& rCoreSet )
     430             : {
     431           0 :     sal_Bool bRet = sal_True;
     432           0 :     const sal_Int32 nMPos = m_pUnitLB->GetSelectEntryPos();
     433           0 :     if ( nMPos != m_pUnitLB->GetSavedValue() )
     434             :     {
     435           0 :         sal_uInt16 nFieldUnit = (sal_uInt16)(sal_IntPtr)m_pUnitLB->GetEntryData( nMPos );
     436             :         rCoreSet.Put( SfxUInt16Item( SID_ATTR_METRIC,
     437           0 :                                      (sal_uInt16)nFieldUnit ) );
     438           0 :         bRet = sal_True;
     439             :     }
     440             : 
     441           0 :     if(m_pTabMF->GetText() != m_pTabMF->GetSavedValue())
     442             :     {
     443             :         rCoreSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP,
     444           0 :                     sal::static_int_cast<sal_uInt16>( m_pTabMF->Denormalize(m_pTabMF->GetValue(FUNIT_TWIP)) )));
     445           0 :         bRet = sal_True;
     446             :     }
     447             : 
     448           0 :     ScLkUpdMode nSet=LM_ALWAYS;
     449             : 
     450           0 :     if(m_pRequestRB->IsChecked())
     451             :     {
     452           0 :         nSet=LM_ON_DEMAND;
     453             :     }
     454           0 :     else if(m_pNeverRB->IsChecked())
     455             :     {
     456           0 :         nSet=LM_NEVER;
     457             :     }
     458             : 
     459           0 :     if(m_pRequestRB->IsChecked() != m_pRequestRB->GetSavedValue() ||
     460           0 :             m_pNeverRB->IsChecked() != m_pNeverRB->GetSavedValue() )
     461             :     {
     462           0 :         if(pDoc)
     463           0 :             pDoc->SetLinkMode(nSet);
     464           0 :         ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
     465           0 :         aAppOptions.SetLinkMode(nSet );
     466           0 :         SC_MOD()->SetAppOptions(aAppOptions);
     467           0 :         bRet = sal_True;
     468             :     }
     469           0 :     if(m_pAlignCB->GetSavedValue() != TriState(m_pAlignCB->IsChecked()))
     470             :     {
     471           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_SELECTION, m_pAlignCB->IsChecked()));
     472           0 :         bRet = sal_True;
     473             :     }
     474             : 
     475           0 :     if(m_pAlignLB->GetSavedValue() != m_pAlignLB->GetSelectEntryPos())
     476             :     {
     477           0 :         rCoreSet.Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS, m_pAlignLB->GetSelectEntryPos()));
     478           0 :         bRet = sal_True;
     479             :     }
     480             : 
     481           0 :     if(m_pEditModeCB->GetSavedValue() != TriState(m_pEditModeCB->IsChecked()))
     482             :     {
     483           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_EDITMODE, m_pEditModeCB->IsChecked()));
     484           0 :         bRet = sal_True;
     485             :     }
     486             : 
     487           0 :     if(m_pFormatCB->GetSavedValue() != TriState(m_pFormatCB->IsChecked()))
     488             :     {
     489           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND, m_pFormatCB->IsChecked()));
     490           0 :         bRet = sal_True;
     491             :     }
     492             : 
     493             : 
     494           0 :     if(m_pExpRefCB->GetSavedValue() != TriState(m_pExpRefCB->IsChecked()))
     495             :     {
     496           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND, m_pExpRefCB->IsChecked()));
     497           0 :         bRet = sal_True;
     498             :     }
     499             : 
     500           0 :     if(m_pMarkHdrCB->GetSavedValue() != TriState(m_pMarkHdrCB->IsChecked()))
     501             :     {
     502           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER, m_pMarkHdrCB->IsChecked()));
     503           0 :         bRet = sal_True;
     504             :     }
     505             : 
     506           0 :     if(m_pTextFmtCB->GetSavedValue() != TriState(m_pTextFmtCB->IsChecked()))
     507             :     {
     508           0 :         rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG, m_pTextFmtCB->IsChecked()));
     509           0 :         bRet = sal_True;
     510             :     }
     511             : 
     512           0 :     if( m_pReplWarnCB->GetSavedValue() != TriState(m_pReplWarnCB->IsChecked()) )
     513             :     {
     514           0 :         rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, m_pReplWarnCB->IsChecked() ) );
     515           0 :         bRet = sal_True;
     516             :     }
     517             : 
     518           0 :     if( m_pLegacyCellSelectionCB->GetSavedValue() != TriState(m_pLegacyCellSelectionCB->IsChecked()) )
     519             :     {
     520           0 :         rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION, m_pLegacyCellSelectionCB->IsChecked() ) );
     521           0 :         bRet = sal_True;
     522             :     }
     523             : 
     524           0 :     return bRet;
     525             : }
     526             : 
     527           0 : void    ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet )
     528             : {
     529           0 :     m_pUnitLB->SetNoSelection();
     530           0 :     if ( rCoreSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
     531             :     {
     532           0 :         const SfxUInt16Item& rItem = (SfxUInt16Item&)rCoreSet.Get( SID_ATTR_METRIC );
     533           0 :         FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
     534             : 
     535           0 :         for ( sal_Int32 i = 0; i < m_pUnitLB->GetEntryCount(); ++i )
     536             :         {
     537           0 :             if ( (FieldUnit)(sal_IntPtr)m_pUnitLB->GetEntryData( i ) == eFieldUnit )
     538             :             {
     539           0 :                 m_pUnitLB->SelectEntryPos( i );
     540           0 :                 break;
     541             :             }
     542             :         }
     543           0 :         ::SetFieldUnit(*m_pTabMF, eFieldUnit);
     544             :     }
     545           0 :     m_pUnitLB->SaveValue();
     546             : 
     547             :     const SfxPoolItem* pItem;
     548           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem))
     549           0 :         m_pTabMF->SetValue(m_pTabMF->Normalize(((SfxUInt16Item*)pItem)->GetValue()), FUNIT_TWIP);
     550           0 :     m_pTabMF->SaveValue();
     551             : 
     552           0 :     m_pUnitLB       ->SaveValue();
     553           0 :     m_pTabMF        ->SaveValue();
     554             : 
     555           0 :     ScLkUpdMode nSet=LM_UNKNOWN;
     556             : 
     557           0 :     if(pDoc!=NULL)
     558             :     {
     559           0 :         nSet=pDoc->GetLinkMode();
     560             :     }
     561             : 
     562           0 :     if(nSet==LM_UNKNOWN)
     563             :     {
     564           0 :         ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
     565           0 :         nSet=aAppOptions.GetLinkMode();
     566             :     }
     567             : 
     568           0 :     switch(nSet)
     569             :     {
     570           0 :         case LM_ALWAYS:     m_pAlwaysRB->  Check();    break;
     571           0 :         case LM_NEVER:      m_pNeverRB->   Check();    break;
     572           0 :         case LM_ON_DEMAND:  m_pRequestRB-> Check();    break;
     573             :         default:
     574             :         {
     575             :             // added to avoid warnings
     576             :         }
     577             :     }
     578           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTION, false, &pItem))
     579           0 :         m_pAlignCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     580             : 
     581           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTIONPOS, false, &pItem))
     582           0 :         m_pAlignLB->SelectEntryPos(((const SfxUInt16Item*)pItem)->GetValue());
     583             : 
     584           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_EDITMODE, false, &pItem))
     585           0 :         m_pEditModeCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     586             : 
     587           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_FMT_EXPAND, false, &pItem))
     588           0 :         m_pFormatCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     589             : 
     590             : 
     591           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_REF_EXPAND, false, &pItem))
     592           0 :         m_pExpRefCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     593             : 
     594           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_MARK_HEADER, false, &pItem))
     595           0 :         m_pMarkHdrCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     596             : 
     597           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_TEXTWYSIWYG, false, &pItem))
     598           0 :         m_pTextFmtCB->Check(((const SfxBoolItem*)pItem)->GetValue());
     599             : 
     600           0 :     if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_REPLCELLSWARN, false, &pItem ) )
     601           0 :         m_pReplWarnCB->Check( ( (const SfxBoolItem*)pItem)->GetValue() );
     602             : 
     603           0 :     if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_LEGACY_CELL_SELECTION, false, &pItem ) )
     604           0 :         m_pLegacyCellSelectionCB->Check( ( (const SfxBoolItem*)pItem)->GetValue() );
     605             : 
     606             : 
     607           0 :     m_pAlignCB    ->SaveValue();
     608           0 :     m_pAlignLB    ->SaveValue();
     609           0 :     m_pEditModeCB ->SaveValue();
     610           0 :     m_pFormatCB   ->SaveValue();
     611             : 
     612           0 :     m_pExpRefCB   ->SaveValue();
     613           0 :     m_pMarkHdrCB  ->SaveValue();
     614           0 :     m_pTextFmtCB  ->SaveValue();
     615           0 :     m_pReplWarnCB ->SaveValue();
     616             : 
     617           0 :     m_pLegacyCellSelectionCB->SaveValue();
     618             : 
     619           0 :     AlignHdl(m_pAlignCB);
     620             : 
     621           0 :     m_pAlwaysRB->SaveValue();
     622           0 :     m_pNeverRB->SaveValue();
     623           0 :     m_pRequestRB->SaveValue();
     624           0 : }
     625             : 
     626           0 : void    ScTpLayoutOptions::ActivatePage( const SfxItemSet& /* rCoreSet */ )
     627             : {
     628           0 : }
     629             : 
     630           0 : int ScTpLayoutOptions::DeactivatePage( SfxItemSet* pSetP )
     631             : {
     632           0 :     if(pSetP)
     633           0 :         FillItemSet(*pSetP);
     634           0 :     return SfxTabPage::LEAVE_PAGE;
     635             : }
     636             : 
     637           0 : IMPL_LINK_NOARG(ScTpLayoutOptions, MetricHdl)
     638             : {
     639           0 :     const sal_Int32 nMPos = m_pUnitLB->GetSelectEntryPos();
     640           0 :     if(nMPos != LISTBOX_ENTRY_NOTFOUND)
     641             :     {
     642           0 :         FieldUnit eFieldUnit = (FieldUnit)(sal_IntPtr)m_pUnitLB->GetEntryData( nMPos );
     643             :         sal_Int64 nVal =
     644           0 :             m_pTabMF->Denormalize( m_pTabMF->GetValue( FUNIT_TWIP ) );
     645           0 :         ::SetFieldUnit( *m_pTabMF, eFieldUnit );
     646           0 :         m_pTabMF->SetValue( m_pTabMF->Normalize( nVal ), FUNIT_TWIP );
     647             :     }
     648             : 
     649           0 :     return 0;
     650             : }
     651             : 
     652           0 : IMPL_LINK( ScTpLayoutOptions, AlignHdl, CheckBox*, pBox )
     653             : {
     654           0 :     m_pAlignLB->Enable(pBox->IsChecked());
     655           0 :     return 0;
     656           0 : }
     657             : 
     658             : 
     659             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10