LCOV - code coverage report
Current view: top level - sc/source/ui/optdlg - opredlin.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 93 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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           0 : }
      51             : 
      52           0 : ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage()
      53             : {
      54           0 :     disposeOnce();
      55           0 : }
      56             : 
      57           0 : void ScRedlineOptionsTabPage::dispose()
      58             : {
      59           0 :     m_pContentColorLB.clear();
      60           0 :     m_pRemoveColorLB.clear();
      61           0 :     m_pInsertColorLB.clear();
      62           0 :     m_pMoveColorLB.clear();
      63           0 :     SfxTabPage::dispose();
      64           0 : }
      65             : 
      66           0 : VclPtr<SfxTabPage> ScRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
      67             : {
      68           0 :     return VclPtr<ScRedlineOptionsTabPage>::Create( 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( long 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           0 :     ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
     164             : 
     165           0 :     sal_uLong nColor = aAppOptions.GetTrackContentColor();
     166           0 :     if (nColor == COL_TRANSPARENT)
     167           0 :         m_pContentColorLB->SelectEntryPos(0);
     168             :     else
     169           0 :         m_pContentColorLB->SelectEntry(Color(nColor));
     170             : 
     171           0 :     nColor = aAppOptions.GetTrackMoveColor();
     172           0 :     if (nColor == COL_TRANSPARENT)
     173           0 :         m_pMoveColorLB->SelectEntryPos(0);
     174             :     else
     175           0 :         m_pMoveColorLB->SelectEntry(Color(nColor));
     176             : 
     177           0 :     nColor = aAppOptions.GetTrackInsertColor();
     178           0 :     if (nColor == COL_TRANSPARENT)
     179           0 :         m_pInsertColorLB->SelectEntryPos(0);
     180             :     else
     181           0 :         m_pInsertColorLB->SelectEntry(Color(nColor));
     182             : 
     183           0 :     nColor = aAppOptions.GetTrackDeleteColor();
     184           0 :     if (nColor == COL_TRANSPARENT)
     185           0 :         m_pRemoveColorLB->SelectEntryPos(0);
     186             :     else
     187           0 :         m_pRemoveColorLB->SelectEntry(Color(nColor));
     188             : 
     189           0 : }
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11