android: Update app-specific/MIME type icons
[LibreOffice.git] / cui / source / inc / acccfg.hxx
blobe9207d5a1add7dac0ebf4befc7dd003e10d52897
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 <com/sun/star/ui/XAcceleratorConfiguration.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/frame/XFrame.hpp>
27 #include <sfx2/tabdlg.hxx>
28 #include <vcl/idle.hxx>
29 #include <vcl/keycod.hxx>
30 #include <i18nutil/searchopt.hxx>
31 #include <config_features.h>
32 #include "cfgutil.hxx"
34 #if HAVE_FEATURE_SCRIPTING
35 class SfxMacroInfoItem;
36 #endif
37 class CuiConfigFunctionListBox;
38 class SfxAcceleratorConfigPage;
39 class SfxStringItem;
41 // class SfxAcceleratorConfigPage ----------------------------------------
43 struct TAccInfo
45 public:
46 TAccInfo(sal_Int32 nKeyPos, sal_Int32 nListPos, const vcl::KeyCode& aKey)
47 : m_nKeyPos(nKeyPos)
48 , m_nListPos(nListPos)
49 , m_bIsConfigurable(true) /**< it's important to set true as default -
50 because only fix entries will be disabled later... */
51 , m_sCommand()
52 , m_aKey(aKey)
56 bool isConfigured() const
58 return (m_nKeyPos > -1 && m_nListPos > -1 && !m_sCommand.isEmpty());
61 sal_Int32 m_nKeyPos;
62 sal_Int32 m_nListPos;
63 bool m_bIsConfigurable;
64 OUString m_sCommand;
65 vcl::KeyCode m_aKey;
68 namespace sfx2
70 class FileDialogHelper;
73 enum class StartFileDialogType
75 Open,
76 SaveAs
79 class SfxAcceleratorConfigPage : public SfxTabPage
81 private:
82 #if HAVE_FEATURE_SCRIPTING
83 const SfxMacroInfoItem* m_pMacroInfoItem;
84 #endif
85 std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
87 OUString aLoadAccelConfigStr;
88 OUString aSaveAccelConfigStr;
89 OUString aFilterAllStr;
90 OUString aFilterCfgStr;
91 SfxStylesInfo_Impl m_aStylesInfo;
92 bool m_bStylesInfoInitialized;
94 css::uno::Reference<css::uno::XComponentContext> m_xContext;
95 css::uno::Reference<css::ui::XAcceleratorConfiguration> m_xGlobal;
96 css::uno::Reference<css::ui::XAcceleratorConfiguration> m_xModule;
97 css::uno::Reference<css::ui::XAcceleratorConfiguration> m_xAct;
98 css::uno::Reference<css::container::XNameAccess> m_xUICmdDescription;
99 css::uno::Reference<css::frame::XFrame> m_xFrame;
101 OUString m_sModuleLongName;
102 OUString m_sModuleUIName;
104 // For search
105 Timer m_aUpdateDataTimer;
106 i18nutil::SearchOptions2 m_options;
108 Idle m_aFillGroupIdle;
110 std::unique_ptr<weld::TreeView> m_xEntriesBox;
111 std::unique_ptr<weld::RadioButton> m_xOfficeButton;
112 std::unique_ptr<weld::RadioButton> m_xModuleButton;
113 std::unique_ptr<weld::Button> m_xChangeButton;
114 std::unique_ptr<weld::Button> m_xRemoveButton;
115 std::unique_ptr<CuiConfigGroupListBox> m_xGroupLBox;
116 std::unique_ptr<CuiConfigFunctionListBox> m_xFunctionBox;
117 std::unique_ptr<weld::TreeView> m_xKeyBox;
118 std::unique_ptr<weld::Entry> m_xSearchEdit;
119 std::unique_ptr<weld::Button> m_xLoadButton;
120 std::unique_ptr<weld::Button> m_xSaveButton;
121 std::unique_ptr<weld::Button> m_xResetButton;
123 DECL_LINK(ChangeHdl, weld::Button&, void);
124 DECL_LINK(RemoveHdl, weld::Button&, void);
125 DECL_LINK(SelectHdl, weld::TreeView&, void);
126 DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
127 DECL_LINK(Save, weld::Button&, void);
128 DECL_LINK(Load, weld::Button&, void);
129 DECL_LINK(Default, weld::Button&, void);
130 DECL_LINK(RadioHdl, weld::Toggleable&, void);
131 DECL_LINK(ImplUpdateDataHdl, Timer*, void);
132 DECL_LINK(FocusOut_Impl, weld::Widget&, void);
133 DECL_LINK(TimeOut_Impl, Timer*, void);
135 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
137 DECL_LINK(LoadHdl, sfx2::FileDialogHelper*, void);
138 DECL_LINK(SaveHdl, sfx2::FileDialogHelper*, void);
140 OUString GetLabel4Command(const OUString& rCommand);
141 int applySearchFilter(OUString const& rSearchTerm);
142 void InitAccCfg();
143 sal_Int32 MapKeyCodeToPos(const vcl::KeyCode& rCode) const;
144 void StartFileDialog(StartFileDialogType nType, const OUString& rTitle);
146 void Init(const css::uno::Reference<css::ui::XAcceleratorConfiguration>& pAccMgr);
147 void ResetConfig();
149 public:
150 SfxAcceleratorConfigPage(weld::Container* pPage, weld::DialogController* pController,
151 const SfxItemSet& rItemSet);
152 virtual ~SfxAcceleratorConfigPage() override;
154 virtual bool FillItemSet(SfxItemSet*) override;
155 virtual void Reset(const SfxItemSet*) override;
157 void Apply(const css::uno::Reference<css::ui::XAcceleratorConfiguration>& pAccMgr);
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */