Line data Source code
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 : #include <tools/resary.hxx>
21 : #include <vcl/fixed.hxx>
22 :
23 : class SfxModule;
24 : class SfxShell;
25 :
26 : // static ----------------------------------------------------------------
27 :
28 : sal_Bool EnableSSO();
29 : CreateTabPage GetSSOCreator( void );
30 :
31 : // struct OrderedEntry ---------------------------------------------------
32 :
33 : struct OrderedEntry
34 : {
35 : sal_Int32 m_nIndex;
36 : OUString m_sId;
37 :
38 0 : OrderedEntry( sal_Int32 nIndex, const OUString& rId ) :
39 0 : m_nIndex( nIndex ), m_sId( rId ) {}
40 : };
41 :
42 : typedef std::vector< OrderedEntry* > VectorOfOrderedEntries;
43 :
44 : // struct Module ---------------------------------------------------------
45 :
46 0 : struct Module
47 : {
48 : OUString m_sName;
49 : bool m_bActive;
50 : VectorOfOrderedEntries m_aNodeList;
51 :
52 0 : Module( const OUString& rName ) : m_sName( rName ), m_bActive( false ) {}
53 : };
54 :
55 : // struct OptionsLeaf ----------------------------------------------------
56 :
57 0 : struct OptionsLeaf
58 : {
59 : OUString m_sId;
60 : OUString m_sLabel;
61 : OUString m_sPageURL;
62 : OUString m_sEventHdl;
63 : OUString m_sGroupId;
64 : sal_Int32 m_nGroupIndex;
65 :
66 0 : OptionsLeaf( const OUString& rId,
67 : const OUString& rLabel,
68 : const OUString& rPageURL,
69 : const OUString& rEventHdl,
70 : const OUString& rGroupId,
71 : sal_Int32 nGroupIndex ) :
72 : m_sId( rId ),
73 : m_sLabel( rLabel ),
74 : m_sPageURL( rPageURL ),
75 : m_sEventHdl( rEventHdl ),
76 : m_sGroupId( rGroupId ),
77 0 : m_nGroupIndex( nGroupIndex ) {}
78 : };
79 :
80 : typedef ::std::vector< OptionsLeaf* > VectorOfLeaves;
81 : typedef ::std::vector< VectorOfLeaves > VectorOfGroupedLeaves;
82 :
83 : // struct OptionsNode ----------------------------------------------------
84 :
85 : struct OptionsNode
86 : {
87 : OUString m_sId;
88 : OUString m_sLabel;
89 : OUString m_sPageURL;
90 : bool m_bAllModules;
91 : OUString m_sGroupId;
92 : sal_Int32 m_nGroupIndex;
93 : VectorOfLeaves m_aLeaves;
94 : VectorOfGroupedLeaves m_aGroupedLeaves;
95 :
96 0 : OptionsNode( const OUString& rId,
97 : const OUString& rLabel,
98 : const OUString& rPageURL,
99 : bool bAllModules,
100 : const OUString& rGroupId,
101 : sal_Int32 nGroupIndex ) :
102 : m_sId( rId ),
103 : m_sLabel( rLabel ),
104 : m_sPageURL( rPageURL ),
105 : m_bAllModules( bAllModules ),
106 : m_sGroupId( rGroupId ),
107 0 : m_nGroupIndex( nGroupIndex ) {}
108 :
109 0 : ~OptionsNode()
110 0 : {
111 0 : for ( sal_uInt32 i = 0; i < m_aLeaves.size(); ++i )
112 0 : delete m_aLeaves[i];
113 0 : m_aLeaves.clear();
114 0 : m_aGroupedLeaves.clear();
115 0 : }
116 : };
117 :
118 : typedef ::std::vector< OptionsNode* > VectorOfNodes;
119 :
120 : struct LastPageSaver
121 : {
122 : sal_uInt16 m_nLastPageId;
123 : OUString m_sLastPageURL_Tools;
124 : OUString m_sLastPageURL_ExtMgr;
125 :
126 0 : LastPageSaver() : m_nLastPageId( USHRT_MAX ) {}
127 : };
128 :
129 : // class OfaTreeOptionsDialog --------------------------------------------
130 :
131 : namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
132 : namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } }
133 :
134 : struct OptionsPageInfo;
135 : struct Module;
136 : class ExtensionsTabPage;
137 : class SvxColorTabPage;
138 : typedef std::vector< ExtensionsTabPage* > VectorOfPages;
139 :
140 : class OfaTreeOptionsDialog : public SfxModalDialog
141 : {
142 : private:
143 : SvTreeListEntry* pCurrentPageEntry;
144 : Timer maTreeLayoutTimer;
145 : DECL_DLLPRIVATE_LINK( ImplHandleTreeLayoutTimerHdl, void* );
146 : bool hasTreePendingLayout() const;
147 :
148 : OKButton aOkPB;
149 : CancelButton aCancelPB;
150 : HelpButton aHelpPB;
151 : PushButton aBackPB;
152 :
153 : FixedLine aSeparatorFL;
154 :
155 : SvTreeListBox aTreeLB;
156 :
157 : String sTitle;
158 : String sNotLoadedError;
159 :
160 : // for the ColorTabPage
161 : SfxItemSet* pColorPageItemSet;
162 : SvxColorTabPage *mpColorPage;
163 :
164 : sal_Bool bForgetSelection;
165 : sal_Bool bExternBrowserActive;
166 : bool bIsFromExtensionManager;
167 :
168 : // check "for the current document only" and set focus to "Western" languages box
169 : bool bIsForSetDocumentLanguage;
170 :
171 : com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider >
172 : m_xContainerWinProvider;
173 :
174 : static LastPageSaver* pLastPageSaver;
175 :
176 : SfxItemSet* CreateItemSet( sal_uInt16 nId );
177 : void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
178 : void InitTreeAndHandler();
179 : void Initialize( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame );
180 : void ResizeTreeLB( void ); // resizes dialog so that treelistbox has no horizontal scroll bar
181 :
182 : void LoadExtensionOptions( const OUString& rExtensionId );
183 : OUString GetModuleIdentifier( const com::sun::star::uno::Reference<
184 : com::sun::star::frame::XFrame >& xFrame );
185 : Module* LoadModule( const OUString& rModuleIdentifier );
186 : VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
187 : void InsertNodes( const VectorOfNodes& rNodeList );
188 :
189 : virtual void queue_layout();
190 : void SetPaneSize(Window *pPane);
191 :
192 : protected:
193 : DECL_LINK(ExpandedHdl_Impl, SvTreeListBox* );
194 : DECL_LINK(ShowPageHdl_Impl, void *);
195 : DECL_LINK(BackHdl_Impl, void *);
196 : DECL_LINK(OKHdl_Impl, void *);
197 : DECL_LINK( HintHdl_Impl, Timer * );
198 : void SelectHdl_Impl();
199 :
200 : virtual long Notify( NotifyEvent& rNEvt );
201 : virtual short Execute();
202 :
203 : public:
204 : OfaTreeOptionsDialog( Window* pParent,
205 : const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame,
206 : bool bActivateLastSelection = true );
207 : OfaTreeOptionsDialog( Window* pParent, const OUString& rExtensionId );
208 : ~OfaTreeOptionsDialog();
209 :
210 : OptionsPageInfo* AddTabPage( sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup );
211 : sal_uInt16 AddGroup( const String& rGroupName, SfxShell* pCreateShell,
212 : SfxModule* pCreateModule, sal_uInt16 nDialogId );
213 :
214 : void ActivateLastSelection();
215 : void ActivatePage( sal_uInt16 nResId );
216 : void ActivatePage( const String& rPageURL );
217 : void ApplyItemSets();
218 :
219 : // helper functions to call the language settings TabPage from the SpellDialog
220 : static void ApplyLanguageOptions(const SfxItemSet& rSet);
221 : };
222 :
223 : // class OfaPageResource -------------------------------------------------
224 :
225 0 : class OfaPageResource : public Resource
226 : {
227 : ResStringArray aGeneralDlgAry;
228 : ResStringArray aInetDlgAry;
229 : ResStringArray aLangDlgAry;
230 : ResStringArray aTextDlgAry;
231 : ResStringArray aHTMLDlgAry;
232 : ResStringArray aCalcDlgAry;
233 : ResStringArray aStarMathDlgAry;
234 : ResStringArray aImpressDlgAry;
235 : ResStringArray aDrawDlgAry;
236 : ResStringArray aChartDlgAry;
237 : ResStringArray aFilterDlgAry;
238 : ResStringArray aDatasourcesDlgAry;
239 :
240 : public:
241 : OfaPageResource();
242 :
243 0 : ResStringArray& GetGeneralArray() {return aGeneralDlgAry;}
244 0 : ResStringArray& GetInetArray() {return aInetDlgAry;}
245 0 : ResStringArray& GetLangArray() {return aLangDlgAry;}
246 0 : ResStringArray& GetTextArray() {return aTextDlgAry;}
247 0 : ResStringArray& GetHTMLArray() {return aHTMLDlgAry;}
248 0 : ResStringArray& GetCalcArray() {return aCalcDlgAry;}
249 0 : ResStringArray& GetStarMathArray() {return aStarMathDlgAry;}
250 0 : ResStringArray& GetImpressArray() {return aImpressDlgAry;}
251 0 : ResStringArray& GetDrawArray() {return aDrawDlgAry;}
252 0 : ResStringArray& GetChartArray() {return aChartDlgAry;}
253 0 : ResStringArray& GetFilterArray() {return aFilterDlgAry;}
254 0 : ResStringArray& GetDatasourcesArray() {return aDatasourcesDlgAry;}
255 : };
256 :
257 : // class ExtensionsTabPage -----------------------------------------------
258 :
259 : namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
260 : namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowEventHandler; } } } }
261 :
262 : class ExtensionsTabPage : public TabPage
263 : {
264 : private:
265 : OUString m_sPageURL;
266 : com::sun::star::uno::Reference< com::sun::star::awt::XWindow >
267 : m_xPage;
268 : OUString m_sEventHdl;
269 : com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowEventHandler >
270 : m_xEventHdl;
271 : com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowProvider >
272 : m_xWinProvider;
273 : bool m_bIsWindowHidden;
274 :
275 : void CreateDialogWithHandler();
276 : sal_Bool DispatchAction( const OUString& rAction );
277 :
278 : public:
279 : ExtensionsTabPage(
280 : Window* pParent, WinBits nStyle,
281 : const OUString& rPageURL, const OUString& rEvtHdl,
282 : const com::sun::star::uno::Reference<
283 : com::sun::star::awt::XContainerWindowProvider >& rProvider );
284 :
285 : virtual ~ExtensionsTabPage();
286 :
287 : virtual void ActivatePage();
288 : virtual void DeactivatePage();
289 :
290 : void ResetPage();
291 : void SavePage();
292 : };
293 :
294 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|