bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / cfgutil.hxx
blobc6ba6eaaae218c8ea8eecc03a106d898cd0a9f57
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_CUI_SOURCE_INC_CFGUTIL_HXX
20 #define INCLUDED_CUI_SOURCE_INC_CFGUTIL_HXX
22 #include <vector>
23 #include <boost/ptr_container/ptr_vector.hpp>
24 #include <rtl/ustring.hxx>
26 #include <com/sun/star/frame/XModel.hpp>
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <com/sun/star/script/browse/XBrowseNode.hpp>
31 #include <vcl/timer.hxx>
32 #include <svtools/svtabbx.hxx>
33 #include <svtools/treelistbox.hxx>
34 #include <vcl/image.hxx>
36 class SfxMacroInfoItem;
38 struct SfxStyleInfo_Impl
40 OUString sFamily;
41 OUString sStyle;
42 OUString sCommand;
43 OUString sLabel;
45 SfxStyleInfo_Impl()
48 SfxStyleInfo_Impl(const SfxStyleInfo_Impl& rCopy)
50 sFamily = rCopy.sFamily;
51 sStyle = rCopy.sStyle;
52 sCommand = rCopy.sCommand;
53 sLabel = rCopy.sLabel;
57 struct SfxStylesInfo_Impl
59 private:
61 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDoc;
63 public:
65 SfxStylesInfo_Impl();
66 void setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
68 static bool parseStyleCommand(SfxStyleInfo_Impl& aStyle);
69 void getLabel4Style(SfxStyleInfo_Impl& aStyle);
71 ::std::vector< SfxStyleInfo_Impl > getStyleFamilies();
72 ::std::vector< SfxStyleInfo_Impl > getStyles(const OUString& sFamily);
74 static OUString generateCommand(const OUString& sFamily, const OUString& sStyle);
77 #define SFX_CFGGROUP_FUNCTION 1
78 #define SFX_CFGFUNCTION_SLOT 2
79 #define SFX_CFGGROUP_SCRIPTCONTAINER 3
80 #define SFX_CFGFUNCTION_SCRIPT 4
81 #define SFX_CFGGROUP_STYLES 5
83 struct SfxGroupInfo_Impl
85 sal_uInt16 nKind;
86 sal_uInt16 nUniqueID;
87 void* pObject;
88 bool bWasOpened;
89 OUString sCommand;
90 OUString sLabel;
92 SfxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, void* pObj = 0 ) :
93 nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {}
96 typedef boost::ptr_vector<SfxGroupInfo_Impl> SfxGroupInfoArr_Impl;
98 class SfxConfigFunctionListBox : public SvTreeListBox
100 friend class SfxConfigGroupListBox;
101 SvTreeListEntry* pCurEntry;
102 SfxGroupInfoArr_Impl aArr;
103 SfxStylesInfo_Impl* pStylesInfo;
105 virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
107 public:
108 SfxConfigFunctionListBox(vcl::Window*, WinBits nStyle);
109 virtual ~SfxConfigFunctionListBox();
110 virtual void dispose() SAL_OVERRIDE;
112 void ClearAll();
113 using Window::GetHelpText;
114 OUString GetHelpText( SvTreeListEntry *pEntry );
115 OUString GetCurCommand();
116 OUString GetCurLabel();
117 OUString GetSelectedScriptURI();
118 void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
121 struct SvxConfigGroupBoxResource_Impl;
122 class SfxConfigGroupListBox : public SvTreeListBox
124 SvxConfigGroupBoxResource_Impl* pImp;
125 VclPtr<SfxConfigFunctionListBox> pFunctionListBox;
126 SfxGroupInfoArr_Impl aArr;
128 OUString m_sModuleLongName;
129 css::uno::Reference< css::uno::XComponentContext > m_xContext;
130 css::uno::Reference< css::frame::XFrame > m_xFrame;
131 css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
132 css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
133 css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
135 Image GetImage(
136 ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node,
137 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx,
138 bool bIsRootNode
141 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel(
142 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx,
143 OUString& docName
147 void InitModule();
149 OUString MapCommand2UIName(const OUString& sCommand);
151 SfxStylesInfo_Impl* pStylesInfo;
153 protected:
154 virtual void RequestingChildren( SvTreeListEntry *pEntry) SAL_OVERRIDE;
155 virtual bool Expand( SvTreeListEntry* pParent ) SAL_OVERRIDE;
157 public:
158 SfxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
159 virtual ~SfxConfigGroupListBox();
160 virtual void dispose() SAL_OVERRIDE;
161 void ClearAll();
163 void Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
164 const css::uno::Reference< css::frame::XFrame >& xFrame,
165 const OUString& sModuleLongName,
166 bool bEventMode);
167 void SetFunctionListBox( SfxConfigFunctionListBox *pBox )
168 { pFunctionListBox = pBox; }
169 void Open( SvTreeListEntry*, bool );
170 void GroupSelected();
171 void SelectMacro( const SfxMacroInfoItem* );
172 void SelectMacro( const OUString&, const OUString& );
173 void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
176 #endif
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */