Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "scitems.hxx"
30 : : #include <svl/srchitem.hxx>
31 : : #include <sfx2/bindings.hxx>
32 : : #include <sfx2/objface.hxx>
33 : : #include <sfx2/objsh.hxx>
34 : : #include <sfx2/request.hxx>
35 : :
36 : : #include "auditsh.hxx"
37 : : #include "tabvwsh.hxx"
38 : : #include "scresid.hxx"
39 : : #include "sc.hrc"
40 : : #include "document.hxx"
41 : :
42 : : //------------------------------------------------------------------------
43 : :
44 : : #define ScAuditingShell
45 : : #include "scslots.hxx"
46 : :
47 : : //------------------------------------------------------------------------
48 : :
49 [ # # ][ # # ]: 0 : TYPEINIT1( ScAuditingShell, SfxShell );
50 : :
51 [ + + ][ + - ]: 153 : SFX_IMPL_INTERFACE(ScAuditingShell, SfxShell, ScResId(SCSTR_AUDITSHELL))
[ + - ]
52 : : {
53 [ + - ][ + - ]: 51 : SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_AUDIT) );
54 : 51 : }
55 : :
56 : :
57 : : //------------------------------------------------------------------------
58 : :
59 : 0 : ScAuditingShell::ScAuditingShell(ScViewData* pData) :
60 : 0 : SfxShell(pData->GetViewShell()),
61 : : pViewData( pData ),
62 : 0 : nFunction( SID_FILL_ADD_PRED )
63 : : {
64 : 0 : SetPool( &pViewData->GetViewShell()->GetPool() );
65 [ # # ][ # # ]: 0 : ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
66 [ # # ]: 0 : SetUndoManager( pMgr );
67 [ # # ][ # # ]: 0 : if ( !pViewData->GetDocument()->IsUndoEnabled() )
68 : : {
69 [ # # ]: 0 : pMgr->SetMaxUndoActionCount( 0 );
70 : : }
71 [ # # ]: 0 : SetHelpId( HID_SCSHELL_AUDIT );
72 [ # # ][ # # ]: 0 : SetName(rtl::OUString("Auditing"));
[ # # ]
73 : 0 : }
74 : :
75 : : //------------------------------------------------------------------------
76 : :
77 : 0 : ScAuditingShell::~ScAuditingShell()
78 : : {
79 [ # # ]: 0 : }
80 : :
81 : : //------------------------------------------------------------------------
82 : :
83 : 0 : void ScAuditingShell::Execute( SfxRequest& rReq )
84 : : {
85 : 0 : SfxBindings& rBindings = pViewData->GetBindings();
86 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
87 [ # # # # ]: 0 : switch ( nSlot )
88 : : {
89 : : case SID_FILL_ADD_PRED:
90 : : case SID_FILL_DEL_PRED:
91 : : case SID_FILL_ADD_SUCC:
92 : : case SID_FILL_DEL_SUCC:
93 : 0 : nFunction = nSlot;
94 : 0 : rBindings.Invalidate( SID_FILL_ADD_PRED );
95 : 0 : rBindings.Invalidate( SID_FILL_DEL_PRED );
96 : 0 : rBindings.Invalidate( SID_FILL_ADD_SUCC );
97 : 0 : rBindings.Invalidate( SID_FILL_DEL_SUCC );
98 : 0 : break;
99 : : case SID_CANCEL: // Escape
100 : : case SID_FILL_NONE:
101 : 0 : pViewData->GetViewShell()->SetAuditShell( false );
102 : 0 : break;
103 : :
104 : : case SID_FILL_SELECT:
105 : : {
106 : 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
107 [ # # ]: 0 : if ( pReqArgs )
108 : : {
109 : : const SfxPoolItem* pXItem;
110 : : const SfxPoolItem* pYItem;
111 [ # # ][ # # ]: 0 : if ( pReqArgs->GetItemState( SID_RANGE_COL, sal_True, &pXItem ) == SFX_ITEM_SET
[ # # ][ # # ]
112 [ # # ]: 0 : && pReqArgs->GetItemState( SID_RANGE_ROW, sal_True, &pYItem ) == SFX_ITEM_SET )
113 : : {
114 : : OSL_ENSURE( pXItem->ISA(SfxInt16Item) && pYItem->ISA(SfxInt32Item),
115 : : "wrong items" );
116 : 0 : SCsCOL nCol = static_cast<SCsCOL>(((const SfxInt16Item*) pXItem)->GetValue());
117 : 0 : SCsROW nRow = static_cast<SCsROW>(((const SfxInt32Item*) pYItem)->GetValue());
118 [ # # ]: 0 : ScViewFunc* pView = pViewData->GetView();
119 [ # # ]: 0 : pView->MoveCursorAbs( nCol, nRow, SC_FOLLOW_LINE, false, false );
120 [ # # # # : 0 : switch ( nFunction )
# ]
121 : : {
122 : : case SID_FILL_ADD_PRED:
123 [ # # ]: 0 : pView->DetectiveAddPred();
124 : 0 : break;
125 : : case SID_FILL_DEL_PRED:
126 [ # # ]: 0 : pView->DetectiveDelPred();
127 : 0 : break;
128 : : case SID_FILL_ADD_SUCC:
129 [ # # ]: 0 : pView->DetectiveAddSucc();
130 : 0 : break;
131 : : case SID_FILL_DEL_SUCC:
132 [ # # ]: 0 : pView->DetectiveDelSucc();
133 : 0 : break;
134 : : }
135 : : }
136 : : }
137 : : }
138 : 0 : break;
139 : : }
140 : 0 : }
141 : :
142 : : //------------------------------------------------------------------------
143 : :
144 : 0 : void ScAuditingShell::GetState( SfxItemSet& rSet )
145 : : {
146 [ # # ]: 0 : rSet.Put( SfxBoolItem( nFunction, sal_True ) ); // aktive Funktion markieren
147 : 0 : }
148 : :
149 : :
150 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|