1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XIndexContainer.hpp>
25 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
26 #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <com/sun/star/frame/XFrame.hpp>
34 #include <sfx2/tabdlg.hxx>
35 #include <sfx2/basedlgs.hxx>
36 #include <i18nutil/searchopt.hxx>
37 #include "cfgutil.hxx"
39 class SfxMacroInfoItem
;
40 class CuiConfigFunctionListBox
;
41 class SfxAcceleratorConfigPage
;
44 // class SfxAcceleratorConfigPage ----------------------------------------
49 TAccInfo( sal_Int32 nKeyPos
,
51 const vcl::KeyCode
& aKey
)
52 : m_nKeyPos (nKeyPos
)
53 , m_nListPos (nListPos
)
54 , m_bIsConfigurable(true ) /**< it's important to set true as default -
55 because only fix entries will be disabled later... */
60 bool isConfigured() const
62 return (m_nKeyPos
>-1 && m_nListPos
>-1 && !m_sCommand
.isEmpty());
67 bool m_bIsConfigurable
;
74 class FileDialogHelper
;
77 enum class StartFileDialogType
{ Open
, SaveAs
};
79 class SfxAcceleratorConfigPage
: public SfxTabPage
82 const SfxMacroInfoItem
* m_pMacroInfoItem
;
83 std::unique_ptr
<sfx2::FileDialogHelper
> m_pFileDlg
;
85 OUString aLoadAccelConfigStr
;
86 OUString aSaveAccelConfigStr
;
87 OUString aFilterAllStr
;
88 OUString aFilterCfgStr
;
89 SfxStylesInfo_Impl m_aStylesInfo
;
90 bool m_bStylesInfoInitialized
;
92 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
93 css::uno::Reference
< css::ui::XAcceleratorConfiguration
> m_xGlobal
;
94 css::uno::Reference
< css::ui::XAcceleratorConfiguration
> m_xModule
;
95 css::uno::Reference
< css::ui::XAcceleratorConfiguration
> m_xAct
;
96 css::uno::Reference
< css::container::XNameAccess
> m_xUICmdDescription
;
97 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
99 OUString m_sModuleLongName
;
100 OUString m_sModuleUIName
;
103 Timer m_aUpdateDataTimer
;
104 i18nutil::SearchOptions2 m_options
;
106 Idle m_aFillGroupIdle
;
108 std::unique_ptr
<weld::TreeView
> m_xEntriesBox
;
109 std::unique_ptr
<weld::RadioButton
> m_xOfficeButton
;
110 std::unique_ptr
<weld::RadioButton
> m_xModuleButton
;
111 std::unique_ptr
<weld::Button
> m_xChangeButton
;
112 std::unique_ptr
<weld::Button
> m_xRemoveButton
;
113 std::unique_ptr
<CuiConfigGroupListBox
> m_xGroupLBox
;
114 std::unique_ptr
<CuiConfigFunctionListBox
> m_xFunctionBox
;
115 std::unique_ptr
<weld::TreeView
> m_xKeyBox
;
116 std::unique_ptr
<weld::Entry
> m_xSearchEdit
;
117 std::unique_ptr
<weld::Button
> m_xLoadButton
;
118 std::unique_ptr
<weld::Button
> m_xSaveButton
;
119 std::unique_ptr
<weld::Button
> m_xResetButton
;
121 DECL_LINK(ChangeHdl
, weld::Button
&, void);
122 DECL_LINK(RemoveHdl
, weld::Button
&, void);
123 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
124 DECL_LINK(SearchUpdateHdl
, weld::Entry
&, void);
125 DECL_LINK(Save
, weld::Button
&, void);
126 DECL_LINK(Load
, weld::Button
&, void);
127 DECL_LINK(Default
, weld::Button
&, void);
128 DECL_LINK(RadioHdl
, weld::Button
&, void);
129 DECL_LINK(ImplUpdateDataHdl
, Timer
*, void);
130 DECL_LINK(FocusOut_Impl
, weld::Widget
&, void);
131 DECL_LINK(TimeOut_Impl
, Timer
*, void);
133 DECL_LINK(KeyInputHdl
, const KeyEvent
&, bool);
136 DECL_LINK(LoadHdl
, sfx2::FileDialogHelper
*, void);
137 DECL_LINK(SaveHdl
, sfx2::FileDialogHelper
*, void);
139 OUString
GetLabel4Command(const OUString
& rCommand
);
140 int applySearchFilter(OUString
const & rSearchTerm
);
142 sal_Int32
MapKeyCodeToPos(const vcl::KeyCode
&rCode
) const;
143 void StartFileDialog( StartFileDialogType nType
, const OUString
& rTitle
);
145 void Init(const css::uno::Reference
< css::ui::XAcceleratorConfiguration
>& pAccMgr
);
149 SfxAcceleratorConfigPage(TabPageParent pParent
, const SfxItemSet
& rItemSet
);
150 virtual ~SfxAcceleratorConfigPage() override
;
151 virtual void dispose() override
;
153 virtual bool FillItemSet( SfxItemSet
* ) override
;
154 virtual void Reset( const SfxItemSet
* ) override
;
156 void Apply(const css::uno::Reference
< css::ui::XAcceleratorConfiguration
>& pAccMgr
);
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */