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

Generated by: LCOV version 1.10