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

Generated by: LCOV version 1.10