Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _ACCCFG_HXX
30 : : #define _ACCCFG_HXX
31 : :
32 : : #include <com/sun/star/beans/XPropertySet.hpp>
33 : : #include <com/sun/star/container/XIndexContainer.hpp>
34 : : #include <com/sun/star/frame/XModuleManager.hpp>
35 : : #include <com/sun/star/ui/XUIConfigurationManager.hpp>
36 : : #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
37 : : #include <com/sun/star/frame/XStorable.hpp>
38 : : #include <com/sun/star/uno/XComponentContext.hpp>
39 : : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
40 : : #include <com/sun/star/script/browse/XBrowseNode.hpp>
41 : : #include <com/sun/star/container/XNameAccess.hpp>
42 : : #include <com/sun/star/frame/XFrame.hpp>
43 : :
44 : : #include <algorithm>
45 : :
46 : : #include <vcl/fixed.hxx>
47 : : #include <vcl/button.hxx>
48 : : #include <vcl/dialog.hxx>
49 : : #include <vcl/lstbox.hxx>
50 : : #include <vcl/group.hxx>
51 : : #include <svtools/svtabbx.hxx>
52 : : #include <svtools/svtreebx.hxx>
53 : : #include <sfx2/tabdlg.hxx>
54 : : #include <sfx2/basedlgs.hxx>
55 : : #include <sfx2/minarray.hxx>
56 : : #include "cfgutil.hxx"
57 : :
58 : : namespace css = ::com::sun::star;
59 : :
60 : : class SfxMacroInfoItem;
61 : : class SfxConfigGroupListBox_Impl;
62 : : class SfxConfigFunctionListBox_Impl;
63 : : class SfxAcceleratorConfigPage;
64 : : class SfxStringItem;
65 : :
66 [ # # ]: 0 : class SfxAccCfgTabListBox_Impl : public SvTabListBox
67 : : {
68 : : SfxAcceleratorConfigPage* m_pAccelConfigPage;
69 : :
70 : : void KeyInput( const KeyEvent &rKEvt );
71 : :
72 : : protected:
73 : : virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind );
74 : :
75 : : public:
76 : 0 : SfxAccCfgTabListBox_Impl(
77 : : SfxAcceleratorConfigPage* pAccelConfigPage,
78 : : Window *pParent,
79 : : const ResId &rResId ) :
80 : : SvTabListBox( pParent, rResId ),
81 : 0 : m_pAccelConfigPage( pAccelConfigPage )
82 : 0 : {}
83 : :
84 : : void ReplaceEntry( sal_uInt16 nPos, const String &rStr );
85 : : };
86 : :
87 : : // class SfxAcceleratorConfigPage ----------------------------------------
88 : :
89 : 0 : struct TAccInfo
90 : : {
91 : : public:
92 : 0 : TAccInfo( sal_Int32 nKeyPos ,
93 : : sal_Int32 nListPos,
94 : : const KeyCode& aKey )
95 : : : m_nKeyPos (nKeyPos )
96 : : , m_nListPos (nListPos )
97 : : , m_bIsConfigurable(sal_True ) /**< its important to set sal_True as default -
98 : : because only fix entries will be disabled later ... */
99 : : , m_sCommand ( )
100 : 0 : , m_aKey (aKey )
101 : 0 : {}
102 : :
103 : 0 : sal_Bool isConfigured() const
104 : : {
105 [ # # ][ # # ]: 0 : return (m_nKeyPos>-1 && m_nListPos>-1 && !m_sCommand.isEmpty());
[ # # ]
106 : : }
107 : :
108 : : sal_Int32 m_nKeyPos;
109 : : sal_Int32 m_nListPos;
110 : : sal_Bool m_bIsConfigurable;
111 : : ::rtl::OUString m_sCommand;
112 : : KeyCode m_aKey;
113 : : };
114 : :
115 : : namespace sfx2
116 : : {
117 : : class FileDialogHelper;
118 : : }
119 : :
120 : : class SfxAcceleratorConfigPage : public SfxTabPage
121 : : {
122 : : friend class SfxAccCfgTabListBox_Impl;
123 : : private:
124 : : const SfxMacroInfoItem* m_pMacroInfoItem;
125 : : const SfxStringItem* m_pStringItem;
126 : : const SfxStringItem* m_pFontItem;
127 : : sfx2::FileDialogHelper* m_pFileDlg;
128 : :
129 : : SfxAccCfgTabListBox_Impl aEntriesBox;
130 : : FixedLine aKeyboardGroup;
131 : : RadioButton aOfficeButton;
132 : : RadioButton aModuleButton;
133 : : PushButton aChangeButton;
134 : : PushButton aRemoveButton;
135 : : FixedText aGroupText;
136 : : SfxConfigGroupListBox_Impl* pGroupLBox;
137 : : FixedText aFunctionText;
138 : : SfxConfigFunctionListBox_Impl* pFunctionBox;
139 : : FixedText aKeyText;
140 : : SvTreeListBox aKeyBox;
141 : : FixedLine aFunctionsGroup;
142 : : PushButton aLoadButton;
143 : : PushButton aSaveButton;
144 : : PushButton aResetButton;
145 : : String aLoadAccelConfigStr;
146 : : String aSaveAccelConfigStr;
147 : : String aFilterAllStr;
148 : : String aFilterCfgStr;
149 : : SfxStylesInfo_Impl m_aStylesInfo;
150 : : sal_Bool m_bStylesInfoInitialized;
151 : :
152 : : css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
153 : : css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
154 : : css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
155 : : css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
156 : : css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
157 : : css::uno::Reference< css::frame::XFrame > m_xFrame;
158 : :
159 : : ::rtl::OUString m_sModuleLongName;
160 : : ::rtl::OUString m_sModuleShortName;
161 : : ::rtl::OUString m_sModuleUIName;
162 : :
163 : : DECL_LINK(ChangeHdl, void *);
164 : : DECL_LINK(RemoveHdl, void *);
165 : : DECL_LINK( SelectHdl, Control * );
166 : : DECL_LINK(Save, void *);
167 : : DECL_LINK(Load, void *);
168 : : DECL_LINK(Default, void *);
169 : : DECL_LINK(RadioHdl, void *);
170 : :
171 : : DECL_LINK(LoadHdl, void *);
172 : : DECL_LINK(SaveHdl, void *);
173 : :
174 : : String GetLabel4Command(const String& sCommand);
175 : : void InitAccCfg();
176 : : sal_uInt16 MapKeyCodeToPos( const KeyCode &rCode ) const;
177 : : css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const String& sName);
178 : : void StartFileDialog( WinBits nBits, const String& rTitle );
179 : :
180 : : void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
181 : : void ResetConfig();
182 : :
183 : : void CreateCustomItems( SvLBoxEntry* pEntry, const String& aCol1, const String& aCol2 );
184 : :
185 : : public:
186 : : SfxAcceleratorConfigPage( Window *pParent, const SfxItemSet& rItemSet );
187 : : virtual ~SfxAcceleratorConfigPage();
188 : :
189 : : virtual sal_Bool FillItemSet( SfxItemSet& );
190 : : virtual void Reset( const SfxItemSet& );
191 : :
192 : : void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr);
193 : : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
194 : : };
195 : :
196 : :
197 : : class SfxAcceleratorConfigListBox : public ListBox
198 : : {
199 : : void KeyInput( const KeyEvent &rKEvt );
200 : :
201 : : public:
202 : :
203 : : SfxAcceleratorConfigListBox( Window *pParent, ResId &rResId ) :
204 : : ListBox( pParent, rResId ) {}
205 : :
206 : : void ReplaceEntry( sal_uInt16 nPos, const String &rStr );
207 : : void ExpandEntry ( sal_uInt16 nPos, const String &rStr );
208 : : };
209 : :
210 : : class SvxShortcutAssignDlg : public SfxSingleTabDialog
211 : : {
212 : : public:
213 : : SvxShortcutAssignDlg(
214 : : Window* pParent,
215 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
216 : : const SfxItemSet& rSet );
217 : : virtual ~SvxShortcutAssignDlg();
218 : : };
219 : :
220 : : #endif
221 : :
222 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|