LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/view - auditsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 51 7.8 %
Date: 2012-12-27 Functions: 5 16 31.2 %
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             : #include "scitems.hxx"
      21             : #include <svl/srchitem.hxx>
      22             : #include <sfx2/bindings.hxx>
      23             : #include <sfx2/objface.hxx>
      24             : #include <sfx2/objsh.hxx>
      25             : #include <sfx2/request.hxx>
      26             : 
      27             : #include "auditsh.hxx"
      28             : #include "tabvwsh.hxx"
      29             : #include "scresid.hxx"
      30             : #include "sc.hrc"
      31             : #include "document.hxx"
      32             : 
      33             : //------------------------------------------------------------------------
      34             : 
      35             : #define ScAuditingShell
      36             : #include "scslots.hxx"
      37             : 
      38             : //------------------------------------------------------------------------
      39             : 
      40           0 : TYPEINIT1( ScAuditingShell, SfxShell );
      41             : 
      42          20 : SFX_IMPL_INTERFACE(ScAuditingShell, SfxShell, ScResId(SCSTR_AUDITSHELL))
      43             : {
      44           5 :     SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_AUDIT) );
      45           5 : }
      46             : 
      47             : 
      48             : //------------------------------------------------------------------------
      49             : 
      50           0 : ScAuditingShell::ScAuditingShell(ScViewData* pData) :
      51           0 :     SfxShell(pData->GetViewShell()),
      52             :     pViewData( pData ),
      53           0 :     nFunction( SID_FILL_ADD_PRED )
      54             : {
      55           0 :     SetPool( &pViewData->GetViewShell()->GetPool() );
      56           0 :     ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
      57           0 :     SetUndoManager( pMgr );
      58           0 :     if ( !pViewData->GetDocument()->IsUndoEnabled() )
      59             :     {
      60           0 :         pMgr->SetMaxUndoActionCount( 0 );
      61             :     }
      62           0 :     SetHelpId( HID_SCSHELL_AUDIT );
      63           0 :     SetName(rtl::OUString("Auditing"));
      64           0 : }
      65             : 
      66             : //------------------------------------------------------------------------
      67             : 
      68           0 : ScAuditingShell::~ScAuditingShell()
      69             : {
      70           0 : }
      71             : 
      72             : //------------------------------------------------------------------------
      73             : 
      74           0 : void ScAuditingShell::Execute( SfxRequest& rReq )
      75             : {
      76           0 :     SfxBindings& rBindings = pViewData->GetBindings();
      77           0 :     sal_uInt16 nSlot = rReq.GetSlot();
      78           0 :     switch ( nSlot )
      79             :     {
      80             :         case SID_FILL_ADD_PRED:
      81             :         case SID_FILL_DEL_PRED:
      82             :         case SID_FILL_ADD_SUCC:
      83             :         case SID_FILL_DEL_SUCC:
      84           0 :             nFunction = nSlot;
      85           0 :             rBindings.Invalidate( SID_FILL_ADD_PRED );
      86           0 :             rBindings.Invalidate( SID_FILL_DEL_PRED );
      87           0 :             rBindings.Invalidate( SID_FILL_ADD_SUCC );
      88           0 :             rBindings.Invalidate( SID_FILL_DEL_SUCC );
      89           0 :             break;
      90             :         case SID_CANCEL:        // Escape
      91             :         case SID_FILL_NONE:
      92           0 :             pViewData->GetViewShell()->SetAuditShell( false );
      93           0 :             break;
      94             : 
      95             :         case SID_FILL_SELECT:
      96             :             {
      97           0 :                 const SfxItemSet* pReqArgs = rReq.GetArgs();
      98           0 :                 if ( pReqArgs )
      99             :                 {
     100             :                     const SfxPoolItem* pXItem;
     101             :                     const SfxPoolItem* pYItem;
     102           0 :                     if ( pReqArgs->GetItemState( SID_RANGE_COL, sal_True, &pXItem ) == SFX_ITEM_SET
     103           0 :                       && pReqArgs->GetItemState( SID_RANGE_ROW, sal_True, &pYItem ) == SFX_ITEM_SET )
     104             :                     {
     105             :                         OSL_ENSURE( pXItem->ISA(SfxInt16Item) && pYItem->ISA(SfxInt32Item),
     106             :                                         "wrong items" );
     107           0 :                         SCsCOL nCol = static_cast<SCsCOL>(((const SfxInt16Item*) pXItem)->GetValue());
     108           0 :                         SCsROW nRow = static_cast<SCsROW>(((const SfxInt32Item*) pYItem)->GetValue());
     109           0 :                         ScViewFunc* pView = pViewData->GetView();
     110           0 :                         pView->MoveCursorAbs( nCol, nRow, SC_FOLLOW_LINE, false, false );
     111           0 :                         switch ( nFunction )
     112             :                         {
     113             :                             case SID_FILL_ADD_PRED:
     114           0 :                                 pView->DetectiveAddPred();
     115           0 :                                 break;
     116             :                             case SID_FILL_DEL_PRED:
     117           0 :                                 pView->DetectiveDelPred();
     118           0 :                                 break;
     119             :                             case SID_FILL_ADD_SUCC:
     120           0 :                                 pView->DetectiveAddSucc();
     121           0 :                                 break;
     122             :                             case SID_FILL_DEL_SUCC:
     123           0 :                                 pView->DetectiveDelSucc();
     124           0 :                                 break;
     125             :                         }
     126             :                     }
     127             :                 }
     128             :             }
     129           0 :             break;
     130             :     }
     131           0 : }
     132             : 
     133             : //------------------------------------------------------------------------
     134             : 
     135           0 : void ScAuditingShell::GetState( SfxItemSet& rSet )
     136             : {
     137           0 :     rSet.Put( SfxBoolItem( nFunction, sal_True ) );         // aktive Funktion markieren
     138          15 : }
     139             : 
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10