Bump version to 6.4.7.2.M8
[LibreOffice.git] / cui / source / inc / acccfg.hxx
blob41df1d05896f07be9b17818de08006902bbbee42
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 #ifndef INCLUDED_CUI_SOURCE_INC_ACCCFG_HXX
21 #define INCLUDED_CUI_SOURCE_INC_ACCCFG_HXX
23 #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
28 #include <sfx2/tabdlg.hxx>
29 #include <i18nutil/searchopt.hxx>
30 #include "cfgutil.hxx"
32 class SfxMacroInfoItem;
33 class CuiConfigFunctionListBox;
34 class SfxAcceleratorConfigPage;
35 class SfxStringItem;
37 // class SfxAcceleratorConfigPage ----------------------------------------
39 struct TAccInfo
41 public:
42 TAccInfo( sal_Int32 nKeyPos ,
43 sal_Int32 nListPos,
44 const vcl::KeyCode& aKey )
45 : m_nKeyPos (nKeyPos )
46 , m_nListPos (nListPos )
47 , m_bIsConfigurable(true ) /**< it's important to set true as default -
48 because only fix entries will be disabled later... */
49 , m_sCommand ( )
50 , m_aKey (aKey )
53 bool isConfigured() const
55 return (m_nKeyPos>-1 && m_nListPos>-1 && !m_sCommand.isEmpty());
58 sal_Int32 m_nKeyPos;
59 sal_Int32 m_nListPos;
60 bool m_bIsConfigurable;
61 OUString m_sCommand;
62 vcl::KeyCode m_aKey;
65 namespace sfx2
67 class FileDialogHelper;
70 enum class StartFileDialogType { Open, SaveAs };
72 class SfxAcceleratorConfigPage : public SfxTabPage
74 private:
75 const SfxMacroInfoItem* m_pMacroInfoItem;
76 std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
78 OUString aLoadAccelConfigStr;
79 OUString aSaveAccelConfigStr;
80 OUString aFilterAllStr;
81 OUString aFilterCfgStr;
82 SfxStylesInfo_Impl m_aStylesInfo;
83 bool m_bStylesInfoInitialized;
85 css::uno::Reference< css::uno::XComponentContext > m_xContext;
86 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
87 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
88 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
89 css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
90 css::uno::Reference< css::frame::XFrame > m_xFrame;
92 OUString m_sModuleLongName;
93 OUString m_sModuleUIName;
95 // For search
96 Timer m_aUpdateDataTimer;
97 i18nutil::SearchOptions2 m_options;
99 Idle m_aFillGroupIdle;
101 std::unique_ptr<weld::TreeView> m_xEntriesBox;
102 std::unique_ptr<weld::RadioButton> m_xOfficeButton;
103 std::unique_ptr<weld::RadioButton> m_xModuleButton;
104 std::unique_ptr<weld::Button> m_xChangeButton;
105 std::unique_ptr<weld::Button> m_xRemoveButton;
106 std::unique_ptr<CuiConfigGroupListBox> m_xGroupLBox;
107 std::unique_ptr<CuiConfigFunctionListBox> m_xFunctionBox;
108 std::unique_ptr<weld::TreeView> m_xKeyBox;
109 std::unique_ptr<weld::Entry> m_xSearchEdit;
110 std::unique_ptr<weld::Button> m_xLoadButton;
111 std::unique_ptr<weld::Button> m_xSaveButton;
112 std::unique_ptr<weld::Button> m_xResetButton;
114 DECL_LINK(ChangeHdl, weld::Button&, void);
115 DECL_LINK(RemoveHdl, weld::Button&, void);
116 DECL_LINK(SelectHdl, weld::TreeView&, void);
117 DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
118 DECL_LINK(Save, weld::Button&, void);
119 DECL_LINK(Load, weld::Button&, void);
120 DECL_LINK(Default, weld::Button&, void);
121 DECL_LINK(RadioHdl, weld::Button&, void);
122 DECL_LINK(ImplUpdateDataHdl, Timer*, void);
123 DECL_LINK(FocusOut_Impl, weld::Widget&, void);
124 DECL_LINK(TimeOut_Impl, Timer*, void);
126 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
129 DECL_LINK(LoadHdl, sfx2::FileDialogHelper *, void);
130 DECL_LINK(SaveHdl, sfx2::FileDialogHelper *, void);
132 OUString GetLabel4Command(const OUString& rCommand);
133 int applySearchFilter(OUString const & rSearchTerm);
134 void InitAccCfg();
135 sal_Int32 MapKeyCodeToPos(const vcl::KeyCode &rCode) const;
136 void StartFileDialog( StartFileDialogType nType, const OUString& rTitle );
138 void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
139 void ResetConfig();
141 public:
142 SfxAcceleratorConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rItemSet);
143 virtual ~SfxAcceleratorConfigPage() override;
145 virtual bool FillItemSet( SfxItemSet* ) override;
146 virtual void Reset( const SfxItemSet* ) override;
148 void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
151 #endif
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */