1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 #include "auditsh.hxx"
28 #include "tabvwsh.hxx"
29 #include "scresid.hxx"
31 #include "document.hxx"
33 //------------------------------------------------------------------------
35 #define ScAuditingShell
36 #include "scslots.hxx"
38 //------------------------------------------------------------------------
40 TYPEINIT1( ScAuditingShell
, SfxShell
);
42 SFX_IMPL_INTERFACE(ScAuditingShell
, SfxShell
, ScResId(SCSTR_AUDITSHELL
))
44 SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_AUDIT
) );
48 //------------------------------------------------------------------------
50 ScAuditingShell::ScAuditingShell(ScViewData
* pData
) :
51 SfxShell(pData
->GetViewShell()),
53 nFunction( SID_FILL_ADD_PRED
)
55 SetPool( &pViewData
->GetViewShell()->GetPool() );
56 ::svl::IUndoManager
* pMgr
= pViewData
->GetSfxDocShell()->GetUndoManager();
57 SetUndoManager( pMgr
);
58 if ( !pViewData
->GetDocument()->IsUndoEnabled() )
60 pMgr
->SetMaxUndoActionCount( 0 );
62 SetHelpId( HID_SCSHELL_AUDIT
);
63 SetName(rtl::OUString("Auditing"));
66 //------------------------------------------------------------------------
68 ScAuditingShell::~ScAuditingShell()
72 //------------------------------------------------------------------------
74 void ScAuditingShell::Execute( SfxRequest
& rReq
)
76 SfxBindings
& rBindings
= pViewData
->GetBindings();
77 sal_uInt16 nSlot
= rReq
.GetSlot();
80 case SID_FILL_ADD_PRED
:
81 case SID_FILL_DEL_PRED
:
82 case SID_FILL_ADD_SUCC
:
83 case SID_FILL_DEL_SUCC
:
85 rBindings
.Invalidate( SID_FILL_ADD_PRED
);
86 rBindings
.Invalidate( SID_FILL_DEL_PRED
);
87 rBindings
.Invalidate( SID_FILL_ADD_SUCC
);
88 rBindings
.Invalidate( SID_FILL_DEL_SUCC
);
90 case SID_CANCEL
: // Escape
92 pViewData
->GetViewShell()->SetAuditShell( false );
97 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
100 const SfxPoolItem
* pXItem
;
101 const SfxPoolItem
* pYItem
;
102 if ( pReqArgs
->GetItemState( SID_RANGE_COL
, sal_True
, &pXItem
) == SFX_ITEM_SET
103 && pReqArgs
->GetItemState( SID_RANGE_ROW
, sal_True
, &pYItem
) == SFX_ITEM_SET
)
105 OSL_ENSURE( pXItem
->ISA(SfxInt16Item
) && pYItem
->ISA(SfxInt32Item
),
107 SCsCOL nCol
= static_cast<SCsCOL
>(((const SfxInt16Item
*) pXItem
)->GetValue());
108 SCsROW nRow
= static_cast<SCsROW
>(((const SfxInt32Item
*) pYItem
)->GetValue());
109 ScViewFunc
* pView
= pViewData
->GetView();
110 pView
->MoveCursorAbs( nCol
, nRow
, SC_FOLLOW_LINE
, false, false );
113 case SID_FILL_ADD_PRED
:
114 pView
->DetectiveAddPred();
116 case SID_FILL_DEL_PRED
:
117 pView
->DetectiveDelPred();
119 case SID_FILL_ADD_SUCC
:
120 pView
->DetectiveAddSucc();
122 case SID_FILL_DEL_SUCC
:
123 pView
->DetectiveDelSucc();
133 //------------------------------------------------------------------------
135 void ScAuditingShell::GetState( SfxItemSet
& rSet
)
137 rSet
.Put( SfxBoolItem( nFunction
, sal_True
) ); // aktive Funktion markieren
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */