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 : : #ifndef _CFGUTIL_HXX
29 : : #define _CFGUTIL_HXX
30 : :
31 : : #include <vector>
32 : : #include <boost/ptr_container/ptr_vector.hpp>
33 : : #include <rtl/ustring.hxx>
34 : : #include <tools/string.hxx>
35 : :
36 : : #include <com/sun/star/frame/XModel.hpp>
37 : : #include <com/sun/star/frame/XFrame.hpp>
38 : : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
39 : : #include <com/sun/star/container/XNameAccess.hpp>
40 : : #include <com/sun/star/script/browse/XBrowseNode.hpp>
41 : : #include <vcl/timer.hxx>
42 : : #include <svtools/svtabbx.hxx>
43 : : #include <svtools/svtreebx.hxx>
44 : : #include <vcl/image.hxx>
45 : :
46 : : class SfxMacroInfoItem;
47 : :
48 : : namespace css = ::com::sun::star;
49 : :
50 : 0 : struct SfxStyleInfo_Impl
51 : : {
52 : : ::rtl::OUString sFamily;
53 : : ::rtl::OUString sStyle;
54 : : ::rtl::OUString sCommand;
55 : : ::rtl::OUString sLabel;
56 : :
57 : 0 : SfxStyleInfo_Impl()
58 : 0 : {}
59 : :
60 : 0 : SfxStyleInfo_Impl(const SfxStyleInfo_Impl& rCopy)
61 : 0 : {
62 : 0 : sFamily = rCopy.sFamily;
63 : 0 : sStyle = rCopy.sStyle;
64 : 0 : sCommand = rCopy.sCommand;
65 : 0 : sLabel = rCopy.sLabel;
66 : 0 : }
67 : : };
68 : :
69 : 0 : struct SfxStylesInfo_Impl
70 : : {
71 : : private:
72 : :
73 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDoc;
74 : :
75 : : public:
76 : :
77 : : SfxStylesInfo_Impl();
78 : : void setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
79 : :
80 : : sal_Bool parseStyleCommand(SfxStyleInfo_Impl& aStyle);
81 : : void getLabel4Style(SfxStyleInfo_Impl& aStyle);
82 : :
83 : : ::std::vector< SfxStyleInfo_Impl > getStyleFamilies();
84 : : ::std::vector< SfxStyleInfo_Impl > getStyles(const ::rtl::OUString& sFamily);
85 : :
86 : : static ::rtl::OUString generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle);
87 : : };
88 : :
89 : : #define SFX_CFGGROUP_FUNCTION 1
90 : : #define SFX_CFGFUNCTION_SLOT 2
91 : : #define SFX_CFGGROUP_SCRIPTCONTAINER 3
92 : : #define SFX_CFGFUNCTION_SCRIPT 4
93 : : #define SFX_CFGGROUP_STYLES 5
94 : :
95 [ # # ]: 0 : struct SfxGroupInfo_Impl
96 : : {
97 : : sal_uInt16 nKind;
98 : : sal_uInt16 nUniqueID;
99 : : void* pObject;
100 : : sal_Bool bWasOpened;
101 : : String sCommand;
102 : : String sLabel;
103 : :
104 : 0 : SfxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, void* pObj = 0 ) :
105 [ # # ]: 0 : nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(sal_False) {}
106 : : };
107 : :
108 : : struct CuiMacroInfo
109 : : {
110 : : };
111 : :
112 : : typedef boost::ptr_vector<SfxGroupInfo_Impl> SfxGroupInfoArr_Impl;
113 : :
114 : : class SfxConfigFunctionListBox_Impl : public SvTreeListBox
115 : : {
116 : : friend class SfxConfigGroupListBox_Impl;
117 : : Timer aTimer;
118 : : SvLBoxEntry* pCurEntry;
119 : : SfxGroupInfoArr_Impl aArr;
120 : : SfxStylesInfo_Impl* pStylesInfo;
121 : :
122 : : DECL_LINK( TimerHdl, Timer* );
123 : : virtual void MouseMove( const MouseEvent& rMEvt );
124 : :
125 : : public:
126 : : SfxConfigFunctionListBox_Impl( Window*, const ResId& );
127 : : ~SfxConfigFunctionListBox_Impl();
128 : :
129 : : void ClearAll();
130 : : using Window::GetHelpText;
131 : : String GetHelpText( SvLBoxEntry *pEntry );
132 : : String GetCurCommand();
133 : : String GetCurLabel();
134 : : String GetSelectedScriptURI();
135 : : void FunctionSelected();
136 : : void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
137 : : };
138 : :
139 : : struct SvxConfigGroupBoxResource_Impl;
140 : : class SfxConfigGroupListBox_Impl : public SvTreeListBox
141 : : {
142 : : SvxConfigGroupBoxResource_Impl* pImp;
143 : : SfxConfigFunctionListBox_Impl* pFunctionListBox;
144 : : SfxGroupInfoArr_Impl aArr;
145 : : sal_uLong nMode;
146 : :
147 : : ::rtl::OUString m_sModuleLongName;
148 : : css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
149 : : css::uno::Reference< css::frame::XFrame > m_xFrame;
150 : : css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
151 : : css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
152 : : css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
153 : :
154 : : Image GetImage(
155 : : ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node,
156 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx,
157 : : bool bIsRootNode
158 : : );
159 : :
160 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel(
161 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx,
162 : : ::rtl::OUString& docName
163 : : );
164 : :
165 : :
166 : : void InitModule();
167 : : void InitBasic();
168 : : void InitStyles();
169 : :
170 : : ::rtl::OUString MapCommand2UIName(const ::rtl::OUString& sCommand);
171 : :
172 : : SfxStylesInfo_Impl* pStylesInfo;
173 : :
174 : : protected:
175 : : virtual void RequestingChildren( SvLBoxEntry *pEntry);
176 : : using SvListView::Expand;
177 : : virtual sal_Bool Expand( SvLBoxEntry* pParent );
178 : :
179 : : public:
180 : : SfxConfigGroupListBox_Impl ( Window* pParent,
181 : : const ResId&,
182 : : sal_uLong nConfigMode = 0 );
183 : : ~SfxConfigGroupListBox_Impl();
184 : : void ClearAll();
185 : :
186 : : void Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
187 : : const css::uno::Reference< css::frame::XFrame >& xFrame ,
188 : : const ::rtl::OUString& sModuleLongName);
189 : 0 : void SetFunctionListBox( SfxConfigFunctionListBox_Impl *pBox )
190 : 0 : { pFunctionListBox = pBox; }
191 : : void Open( SvLBoxEntry*, sal_Bool );
192 : : void GroupSelected();
193 : : void SelectMacro( const SfxMacroInfoItem* );
194 : : void SelectMacro( const String&, const String& );
195 : : String GetGroup();
196 : : void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
197 : : };
198 : :
199 : : #endif
200 : :
201 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|