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 <vcl/idle.hxx>
30 #include <i18nutil/searchopt.hxx>
31 #include "cfgutil.hxx"
32 
33 class SfxMacroInfoItem;
36 class SfxStringItem;
37 
38 // class SfxAcceleratorConfigPage ----------------------------------------
39 
40 struct TAccInfo
41 {
42  public:
43  TAccInfo( sal_Int32 nKeyPos ,
44  sal_Int32 nListPos,
45  const vcl::KeyCode& aKey )
46  : m_nKeyPos (nKeyPos )
47  , m_nListPos (nListPos )
48  , m_bIsConfigurable(true )
50  , m_sCommand ( )
51  , m_aKey (aKey )
52  {}
53 
54  bool isConfigured() const
55  {
56  return (m_nKeyPos>-1 && m_nListPos>-1 && !m_sCommand.isEmpty());
57  }
58 
59  sal_Int32 m_nKeyPos;
60  sal_Int32 m_nListPos;
62  OUString m_sCommand;
64 };
65 
66 namespace sfx2
67 {
68  class FileDialogHelper;
69 }
70 
72 
74 {
75 private:
77  std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
78 
81  OUString aFilterAllStr;
82  OUString aFilterCfgStr;
85 
86  css::uno::Reference< css::uno::XComponentContext > m_xContext;
87  css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
88  css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
89  css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
90  css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
91  css::uno::Reference< css::frame::XFrame > m_xFrame;
92 
94  OUString m_sModuleUIName;
95 
96  // For search
99 
101 
102  std::unique_ptr<weld::TreeView> m_xEntriesBox;
103  std::unique_ptr<weld::RadioButton> m_xOfficeButton;
104  std::unique_ptr<weld::RadioButton> m_xModuleButton;
105  std::unique_ptr<weld::Button> m_xChangeButton;
106  std::unique_ptr<weld::Button> m_xRemoveButton;
107  std::unique_ptr<CuiConfigGroupListBox> m_xGroupLBox;
108  std::unique_ptr<CuiConfigFunctionListBox> m_xFunctionBox;
109  std::unique_ptr<weld::TreeView> m_xKeyBox;
110  std::unique_ptr<weld::Entry> m_xSearchEdit;
111  std::unique_ptr<weld::Button> m_xLoadButton;
112  std::unique_ptr<weld::Button> m_xSaveButton;
113  std::unique_ptr<weld::Button> m_xResetButton;
114 
115  DECL_LINK(ChangeHdl, weld::Button&, void);
116  DECL_LINK(RemoveHdl, weld::Button&, void);
117  DECL_LINK(SelectHdl, weld::TreeView&, void);
118  DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
119  DECL_LINK(Save, weld::Button&, void);
120  DECL_LINK(Load, weld::Button&, void);
121  DECL_LINK(Default, weld::Button&, void);
122  DECL_LINK(RadioHdl, weld::Button&, void);
123  DECL_LINK(ImplUpdateDataHdl, Timer*, void);
124  DECL_LINK(FocusOut_Impl, weld::Widget&, void);
125  DECL_LINK(TimeOut_Impl, Timer*, void);
126 
127  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
128 
129 
130  DECL_LINK(LoadHdl, sfx2::FileDialogHelper *, void);
131  DECL_LINK(SaveHdl, sfx2::FileDialogHelper *, void);
132 
133  OUString GetLabel4Command(const OUString& rCommand);
134  int applySearchFilter(OUString const & rSearchTerm);
135  void InitAccCfg();
136  sal_Int32 MapKeyCodeToPos(const vcl::KeyCode &rCode) const;
137  void StartFileDialog( StartFileDialogType nType, const OUString& rTitle );
138 
139  void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
140  void ResetConfig();
141 
142 public:
143  SfxAcceleratorConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rItemSet);
144  virtual ~SfxAcceleratorConfigPage() override;
145 
146  virtual bool FillItemSet( SfxItemSet* ) override;
147  virtual void Reset( const SfxItemSet* ) override;
148 
149  void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
150 };
151 
152 #endif
153 
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration > &pAccMgr)
Definition: acccfg.cxx:1053
OUString GetLabel4Command(const OUString &rCommand)
Definition: acccfg.cxx:1527
void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration > &pAccMgr)
Definition: acccfg.cxx:975
bool isConfigured() const
Definition: acccfg.hxx:54
DECL_LINK(ChangeHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xLoadButton
Definition: acccfg.hxx:111
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: acccfg.hxx:91
const SfxMacroInfoItem * m_pMacroInfoItem
Definition: acccfg.hxx:76
OUString m_sModuleUIName
Definition: acccfg.hxx:94
sal_Int32 m_nListPos
Definition: acccfg.hxx:60
OUString m_sModuleLongName
Definition: acccfg.hxx:93
std::unique_ptr< weld::RadioButton > m_xModuleButton
Definition: acccfg.hxx:104
std::unique_ptr< CuiConfigGroupListBox > m_xGroupLBox
Definition: acccfg.hxx:107
SfxStylesInfo_Impl m_aStylesInfo
Definition: acccfg.hxx:83
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct
Definition: acccfg.hxx:89
std::unique_ptr< CuiConfigFunctionListBox > m_xFunctionBox
Definition: acccfg.hxx:108
std::unique_ptr< weld::Entry > m_xSearchEdit
Definition: acccfg.hxx:110
sal_Int32 m_nKeyPos
Definition: acccfg.hxx:59
OUString aLoadAccelConfigStr
Definition: acccfg.hxx:79
std::unique_ptr< weld::Button > m_xSaveButton
Definition: acccfg.hxx:112
OUString m_sCommand
Definition: acccfg.hxx:62
std::unique_ptr< weld::TreeView > m_xKeyBox
Definition: acccfg.hxx:109
std::unique_ptr< weld::Button > m_xResetButton
Definition: acccfg.hxx:113
OUString aSaveAccelConfigStr
Definition: acccfg.hxx:80
sal_Int32 MapKeyCodeToPos(const vcl::KeyCode &rCode) const
Definition: acccfg.cxx:1509
vcl::KeyCode m_aKey
Definition: acccfg.hxx:63
virtual ~SfxAcceleratorConfigPage() override
Definition: acccfg.cxx:913
css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription
Definition: acccfg.hxx:90
StartFileDialogType
std::unique_ptr< weld::Button > m_xRemoveButton
Definition: acccfg.hxx:106
i18nutil::SearchOptions2 m_options
Definition: acccfg.hxx:98
std::unique_ptr< weld::Button > m_xChangeButton
Definition: acccfg.hxx:105
std::unique_ptr< sfx2::FileDialogHelper > m_pFileDlg
Definition: acccfg.hxx:77
virtual void Reset(const SfxItemSet *) override
Definition: acccfg.cxx:1478
int applySearchFilter(OUString const &rSearchTerm)
Definition: acccfg.cxx:1564
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule
Definition: acccfg.hxx:88
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:43
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: acccfg.hxx:86
std::unique_ptr< weld::TreeView > m_xEntriesBox
Definition: acccfg.hxx:102
virtual bool FillItemSet(SfxItemSet *) override
Definition: acccfg.cxx:1458
void StartFileDialog(StartFileDialogType nType, const OUString &rTitle)
Definition: acccfg.cxx:1440
SfxAcceleratorConfigPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rItemSet)
Definition: acccfg.cxx:823
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal
Definition: acccfg.hxx:87
bool m_bIsConfigurable
Definition: acccfg.hxx:61
std::unique_ptr< weld::RadioButton > m_xOfficeButton
Definition: acccfg.hxx:103