LibreOffice Module sc (master) 1
auditsh.cxx
Go to the documentation of this file.
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 <sfx2/bindings.hxx>
21#include <sfx2/objface.hxx>
22#include <sfx2/objsh.hxx>
23#include <sfx2/request.hxx>
24#include <vcl/EnumContext.hxx>
25
26#include <auditsh.hxx>
27#include <tabvwsh.hxx>
28#include <sc.hrc>
29#include <document.hxx>
30
31#define ShellClass_ScAuditingShell
32#include <scslots.hxx>
33
34
36
37void ScAuditingShell::InitInterface_Impl()
38{
39 GetStaticInterface()->RegisterPopupMenu("audit");
40}
41
43 SfxShell(rData.GetViewShell()),
44 rViewData( rData ),
45 nFunction( SID_FILL_ADD_PRED )
46{
49 SetUndoManager( pMgr );
51 {
52 pMgr->SetMaxUndoActionCount( 0 );
53 }
54 SetName("Auditing");
56}
57
59{
60}
61
63{
64 SfxBindings& rBindings = rViewData.GetBindings();
65 sal_uInt16 nSlot = rReq.GetSlot();
66 switch ( nSlot )
67 {
68 case SID_FILL_ADD_PRED:
69 case SID_FILL_DEL_PRED:
70 case SID_FILL_ADD_SUCC:
71 case SID_FILL_DEL_SUCC:
72 nFunction = nSlot;
73 rBindings.Invalidate( SID_FILL_ADD_PRED );
74 rBindings.Invalidate( SID_FILL_DEL_PRED );
75 rBindings.Invalidate( SID_FILL_ADD_SUCC );
76 rBindings.Invalidate( SID_FILL_DEL_SUCC );
77 break;
78 case SID_CANCEL: // Escape
79 case SID_FILL_NONE:
81 break;
82
83 case SID_FILL_SELECT:
84 {
85 const SfxItemSet* pReqArgs = rReq.GetArgs();
86 if ( pReqArgs )
87 {
88 const SfxInt16Item* pXItem = pReqArgs->GetItemIfSet( SID_RANGE_COL );
89 const SfxInt32Item* pYItem = pReqArgs->GetItemIfSet( SID_RANGE_ROW );
90 if ( pXItem && pYItem )
91 {
92 SCCOL nCol = static_cast<SCCOL>(pXItem->GetValue());
93 SCROW nRow = static_cast<SCROW>(pYItem->GetValue());
94 ScViewFunc* pView = rViewData.GetView();
95 pView->MoveCursorAbs( nCol, nRow, SC_FOLLOW_LINE, false, false );
96 switch ( nFunction )
97 {
98 case SID_FILL_ADD_PRED:
99 pView->DetectiveAddPred();
100 break;
101 case SID_FILL_DEL_PRED:
102 pView->DetectiveDelPred();
103 break;
104 case SID_FILL_ADD_SUCC:
105 pView->DetectiveAddSucc();
106 break;
107 case SID_FILL_DEL_SUCC:
108 pView->DetectiveDelSucc();
109 break;
110 }
111 }
112 }
113 }
114 break;
115 }
116}
117
119{
120 rSet.Put( SfxBoolItem( nFunction, true ) ); // mark active functions
121}
122
123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetValue() const
virtual ~ScAuditingShell() override
Definition: auditsh.cxx:58
sal_uInt16 nFunction
Definition: auditsh.hxx:32
ScViewData & rViewData
Definition: auditsh.hxx:31
ScAuditingShell(ScViewData &rData)
Definition: auditsh.cxx:42
void Execute(const SfxRequest &rReq)
Definition: auditsh.cxx:62
void GetState(SfxItemSet &rSet)
Definition: auditsh.cxx:118
bool IsUndoEnabled() const
Definition: document.hxx:1593
void SetAuditShell(bool bActive)
Definition: tabvwsh4.cxx:714
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1194
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScDBFunc * GetView() const
Definition: viewdata.cxx:863
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
SfxBindings & GetBindings()
Definition: viewdata.cxx:3129
void DetectiveDelSucc()
Definition: viewfun6.cxx:92
void DetectiveDelPred()
Definition: viewfun6.cxx:78
void DetectiveAddPred()
Definition: viewfun6.cxx:71
void DetectiveAddSucc()
Definition: viewfun6.cxx:85
void Invalidate(sal_uInt16 nId)
sal_Int16 GetValue() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
virtual SfxUndoManager * GetUndoManager()
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
static const OUString & GetContextName(const Context eContext)
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
@ SC_FOLLOW_LINE
Definition: viewdata.hxx:52