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