1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_TREEOPT_HXX
21 #define INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX
23 #include <tools/resary.hxx>
24 #include <vcl/fixed.hxx>
29 // static ----------------------------------------------------------------
32 CreateTabPage
GetSSOCreator();
34 // struct OrderedEntry ---------------------------------------------------
41 OrderedEntry( sal_Int32 nIndex
, const OUString
& rId
) :
42 m_nIndex( nIndex
), m_sId( rId
) {}
45 typedef std::vector
< OrderedEntry
* > VectorOfOrderedEntries
;
47 // struct Module ---------------------------------------------------------
53 VectorOfOrderedEntries m_aNodeList
;
55 Module( const OUString
& rName
) : m_sName( rName
), m_bActive( false ) {}
58 // struct OptionsLeaf ----------------------------------------------------
67 sal_Int32 m_nGroupIndex
;
69 OptionsLeaf( const OUString
& rId
,
70 const OUString
& rLabel
,
71 const OUString
& rPageURL
,
72 const OUString
& rEventHdl
,
73 const OUString
& rGroupId
,
74 sal_Int32 nGroupIndex
) :
77 m_sPageURL( rPageURL
),
78 m_sEventHdl( rEventHdl
),
79 m_sGroupId( rGroupId
),
80 m_nGroupIndex( nGroupIndex
) {}
83 typedef ::std::vector
< OptionsLeaf
* > VectorOfLeaves
;
84 typedef ::std::vector
< VectorOfLeaves
> VectorOfGroupedLeaves
;
86 // struct OptionsNode ----------------------------------------------------
95 sal_Int32 m_nGroupIndex
;
96 VectorOfLeaves m_aLeaves
;
97 VectorOfGroupedLeaves m_aGroupedLeaves
;
99 OptionsNode( const OUString
& rId
,
100 const OUString
& rLabel
,
101 const OUString
& rPageURL
,
103 const OUString
& rGroupId
,
104 sal_Int32 nGroupIndex
) :
107 m_sPageURL( rPageURL
),
108 m_bAllModules( bAllModules
),
109 m_sGroupId( rGroupId
),
110 m_nGroupIndex( nGroupIndex
) {}
114 for ( sal_uInt32 i
= 0; i
< m_aLeaves
.size(); ++i
)
117 m_aGroupedLeaves
.clear();
121 typedef ::std::vector
< OptionsNode
* > VectorOfNodes
;
125 sal_uInt16 m_nLastPageId
;
126 OUString m_sLastPageURL_Tools
;
127 OUString m_sLastPageURL_ExtMgr
;
129 LastPageSaver() : m_nLastPageId( USHRT_MAX
) {}
132 // class OfaTreeOptionsDialog --------------------------------------------
134 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{ class XFrame
; } } } }
135 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XContainerWindowProvider
; } } } }
137 struct OptionsPageInfo
;
139 class ExtensionsTabPage
;
140 class SvxColorTabPage
;
141 typedef std::vector
< ExtensionsTabPage
* > VectorOfPages
;
143 class OfaTreeOptionsDialog
: public SfxModalDialog
146 SvTreeListEntry
* pCurrentPageEntry
;
147 bool hasTreePendingLayout() const;
149 VclPtr
<OKButton
> pOkPB
;
150 VclPtr
<PushButton
> pBackPB
;
152 VclPtr
<SvTreeListBox
> pTreeLB
;
153 VclPtr
<VclBox
> pTabBox
;
156 OUString sNotLoadedError
;
158 // for the ColorTabPage
159 SfxItemSet
* pColorPageItemSet
;
160 VclPtr
<SvxColorTabPage
> mpColorPage
;
162 bool bForgetSelection
;
163 bool bIsFromExtensionManager
;
165 // check "for the current document only" and set focus to "Western" languages box
166 bool bIsForSetDocumentLanguage
;
168 com::sun::star::uno::Reference
< com::sun::star::awt::XContainerWindowProvider
>
169 m_xContainerWinProvider
;
171 static LastPageSaver
* pLastPageSaver
;
173 SfxItemSet
* CreateItemSet( sal_uInt16 nId
);
174 static void ApplyItemSet( sal_uInt16 nId
, const SfxItemSet
& rSet
);
175 void InitTreeAndHandler();
176 void Initialize( const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& _xFrame
);
179 void LoadExtensionOptions( const OUString
& rExtensionId
);
180 static OUString
GetModuleIdentifier( const com::sun::star::uno::Reference
<
181 com::sun::star::frame::XFrame
>& xFrame
);
182 static Module
* LoadModule( const OUString
& rModuleIdentifier
);
183 static VectorOfNodes
LoadNodes( Module
* pModule
, const OUString
& rExtensionId
);
184 void InsertNodes( const VectorOfNodes
& rNodeList
);
187 DECL_STATIC_LINK(OfaTreeOptionsDialog
, ExpandedHdl_Impl
, SvTreeListBox
* );
188 DECL_LINK(ShowPageHdl_Impl
, void *);
189 DECL_LINK(BackHdl_Impl
, void *);
190 DECL_LINK(OKHdl_Impl
, void *);
191 DECL_LINK( HintHdl_Impl
, Timer
* );
192 void SelectHdl_Impl();
194 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
195 virtual short Execute() SAL_OVERRIDE
;
198 OfaTreeOptionsDialog( vcl::Window
* pParent
,
199 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& _xFrame
,
200 bool bActivateLastSelection
= true );
201 OfaTreeOptionsDialog( vcl::Window
* pParent
, const OUString
& rExtensionId
);
202 virtual ~OfaTreeOptionsDialog();
203 virtual void dispose() SAL_OVERRIDE
;
205 OptionsPageInfo
* AddTabPage( sal_uInt16 nId
, const OUString
& rPageName
, sal_uInt16 nGroup
);
206 sal_uInt16
AddGroup( const OUString
& rGroupName
, SfxShell
* pCreateShell
,
207 SfxModule
* pCreateModule
, sal_uInt16 nDialogId
);
209 void ActivateLastSelection();
210 void ActivatePage( sal_uInt16 nResId
);
211 void ActivatePage( const OUString
& rPageURL
);
212 void ApplyItemSets();
214 // helper functions to call the language settings TabPage from the SpellDialog
215 static void ApplyLanguageOptions(const SfxItemSet
& rSet
);
218 // class OfaPageResource -------------------------------------------------
220 class OfaPageResource
: public Resource
222 ResStringArray aGeneralDlgAry
;
223 ResStringArray aInetDlgAry
;
224 ResStringArray aLangDlgAry
;
225 ResStringArray aTextDlgAry
;
226 ResStringArray aHTMLDlgAry
;
227 ResStringArray aCalcDlgAry
;
228 ResStringArray aStarMathDlgAry
;
229 ResStringArray aImpressDlgAry
;
230 ResStringArray aDrawDlgAry
;
231 ResStringArray aChartDlgAry
;
232 ResStringArray aFilterDlgAry
;
233 ResStringArray aDatasourcesDlgAry
;
238 ResStringArray
& GetGeneralArray() {return aGeneralDlgAry
;}
239 ResStringArray
& GetInetArray() {return aInetDlgAry
;}
240 ResStringArray
& GetLangArray() {return aLangDlgAry
;}
241 ResStringArray
& GetTextArray() {return aTextDlgAry
;}
242 ResStringArray
& GetHTMLArray() {return aHTMLDlgAry
;}
243 ResStringArray
& GetCalcArray() {return aCalcDlgAry
;}
244 ResStringArray
& GetStarMathArray() {return aStarMathDlgAry
;}
245 ResStringArray
& GetImpressArray() {return aImpressDlgAry
;}
246 ResStringArray
& GetDrawArray() {return aDrawDlgAry
;}
247 ResStringArray
& GetChartArray() {return aChartDlgAry
;}
248 ResStringArray
& GetFilterArray() {return aFilterDlgAry
;}
249 ResStringArray
& GetDatasourcesArray() {return aDatasourcesDlgAry
;}
252 // class ExtensionsTabPage -----------------------------------------------
254 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XWindow
; } } } }
255 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XContainerWindowEventHandler
; } } } }
257 class ExtensionsTabPage
: public TabPage
261 com::sun::star::uno::Reference
< com::sun::star::awt::XWindow
>
263 OUString m_sEventHdl
;
264 com::sun::star::uno::Reference
< com::sun::star::awt::XContainerWindowEventHandler
>
266 com::sun::star::uno::Reference
< com::sun::star::awt::XContainerWindowProvider
>
268 bool m_bIsWindowHidden
;
270 void CreateDialogWithHandler();
271 bool DispatchAction( const OUString
& rAction
);
275 vcl::Window
* pParent
, WinBits nStyle
,
276 const OUString
& rPageURL
, const OUString
& rEvtHdl
,
277 const com::sun::star::uno::Reference
<
278 com::sun::star::awt::XContainerWindowProvider
>& rProvider
);
280 virtual ~ExtensionsTabPage();
281 virtual void dispose() SAL_OVERRIDE
;
283 virtual void ActivatePage() SAL_OVERRIDE
;
284 virtual void DeactivatePage() SAL_OVERRIDE
;
292 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */