bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / acccfg.hxx
bloba41bb4f773fecbf5e26be4ccd3fc93a24fbb6a82
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/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XIndexContainer.hpp>
25 #include <com/sun/star/frame/XModuleManager.hpp>
26 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
27 #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
28 #include <com/sun/star/frame/XStorable.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
31 #include <com/sun/star/script/browse/XBrowseNode.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/frame/XFrame.hpp>
35 #include <algorithm>
37 #include <vcl/fixed.hxx>
38 #include <vcl/button.hxx>
39 #include <vcl/dialog.hxx>
40 #include <vcl/lstbox.hxx>
41 #include <vcl/group.hxx>
42 #include <svtools/svtabbx.hxx>
43 #include <svtools/treelistbox.hxx>
44 #include <sfx2/tabdlg.hxx>
45 #include <sfx2/basedlgs.hxx>
46 #include "cfgutil.hxx"
48 class SfxMacroInfoItem;
49 class SfxConfigGroupListBox;
50 class SfxConfigFunctionListBox;
51 class SfxAcceleratorConfigPage;
52 class SfxStringItem;
54 class SfxAccCfgTabListBox_Impl : public SvTabListBox
56 VclPtr<SfxAcceleratorConfigPage> m_pAccelConfigPage;
58 void KeyInput( const KeyEvent &rKEvt ) SAL_OVERRIDE;
60 protected:
61 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&,
62 const Image&, SvLBoxButtonKind eButtonKind) SAL_OVERRIDE;
64 public:
65 SfxAccCfgTabListBox_Impl(vcl::Window *pParent, WinBits nStyle)
66 : SvTabListBox(pParent, nStyle)
67 , m_pAccelConfigPage(NULL)
70 virtual ~SfxAccCfgTabListBox_Impl();
71 virtual void dispose() SAL_OVERRIDE;
73 void SetAccelConfigPage(SfxAcceleratorConfigPage* pAccelConfigPage)
75 m_pAccelConfigPage = pAccelConfigPage;
78 void ReplaceEntry( sal_uInt16 nPos, const OUString &rStr );
81 // class SfxAcceleratorConfigPage ----------------------------------------
83 struct TAccInfo
85 public:
86 TAccInfo( sal_Int32 nKeyPos ,
87 sal_Int32 nListPos,
88 const vcl::KeyCode& aKey )
89 : m_nKeyPos (nKeyPos )
90 , m_nListPos (nListPos )
91 , m_bIsConfigurable(true ) /**< its important to set sal_True as default -
92 because only fix entries will be disabled later ... */
93 , m_sCommand ( )
94 , m_aKey (aKey )
97 bool isConfigured() const
99 return (m_nKeyPos>-1 && m_nListPos>-1 && !m_sCommand.isEmpty());
102 sal_Int32 m_nKeyPos;
103 sal_Int32 m_nListPos;
104 bool m_bIsConfigurable;
105 OUString m_sCommand;
106 vcl::KeyCode m_aKey;
109 namespace sfx2
111 class FileDialogHelper;
114 class SfxAcceleratorConfigPage : public SfxTabPage
116 friend class SfxAccCfgTabListBox_Impl;
117 private:
118 const SfxMacroInfoItem* m_pMacroInfoItem;
119 const SfxStringItem* m_pStringItem;
120 const SfxStringItem* m_pFontItem;
121 sfx2::FileDialogHelper* m_pFileDlg;
123 VclPtr<SfxAccCfgTabListBox_Impl> m_pEntriesBox;
124 VclPtr<RadioButton> m_pOfficeButton;
125 VclPtr<RadioButton> m_pModuleButton;
126 VclPtr<PushButton> m_pChangeButton;
127 VclPtr<PushButton> m_pRemoveButton;
128 VclPtr<SfxConfigGroupListBox> m_pGroupLBox;
129 VclPtr<SfxConfigFunctionListBox> m_pFunctionBox;
130 VclPtr<SvTreeListBox> m_pKeyBox;
131 VclPtr<PushButton> m_pLoadButton;
132 VclPtr<PushButton> m_pSaveButton;
133 VclPtr<PushButton> m_pResetButton;
134 OUString aLoadAccelConfigStr;
135 OUString aSaveAccelConfigStr;
136 OUString aFilterAllStr;
137 OUString aFilterCfgStr;
138 SfxStylesInfo_Impl m_aStylesInfo;
139 bool m_bStylesInfoInitialized;
141 css::uno::Reference< css::uno::XComponentContext > m_xContext;
142 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
143 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
144 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
145 css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
146 css::uno::Reference< css::frame::XFrame > m_xFrame;
148 OUString m_sModuleLongName;
149 OUString m_sModuleShortName;
150 OUString m_sModuleUIName;
152 DECL_LINK(ChangeHdl, void *);
153 DECL_LINK(RemoveHdl, void *);
154 DECL_LINK( SelectHdl, Control * );
155 DECL_LINK(Save, void *);
156 DECL_LINK(Load, void *);
157 DECL_LINK(Default, void *);
158 DECL_LINK(RadioHdl, void *);
160 DECL_LINK(LoadHdl, void *);
161 DECL_LINK(SaveHdl, void *);
163 OUString GetLabel4Command(const OUString& rCommand);
164 void InitAccCfg();
165 sal_uLong MapKeyCodeToPos( const vcl::KeyCode &rCode ) const;
166 static css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const OUString& sName);
167 void StartFileDialog( WinBits nBits, const OUString& rTitle );
169 void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
170 void ResetConfig();
172 static void CreateCustomItems( SvTreeListEntry* pEntry, const OUString& aCol1, const OUString& aCol2 );
174 public:
175 SfxAcceleratorConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
176 virtual ~SfxAcceleratorConfigPage();
177 virtual void dispose() SAL_OVERRIDE;
179 virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
180 virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
182 void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
185 #endif
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */