tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / view / auditsh.cxx
blobd1dcff0aa65fbfb923ec774f29cc2bcad741dced
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sfx2/bindings.hxx>
21 #include <sfx2/objface.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sfx2/request.hxx>
24 #include <vcl/EnumContext.hxx>
26 #include <auditsh.hxx>
27 #include <tabvwsh.hxx>
28 #include <sc.hrc>
29 #include <document.hxx>
31 #define ShellClass_ScAuditingShell
32 #include <scslots.hxx>
35 SFX_IMPL_INTERFACE(ScAuditingShell, SfxShell)
37 void ScAuditingShell::InitInterface_Impl()
39 GetStaticInterface()->RegisterPopupMenu(u"audit"_ustr);
42 ScAuditingShell::ScAuditingShell(ScViewData& rData) :
43 SfxShell(rData.GetViewShell()),
44 rViewData( rData ),
45 nFunction( SID_FILL_ADD_PRED )
47 SetPool( &rViewData.GetViewShell()->GetPool() );
48 SfxUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager();
49 SetUndoManager( pMgr );
50 if ( !rViewData.GetDocument().IsUndoEnabled() )
52 pMgr->SetMaxUndoActionCount( 0 );
54 SetName(u"Auditing"_ustr);
55 SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Auditing));
58 ScAuditingShell::~ScAuditingShell()
62 void ScAuditingShell::Execute( const SfxRequest& rReq )
64 SfxBindings& rBindings = rViewData.GetBindings();
65 sal_uInt16 nSlot = rReq.GetSlot();
66 switch ( nSlot )
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:
80 rViewData.GetViewShell()->SetAuditShell( false );
81 break;
83 case SID_FILL_SELECT:
85 const SfxItemSet* pReqArgs = rReq.GetArgs();
86 if ( pReqArgs )
88 const SfxInt16Item* pXItem = pReqArgs->GetItemIfSet( SID_RANGE_COL );
89 const SfxInt32Item* pYItem = pReqArgs->GetItemIfSet( SID_RANGE_ROW );
90 if ( pXItem && pYItem )
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 )
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;
114 break;
118 void ScAuditingShell::GetState( SfxItemSet& rSet )
120 rSet.Put( SfxBoolItem( nFunction, true ) ); // mark active functions
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */