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

Generated by: LCOV version 1.10