LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/optdlg - opredlin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 94 0.0 %
Date: 2012-12-27 Functions: 0 10 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 <svx/dlgutil.hxx>
      28             : #include <svx/drawitem.hxx>
      29             : #include <svx/xtable.hxx>
      30             : 
      31             : #include "appoptio.hxx"
      32             : #include "scmod.hxx"
      33             : #include "scitems.hxx"
      34             : #include "tpview.hxx"
      35             : #include "global.hxx"
      36             : #include "viewopti.hxx"
      37             : #include "tabvwsh.hxx"
      38             : #include "uiitems.hxx"
      39             : #include "scresid.hxx"
      40             : #include "docsh.hxx"
      41             : #include "sc.hrc"       // -> Slot-IDs
      42             : #include "optdlg.hrc"
      43             : #include "globstr.hrc"
      44             : 
      45             : #include "opredlin.hxx"
      46             : #include "opredlin.hrc"
      47             : 
      48             : //------------------------------------------------------------------
      49             : 
      50           0 : ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( Window* pParent,
      51             :                                                     const SfxItemSet& rSet )
      52             :     : SfxTabPage(pParent, ScResId(RID_SCPAGE_OPREDLINE), rSet),
      53             :     aContentFT      ( this, ScResId(FT_CONTENT  )),
      54             :     aContentColorLB ( this, ScResId(CLB_CONTENT )),
      55             :     aRemoveFT       ( this, ScResId(FT_REMOVE   )),
      56             :     aRemoveColorLB  ( this, ScResId(CLB_REMOVE  )),
      57             :     aInsertFT       ( this, ScResId(FT_INSERT   )),
      58             :     aInsertColorLB  ( this, ScResId(CLB_INSERT  )),
      59             :     aMoveFT         ( this, ScResId(FT_MOVE     )),
      60             :     aMoveColorLB    ( this, ScResId(CLB_MOVE    )),
      61             :     aChangedGB      ( this, ScResId(GB_COLORCHGS)),
      62           0 :     aAuthorStr      (ScResId(STR_AUTHOR))
      63             : {
      64           0 :     FreeResource();
      65             : 
      66           0 :     Link aLk = LINK(this, ScRedlineOptionsTabPage, ColorHdl);
      67           0 :     aContentColorLB.SetSelectHdl( aLk );
      68           0 :     aMoveColorLB.SetSelectHdl( aLk );
      69           0 :     aInsertColorLB.SetSelectHdl( aLk );
      70           0 :     aRemoveColorLB.SetSelectHdl( aLk );
      71           0 : }
      72             : 
      73           0 : ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage()
      74             : {
      75           0 : }
      76             : 
      77           0 : SfxTabPage* ScRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet )
      78             : {
      79           0 :     return new ScRedlineOptionsTabPage( pParent, rSet );
      80             : }
      81             : 
      82           0 : sal_Bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet& /* rSet */ )
      83             : {
      84           0 :     ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
      85             : 
      86           0 :     sal_uLong nNew=0;
      87           0 :     sal_uInt16 nPos=0;
      88             : 
      89           0 :     nPos = aContentColorLB.GetSelectEntryPos();
      90           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
      91             :     {
      92           0 :         nPos = aContentColorLB.GetSelectEntryPos();
      93           0 :         if (nPos!=0)
      94           0 :             nNew= aContentColorLB.GetEntryColor(nPos).GetColor();
      95             :         else
      96           0 :             nNew= COL_TRANSPARENT;
      97             : 
      98           0 :         aAppOptions.SetTrackContentColor(nNew);
      99             : 
     100             :     }
     101           0 :     nPos = aMoveColorLB.GetSelectEntryPos();
     102           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
     103             :     {
     104           0 :         nPos = aMoveColorLB.GetSelectEntryPos();
     105           0 :         if (nPos!=0)
     106           0 :             nNew= aMoveColorLB.GetEntryColor(nPos).GetColor();
     107             :         else
     108           0 :             nNew= COL_TRANSPARENT;
     109             : 
     110           0 :         aAppOptions.SetTrackMoveColor(nNew);
     111             : 
     112             :     }
     113           0 :     nPos = aInsertColorLB.GetSelectEntryPos();
     114           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
     115             :     {
     116           0 :         nPos = aInsertColorLB.GetSelectEntryPos();
     117           0 :         if (nPos!=0)
     118           0 :             nNew= aInsertColorLB.GetEntryColor(nPos).GetColor();
     119             :         else
     120           0 :             nNew= COL_TRANSPARENT;
     121             : 
     122           0 :         aAppOptions.SetTrackInsertColor(nNew);
     123             : 
     124             :     }
     125           0 :     nPos = aRemoveColorLB.GetSelectEntryPos();
     126           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
     127             :     {
     128           0 :         nPos = aRemoveColorLB.GetSelectEntryPos();
     129           0 :         if (nPos!=0)
     130           0 :             nNew= aRemoveColorLB.GetEntryColor(nPos).GetColor();
     131             :         else
     132           0 :             nNew= COL_TRANSPARENT;
     133             : 
     134           0 :         aAppOptions.SetTrackDeleteColor(nNew);
     135             : 
     136             :     }
     137             : 
     138           0 :     SC_MOD()->SetAppOptions(aAppOptions);
     139             : 
     140             :     //  Repaint (wenn alles ueber Items laufen wuerde, wie es sich gehoert,
     141             :     //  waere das nicht noetig...)
     142           0 :     ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
     143           0 :     if (pDocSh)
     144           0 :         pDocSh->PostPaintGridAll();
     145             : 
     146           0 :     return false;
     147             : }
     148             : 
     149           0 : void ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
     150             : {
     151           0 :     aContentColorLB.InsertEntry(aAuthorStr);
     152           0 :     aMoveColorLB.InsertEntry(aAuthorStr);
     153           0 :     aInsertColorLB.InsertEntry(aAuthorStr);
     154           0 :     aRemoveColorLB.InsertEntry(aAuthorStr);
     155             : 
     156           0 :     aContentColorLB.SetUpdateMode( false);
     157           0 :     aMoveColorLB.SetUpdateMode( false);
     158           0 :     aInsertColorLB.SetUpdateMode( false);
     159           0 :     aRemoveColorLB.SetUpdateMode( false);
     160             : 
     161           0 :     XColorListRef xColorLst = XColorList::GetStdColorList();
     162           0 :     for( sal_uInt16 i = 0; i < xColorLst->Count(); ++i )
     163             :     {
     164           0 :         XColorEntry* pEntry = xColorLst->GetColor( i );
     165           0 :         Color aColor = pEntry->GetColor();
     166           0 :         String sName = pEntry->GetName();
     167             : 
     168           0 :         aContentColorLB.InsertEntry( aColor, sName );
     169           0 :         aMoveColorLB.InsertEntry( aColor, sName );
     170           0 :         aInsertColorLB.InsertEntry( aColor, sName );
     171           0 :         aRemoveColorLB.InsertEntry( aColor, sName );
     172           0 :     }
     173           0 :     aContentColorLB.SetUpdateMode( sal_True );
     174           0 :     aMoveColorLB.SetUpdateMode( sal_True );
     175           0 :     aInsertColorLB.SetUpdateMode( sal_True );
     176           0 :     aRemoveColorLB.SetUpdateMode( sal_True );
     177             : 
     178             : 
     179           0 :     ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
     180             : 
     181           0 :     sal_uLong nColor = aAppOptions.GetTrackContentColor();
     182           0 :     if (nColor == COL_TRANSPARENT)
     183           0 :         aContentColorLB.SelectEntryPos(0);
     184             :     else
     185           0 :         aContentColorLB.SelectEntry(Color(nColor));
     186             : 
     187           0 :     nColor = aAppOptions.GetTrackMoveColor();
     188           0 :     if (nColor == COL_TRANSPARENT)
     189           0 :         aMoveColorLB.SelectEntryPos(0);
     190             :     else
     191           0 :         aMoveColorLB.SelectEntry(Color(nColor));
     192             : 
     193             : 
     194           0 :     nColor = aAppOptions.GetTrackInsertColor();
     195           0 :     if (nColor == COL_TRANSPARENT)
     196           0 :         aInsertColorLB.SelectEntryPos(0);
     197             :     else
     198           0 :         aInsertColorLB.SelectEntry(Color(nColor));
     199             : 
     200             : 
     201           0 :     nColor = aAppOptions.GetTrackDeleteColor();
     202           0 :     if (nColor == COL_TRANSPARENT)
     203           0 :         aRemoveColorLB.SelectEntryPos(0);
     204             :     else
     205           0 :         aRemoveColorLB.SelectEntry(Color(nColor));
     206             : 
     207           0 : }
     208             : 
     209             : 
     210           0 : IMPL_LINK_NOARG(ScRedlineOptionsTabPage, ColorHdl)
     211             : {
     212           0 :     return 0;
     213           0 : }
     214             : 
     215             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10