update dev300-m58
[ooovba.git] / svx / source / cui / cfgutil.hxx
blob0f789ee0b8e05c7a0654b756000db85ad3285bcf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cfg.hxx,v $
10 * $Revision: 1.41 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CFGUTIL_HXX
31 #define _CFGUTIL_HXX
33 #include <vector>
34 #include <rtl/ustring.hxx>
35 #include <tools/string.hxx>
37 #include <com/sun/star/frame/XModel.hpp>
38 #include <com/sun/star/frame/XFrame.hpp>
39 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
40 #include <com/sun/star/container/XNameAccess.hpp>
41 #include <com/sun/star/script/browse/XBrowseNode.hpp>
43 #define _SVSTDARR_STRINGSDTOR
44 #include <svtools/svstdarr.hxx>
46 #include <vcl/timer.hxx>
47 #include <svtools/svtabbx.hxx>
48 #include <svtools/svtreebx.hxx>
49 #include <vcl/image.hxx>
51 class BasicManager;
52 class SfxSlotPool;
53 class SfxStringItem;
54 class SfxFontItem;
55 class SfxMacroInfoItem;
56 class SfxMacroInfo;
57 struct SfxStyleInfo_Impl;
58 struct SfxStylesInfo_Impl;
60 #define css ::com::sun::star
62 struct SfxStyleInfo_Impl
64 ::rtl::OUString sFamily;
65 ::rtl::OUString sStyle;
66 ::rtl::OUString sCommand;
67 ::rtl::OUString sLabel;
69 SfxStyleInfo_Impl()
72 SfxStyleInfo_Impl(const SfxStyleInfo_Impl& rCopy)
74 sFamily = rCopy.sFamily;
75 sStyle = rCopy.sStyle;
76 sCommand = rCopy.sCommand;
77 sLabel = rCopy.sLabel;
81 struct SfxStylesInfo_Impl
83 private:
85 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDoc;
87 public:
89 SfxStylesInfo_Impl();
90 void setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
92 sal_Bool parseStyleCommand(SfxStyleInfo_Impl& aStyle);
93 void getLabel4Style(SfxStyleInfo_Impl& aStyle);
95 ::std::vector< SfxStyleInfo_Impl > getStyleFamilies();
96 ::std::vector< SfxStyleInfo_Impl > getStyles(const ::rtl::OUString& sFamily);
98 static ::rtl::OUString generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle);
101 #define SFX_CFGGROUP_FUNCTION 1
102 #define SFX_CFGGROUP_BASICMGR 2
103 #define SFX_CFGGROUP_DOCBASICMGR 3
104 #define SFX_CFGGROUP_BASICLIB 4
105 #define SFX_CFGGROUP_BASICMOD 5
106 #define SFX_CFGFUNCTION_MACRO 6
107 #define SFX_CFGFUNCTION_SLOT 7
108 #define SFX_CFGGROUP_SCRIPTCONTAINER 8
109 #define SFX_CFGFUNCTION_SCRIPT 9
110 #define SFX_CFGGROUP_STYLES 10
111 #define SFX_CFGGROUP_SPECIALCHARACTERS 11
113 struct SfxGroupInfo_Impl
115 USHORT nKind;
116 USHORT nOrd;
117 void* pObject;
118 BOOL bWasOpened;
119 String sCommand;
120 String sLabel;
122 SfxGroupInfo_Impl( USHORT n, USHORT nr, void* pObj = 0 ) :
123 nKind( n ), nOrd( nr ), pObject( pObj ), bWasOpened(FALSE) {}
126 typedef SfxGroupInfo_Impl* SfxGroupInfoPtr;
127 SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl, SfxGroupInfoPtr, 5, 5)
129 class SfxConfigFunctionListBox_Impl : public SvTreeListBox
131 friend class SfxConfigGroupListBox_Impl;
132 Timer aTimer;
133 SvLBoxEntry* pCurEntry;
134 SfxGroupInfoArr_Impl aArr;
135 SfxStylesInfo_Impl* pStylesInfo;
137 DECL_LINK( TimerHdl, Timer* );
138 virtual void MouseMove( const MouseEvent& rMEvt );
140 public:
141 SfxConfigFunctionListBox_Impl( Window*, const ResId& );
142 ~SfxConfigFunctionListBox_Impl();
144 void ClearAll();
145 SvLBoxEntry* GetEntry_Impl( USHORT nId );
146 SvLBoxEntry* GetEntry_Impl( const String& );
147 USHORT GetId( SvLBoxEntry *pEntry );
148 using Window::GetHelpText;
149 String GetHelpText( SvLBoxEntry *pEntry );
150 USHORT GetCurId() { return GetId( FirstSelected() ); }
151 String GetCurCommand();
152 String GetCurLabel();
153 SfxMacroInfo* GetMacroInfo();
154 void FunctionSelected();
155 void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
158 struct SvxConfigGroupBoxResource_Impl;
159 class SfxConfigGroupListBox_Impl : public SvTreeListBox
161 SvxConfigGroupBoxResource_Impl* pImp;
162 //SfxSlotPool* pSlotPool;
163 SfxConfigFunctionListBox_Impl* pFunctionListBox;
164 SfxGroupInfoArr_Impl aArr;
165 ULONG nMode;
166 BOOL bShowSF; // show Scripting Framework scripts
167 BOOL bShowBasic; // show Basic scripts
169 ::rtl::OUString m_sModuleLongName;
170 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
171 css::uno::Reference< css::frame::XFrame > m_xFrame;
172 css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
173 css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
174 css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
176 Image GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx, bool bIsRootNode, bool bHighContrast );
178 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName );
179 ::rtl::OUString parseLocationName( const ::rtl::OUString& location );
181 void InitModule();
182 void InitBasic();
183 void InitStyles();
185 ::rtl::OUString MapCommand2UIName(const ::rtl::OUString& sCommand);
187 SfxStylesInfo_Impl* pStylesInfo;
189 protected:
190 virtual void RequestingChilds( SvLBoxEntry *pEntry);
191 using SvListView::Expand;
192 virtual BOOL Expand( SvLBoxEntry* pParent );
194 public:
195 SfxConfigGroupListBox_Impl ( Window* pParent,
196 const ResId&,
197 ULONG nConfigMode = 0 );
198 ~SfxConfigGroupListBox_Impl();
199 void ClearAll();
201 void Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
202 const css::uno::Reference< css::frame::XFrame >& xFrame ,
203 const ::rtl::OUString& sModuleLongName);
204 void SetFunctionListBox( SfxConfigFunctionListBox_Impl *pBox )
205 { pFunctionListBox = pBox; }
206 void Open( SvLBoxEntry*, BOOL );
207 void GroupSelected();
208 void SelectMacro( const SfxMacroInfoItem* );
209 void AddAndSelect( const SfxStringItem*, const SfxStringItem* );
210 void SelectMacro( const String&, const String& );
211 String GetGroup();
212 BasicManager* GetBasicManager( const SvLBoxEntry& _rEntry );
213 void SetScriptType( const String& rScriptType );
214 void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
217 #undef css
219 #endif