sc: use SAL_RET_MAYBENULL in GetDocument()
[LibreOffice.git] / basctl / source / basicide / macrodlg.hxx
blob0e50ee5de02be87b10697c84c33712c2e6b2c140
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 #pragma once
22 #include <basobj.hxx>
23 #include <bastype2.hxx>
24 #include <sfx2/basedlgs.hxx>
25 #include <com/sun/star/frame/XFrame.hpp>
26 #include <vcl/weld.hxx>
28 namespace basctl
31 enum MacroExitCode {
32 Macro_Close = 110,
33 Macro_OkRun = 111,
34 Macro_New = 112,
35 Macro_Edit = 114,
38 class MacroChooser : public SfxDialogController
40 public:
41 enum Mode {
42 All = 1,
43 ChooseOnly = 2,
44 Recording = 3,
47 private:
48 OUString m_aMacrosInTxtBaseStr;
50 // For forwarding to Assign dialog
51 ::css::uno::Reference< ::css::frame::XFrame > m_xDocumentFrame;
53 bool bForceStoreBasic;
55 Mode nMode;
57 DECL_LINK(MacroSelectHdl, weld::TreeView&, void);
58 DECL_LINK(MacroDoubleClickHdl, weld::TreeView&, bool);
59 DECL_LINK(BasicSelectHdl, weld::TreeView&, void);
60 DECL_LINK(EditModifyHdl, weld::Entry&, void);
61 DECL_LINK(ContextMenuHdl, const CommandEvent&, bool);
62 DECL_LINK(ButtonHdl, weld::Button&, void);
64 void CheckButtons();
65 void SaveSetCurEntry(weld::TreeView& rBox, const weld::TreeIter& rEntry);
66 void UpdateFields();
68 void EnableButton(weld::Button& rButton, bool bEnable);
70 static OUString GetInfo( SbxVariable* pVar );
72 void StoreMacroDescription();
73 void RestoreMacroDescription();
75 std::unique_ptr<weld::Entry> m_xMacroNameEdit;
76 std::unique_ptr<weld::Label> m_xMacroFromTxT;
77 std::unique_ptr<weld::Label> m_xMacrosSaveInTxt;
78 std::unique_ptr<SbTreeListBox> m_xBasicBox;
79 std::unique_ptr<weld::TreeIter> m_xBasicBoxIter;
80 std::unique_ptr<weld::Label> m_xMacrosInTxt;
81 std::unique_ptr<weld::TreeView> m_xMacroBox;
82 std::unique_ptr<weld::TreeIter> m_xMacroBoxIter;
83 std::unique_ptr<weld::Button> m_xRunButton;
84 std::unique_ptr<weld::Button> m_xCloseButton;
85 std::unique_ptr<weld::Button> m_xAssignButton;
86 std::unique_ptr<weld::Button> m_xEditButton;
87 std::unique_ptr<weld::Button> m_xDelButton;
88 std::unique_ptr<weld::Button> m_xNewButton;
89 std::unique_ptr<weld::Button> m_xOrganizeButton;
90 std::unique_ptr<weld::Button> m_xNewLibButton;
91 std::unique_ptr<weld::Button> m_xNewModButton;
92 public:
93 MacroChooser(weld::Window *pParent, const ::css::uno::Reference< ::css::frame::XFrame >& xDocFrame);
94 virtual ~MacroChooser() override;
96 SbMethod* GetMacro();
97 void DeleteMacro();
98 SbMethod* CreateMacro();
100 virtual short run() override;
102 void SetMode (Mode);
103 Mode GetMode () const { return nMode; }
106 } // namespace basctl
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */