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

Generated by: LCOV version 1.10