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 #pragma once
21 
22 #include <vcl/weld.hxx>
23 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
24 
25 #include <memory>
26 
27 #include "cfg.hxx" //for SvxConfigPage and SaveInData
28 
29 class SvxToolbarConfigPage : public SvxConfigPage
30 {
31 private:
32     DECL_LINK(SelectToolbarEntry, weld::TreeView&, void);
33     DECL_LINK(MoveHdl, weld::Button&, void);
34 
35     DECL_LINK(GearHdl, const OString&, void);
36 
37     DECL_LINK(SelectCategory, weld::ComboBox&, void);
38 
39     DECL_LINK(ContentContextMenuHdl, const CommandEvent&, bool);
40     DECL_LINK(FunctionContextMenuHdl, const CommandEvent&, bool);
41 
42     DECL_LINK(AddCommandHdl, weld::Button&, void);
43     DECL_LINK(RemoveCommandHdl, weld::Button&, void);
44 
45     DECL_LINK(InsertHdl, const OString&, void);
46     DECL_LINK(ModifyItemHdl, const OString&, void);
47     DECL_LINK(ResetToolbarHdl, weld::Button&, void);
48 
49     virtual void ListModified() override;
50 
51     void UpdateButtonStates() override;
52     short QueryReset() override;
53     void Init() override;
54     void DeleteSelectedContent() override;
55     void DeleteSelectedTopLevel() override;
56     virtual void SelectElement() override;
57 
58 public:
59     SvxToolbarConfigPage(weld::Container* pPage, weld::DialogController* pController,
60                          const SfxItemSet& rItemSet);
61     virtual ~SvxToolbarConfigPage() override;
62 
63     void AddFunction(int nTarget = -1);
64 
65     void MoveEntry(bool bMoveUp) override;
66 
67     SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&,
68                                  const css::uno::Reference<css::ui::XUIConfigurationManager>&,
69                                  const OUString& aModuleId, bool docConfig) override;
70 };
71 
72 class SvxToolbarEntriesListBox final : public SvxMenuEntriesListBox
73 {
74     void ChangedVisibility(int nRow);
75 
76     DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void);
77     DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
78 
79 public:
80     SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxToolbarConfigPage* pPg);
81     virtual ~SvxToolbarEntriesListBox() override;
82 };
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
85