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