LibreOffice Module cui (master)  1
acccfg.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_CUI_SOURCE_INC_ACCCFG_HXX
21 #define INCLUDED_CUI_SOURCE_INC_ACCCFG_HXX
22 
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>
27 
28 #include <sfx2/tabdlg.hxx>
29 #include <i18nutil/searchopt.hxx>
30 #include "cfgutil.hxx"
31 
32 class SfxMacroInfoItem;
35 class SfxStringItem;
36 
37 // class SfxAcceleratorConfigPage ----------------------------------------
38 
39 struct TAccInfo
40 {
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 )
49  , m_sCommand ( )
50  , m_aKey (aKey )
51  {}
52 
53  bool isConfigured() const
54  {
55  return (m_nKeyPos>-1 && m_nListPos>-1 && !m_sCommand.isEmpty());
56  }
57 
58  sal_Int32 m_nKeyPos;
59  sal_Int32 m_nListPos;
61  OUString m_sCommand;
63 };
64 
65 namespace sfx2
66 {
67  class FileDialogHelper;
68 }
69 
71 
73 {
74 private:
76  std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
77 
80  OUString aFilterAllStr;
81  OUString aFilterCfgStr;
84 
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;
91 
93  OUString m_sModuleUIName;
94 
95  // For search
98 
100 
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;
113 
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);
125 
126  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
127 
128 
129  DECL_LINK(LoadHdl, sfx2::FileDialogHelper *, void);
130  DECL_LINK(SaveHdl, sfx2::FileDialogHelper *, void);
131 
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 );
137 
138  void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
139  void ResetConfig();
140 
141 public:
142  SfxAcceleratorConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rItemSet);
143  virtual ~SfxAcceleratorConfigPage() override;
144 
145  virtual bool FillItemSet( SfxItemSet* ) override;
146  virtual void Reset( const SfxItemSet* ) override;
147 
148  void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
149 };
150 
151 #endif
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration > &pAccMgr)
Definition: acccfg.cxx:1054
OUString GetLabel4Command(const OUString &rCommand)
Definition: acccfg.cxx:1528
void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration > &pAccMgr)
Definition: acccfg.cxx:976
bool isConfigured() const
Definition: acccfg.hxx:53
DECL_LINK(ChangeHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xLoadButton
Definition: acccfg.hxx:110
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: acccfg.hxx:90
const SfxMacroInfoItem * m_pMacroInfoItem
Definition: acccfg.hxx:75
OUString m_sModuleUIName
Definition: acccfg.hxx:93
sal_Int32 m_nListPos
Definition: acccfg.hxx:59
OUString m_sModuleLongName
Definition: acccfg.hxx:92
std::unique_ptr< weld::RadioButton > m_xModuleButton
Definition: acccfg.hxx:103
std::unique_ptr< CuiConfigGroupListBox > m_xGroupLBox
Definition: acccfg.hxx:106
SfxStylesInfo_Impl m_aStylesInfo
Definition: acccfg.hxx:82
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct
Definition: acccfg.hxx:88
std::unique_ptr< CuiConfigFunctionListBox > m_xFunctionBox
Definition: acccfg.hxx:107
std::unique_ptr< weld::Entry > m_xSearchEdit
Definition: acccfg.hxx:109
sal_Int32 m_nKeyPos
Definition: acccfg.hxx:58
OUString aLoadAccelConfigStr
Definition: acccfg.hxx:78
std::unique_ptr< weld::Button > m_xSaveButton
Definition: acccfg.hxx:111
OUString m_sCommand
Definition: acccfg.hxx:61
std::unique_ptr< weld::TreeView > m_xKeyBox
Definition: acccfg.hxx:108
std::unique_ptr< weld::Button > m_xResetButton
Definition: acccfg.hxx:112
OUString aSaveAccelConfigStr
Definition: acccfg.hxx:79
sal_Int32 MapKeyCodeToPos(const vcl::KeyCode &rCode) const
Definition: acccfg.cxx:1510
vcl::KeyCode m_aKey
Definition: acccfg.hxx:62
virtual ~SfxAcceleratorConfigPage() override
Definition: acccfg.cxx:914
css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription
Definition: acccfg.hxx:89
StartFileDialogType
std::unique_ptr< weld::Button > m_xRemoveButton
Definition: acccfg.hxx:105
i18nutil::SearchOptions2 m_options
Definition: acccfg.hxx:97
std::unique_ptr< weld::Button > m_xChangeButton
Definition: acccfg.hxx:104
std::unique_ptr< sfx2::FileDialogHelper > m_pFileDlg
Definition: acccfg.hxx:76
virtual void Reset(const SfxItemSet *) override
Definition: acccfg.cxx:1479
int applySearchFilter(OUString const &rSearchTerm)
Definition: acccfg.cxx:1565
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule
Definition: acccfg.hxx:87
TAccInfo(sal_Int32 nKeyPos, sal_Int32 nListPos, const vcl::KeyCode &aKey)
< it's important to set true as default - because only fix entries will be disabled later...
Definition: acccfg.hxx:42
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: acccfg.hxx:85
std::unique_ptr< weld::TreeView > m_xEntriesBox
Definition: acccfg.hxx:101
virtual bool FillItemSet(SfxItemSet *) override
Definition: acccfg.cxx:1459
void StartFileDialog(StartFileDialogType nType, const OUString &rTitle)
Definition: acccfg.cxx:1441
SfxAcceleratorConfigPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rItemSet)
Definition: acccfg.cxx:824
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal
Definition: acccfg.hxx:86
bool m_bIsConfigurable
Definition: acccfg.hxx:60
std::unique_ptr< weld::RadioButton > m_xOfficeButton
Definition: acccfg.hxx:102