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 .
19 #ifndef INCLUDED_SW_INC_UNOCOLL_HXX
20 #define INCLUDED_SW_INC_UNOCOLL_HXX
22 #include "flyenum.hxx"
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/container/XEnumerationAccess.hpp>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/container/XIndexAccess.hpp>
27 #include <cppuhelper/implbase.hxx>
32 namespace com::sun::star::text
38 class SwFormatFootnote
;
39 class SwSectionFormat
;
40 struct SvEventDescription
;
45 const SvEventDescription
* sw_GetSupportedMacroItems();
52 SwUnoCollection(SwDoc
* p
) :
55 virtual ~SwUnoCollection() {}
57 virtual void Invalidate();
60 bool IsValid() const { return m_pDoc
; }
62 SwDoc
& GetDoc() const;
65 /** entries in this enum are mapped in an array in unocoll.cxx */
66 enum class SwServiceType
{
82 ContentIndexMark
= 15,
87 FieldTypeDateTime
= 20,
91 FieldTypeFileName
= 24,
92 FieldTypePageNum
= 25,
94 FieldTypeChapter
= 27,
96 FieldTypeGetReference
= 29,
97 FieldTypeConditionedText
= 30,
98 FieldTypeAnnotation
= 31,
102 FieldTypeHiddenPara
= 35,
103 FieldTypeDocInfo
= 36,
104 FieldTypeTemplateName
= 37,
105 FieldTypeUserExt
= 38,
106 FieldTypeRefPageSet
= 39,
107 FieldTypeRefPageGet
= 40,
108 FieldTypeJumpEdit
= 41,
109 FieldTypeScript
= 42,
110 FieldTypeDatabaseNextSet
= 43,
111 FieldTypeDatabaseNumSet
= 44,
112 FieldTypeDatabaseSetNum
= 45,
113 FieldTypeDatabase
= 46,
114 FieldTypeDatabaseName
= 47,
115 FieldTypeTableFormula
= 48,
116 FieldTypePageCount
= 49,
117 FieldTypeParagraphCount
= 50,
118 FieldTypeWordCount
= 51,
119 FieldTypeCharacterCount
= 52,
120 FieldTypeTableCount
= 53,
121 FieldTypeGraphicObjectCount
= 54,
122 FieldTypeEmbeddedObjectCount
= 55,
123 FieldTypeDocInfoChangeAuthor
= 56,
124 FieldTypeDocInfoChangeDateTime
= 57,
125 FieldTypeDocInfoEditTime
= 58,
126 FieldTypeDocInfoDescription
= 59,
127 FieldTypeDocInfoCreateAuthor
= 60,
128 FieldTypeDocInfoCreateDateTime
= 61,
129 FieldTypeDummy1
= 63,
130 FieldTypeDummy2
= 64,
131 FieldTypeDummy3
= 65,
132 FieldTypeDocInfoCustom
= 66,
133 FieldTypeDocInfoPrintAuthor
= 67,
134 FieldTypeDocInfoPrintDateTime
= 68,
135 FieldTypeDocInfoKeywords
= 69,
136 FieldTypeDocInfoSubject
= 70,
137 FieldTypeDocInfoTitle
= 71,
138 FieldTypeDocInfoRevision
= 72,
139 FieldTypeBibliography
= 73,
140 FieldTypeCombinedCharacters
= 74,
141 FieldTypeDropdown
= 75,
142 FieldTypeMetafield
= 76,
143 FieldTypeDummy4
= 77,
144 FieldTypeDummy5
= 78,
145 FieldTypeDummy6
= 79,
146 FieldTypeDummy7
= 80,
147 FieldMasterUser
= 81,
149 FieldMasterSetExp
= 83,
150 FieldMasterDatabase
= 84,
151 FieldMasterBibliography
= 85,
152 FieldMasterDummy2
= 86,
153 FieldMasterDummy3
= 87,
154 FieldMasterDummy4
= 88,
155 FieldMasterDummy5
= 89,
156 IndexIllustrations
= 90,
159 IndexBibliography
= 93,
161 FieldTypeInputUser
= 95,
162 FieldTypeHiddenText
= 96,
163 StyleConditionalParagraph
= 97,
166 IndexHeaderSection
= 100,
171 TypeTextGraphic
= 105,
172 Chart2DataProvider
= 106,
174 TypeFormFieldMark
= 108,
176 VbaObjectProvider
= 110,
177 VbaCodeNameProvider
= 111,
178 VbaProjectNameProvider
= 112,
183 ContentControl
= 117,
188 // case-corrected versions of service-names (see #i67811)
190 #define CSS_TEXT_TEXTFIELD_DATE_TIME "com.sun.star.text.textfield.DateTime"
191 #define CSS_TEXT_TEXTFIELD_USER "com.sun.star.text.textfield.User"
192 #define CSS_TEXT_TEXTFIELD_SET_EXPRESSION "com.sun.star.text.textfield.SetExpression"
193 #define CSS_TEXT_TEXTFIELD_GET_EXPRESSION "com.sun.star.text.textfield.GetExpression"
194 #define CSS_TEXT_TEXTFIELD_FILE_NAME "com.sun.star.text.textfield.FileName"
195 #define CSS_TEXT_TEXTFIELD_PAGE_NUMBER "com.sun.star.text.textfield.PageNumber"
196 #define CSS_TEXT_TEXTFIELD_AUTHOR "com.sun.star.text.textfield.Author"
197 #define CSS_TEXT_TEXTFIELD_CHAPTER "com.sun.star.text.textfield.Chapter"
198 #define CSS_TEXT_TEXTFIELD_GET_REFERENCE "com.sun.star.text.textfield.GetReference"
199 #define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT "com.sun.star.text.textfield.ConditionalText"
200 #define CSS_TEXT_TEXTFIELD_ANNOTATION "com.sun.star.text.textfield.Annotation"
201 #define CSS_TEXT_TEXTFIELD_INPUT "com.sun.star.text.textfield.Input"
202 #define CSS_TEXT_TEXTFIELD_MACRO "com.sun.star.text.textfield.Macro"
203 #define CSS_TEXT_TEXTFIELD_DDE "com.sun.star.text.textfield.DDE"
204 #define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH "com.sun.star.text.textfield.HiddenParagraph"
205 #define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME "com.sun.star.text.textfield.TemplateName"
206 #define CSS_TEXT_TEXTFIELD_EXTENDED_USER "com.sun.star.text.textfield.ExtendedUser"
207 #define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET "com.sun.star.text.textfield.ReferencePageSet"
208 #define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET "com.sun.star.text.textfield.ReferencePageGet"
209 #define CSS_TEXT_TEXTFIELD_JUMP_EDIT "com.sun.star.text.textfield.JumpEdit"
210 #define CSS_TEXT_TEXTFIELD_SCRIPT "com.sun.star.text.textfield.Script"
211 #define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET "com.sun.star.text.textfield.DatabaseNextSet"
212 #define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET "com.sun.star.text.textfield.DatabaseNumberOfSet"
213 #define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER "com.sun.star.text.textfield.DatabaseSetNumber"
214 #define CSS_TEXT_TEXTFIELD_DATABASE "com.sun.star.text.textfield.Database"
215 #define CSS_TEXT_TEXTFIELD_DATABASE_NAME "com.sun.star.text.textfield.DatabaseName"
216 #define CSS_TEXT_TEXTFIELD_TABLE_FORMULA "com.sun.star.text.textfield.TableFormula"
217 #define CSS_TEXT_TEXTFIELD_PAGE_COUNT "com.sun.star.text.textfield.PageCount"
218 #define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT "com.sun.star.text.textfield.ParagraphCount"
219 #define CSS_TEXT_TEXTFIELD_WORD_COUNT "com.sun.star.text.textfield.WordCount"
220 #define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT "com.sun.star.text.textfield.CharacterCount"
221 #define CSS_TEXT_TEXTFIELD_TABLE_COUNT "com.sun.star.text.textfield.TableCount"
222 #define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT "com.sun.star.text.textfield.GraphicObjectCount"
223 #define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT "com.sun.star.text.textfield.EmbeddedObjectCount"
224 #define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR "com.sun.star.text.textfield.docinfo.ChangeAuthor"
225 #define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME "com.sun.star.text.textfield.docinfo.ChangeDateTime"
226 #define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME "com.sun.star.text.textfield.docinfo.EditTime"
227 #define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION "com.sun.star.text.textfield.docinfo.Description"
228 #define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR "com.sun.star.text.textfield.docinfo.CreateAuthor"
229 #define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME "com.sun.star.text.textfield.docinfo.CreateDateTime"
230 #define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR "com.sun.star.text.textfield.docinfo.PrintAuthor"
231 #define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME "com.sun.star.text.textfield.docinfo.PrintDateTime"
232 #define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS "com.sun.star.text.textfield.docinfo.KeyWords"
233 #define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT "com.sun.star.text.textfield.docinfo.Subject"
234 #define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE "com.sun.star.text.textfield.docinfo.Title"
235 #define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION "com.sun.star.text.textfield.docinfo.Revision"
236 #define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM "com.sun.star.text.textfield.docinfo.Custom"
237 #define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY "com.sun.star.text.textfield.Bibliography"
238 #define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS "com.sun.star.text.textfield.CombinedCharacters"
239 #define CSS_TEXT_TEXTFIELD_DROP_DOWN "com.sun.star.text.textfield.DropDown"
240 #define CSS_TEXT_TEXTFIELD_INPUT_USER "com.sun.star.text.textfield.InputUser"
241 #define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT "com.sun.star.text.textfield.HiddenText"
242 #define CSS_TEXT_FIELDMASTER_USER "com.sun.star.text.fieldmaster.User"
243 #define CSS_TEXT_FIELDMASTER_DDE "com.sun.star.text.fieldmaster.DDE"
244 #define CSS_TEXT_FIELDMASTER_SET_EXPRESSION "com.sun.star.text.fieldmaster.SetExpression"
245 #define CSS_TEXT_FIELDMASTER_DATABASE "com.sun.star.text.fieldmaster.Database"
246 #define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY "com.sun.star.text.fieldmaster.Bibliography"
248 class SwXServiceProvider
251 static OUString
GetProviderName(SwServiceType nObjectType
);
252 static SwServiceType
GetProviderType(std::u16string_view rServiceName
);
253 static css::uno::Reference
< css::uno::XInterface
> MakeInstance(SwServiceType nObjectType
, SwDoc
& rDoc
);
254 static css::uno::Sequence
<OUString
> GetAllServiceNames();
261 css::container::XNameAccess
,
262 css::container::XIndexAccess
,
263 css::lang::XServiceInfo
265 SwCollectionBaseClass
;
266 class SW_DLLPUBLIC SwXTextTables final
: public SwCollectionBaseClass
,
267 public SwUnoCollection
269 virtual ~SwXTextTables() override
;
271 SwXTextTables(SwDoc
* pDoc
);
274 virtual sal_Int32 SAL_CALL
getCount( ) override
;
275 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
278 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
279 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
280 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
283 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
284 virtual sal_Bool SAL_CALL
hasElements( ) override
;
287 virtual OUString SAL_CALL
getImplementationName() override
;
288 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
289 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
291 rtl::Reference
<SwXTextTable
> getTextTableByName(std::u16string_view Name
);
293 static rtl::Reference
<SwXTextTable
> GetObject(SwFrameFormat
& rFormat
);
299 css::container::XEnumerationAccess
,
300 css::container::XNameAccess
,
301 css::container::XIndexAccess
,
302 css::lang::XServiceInfo
303 > SwXFramesBaseClass
;
305 class SwXFrames
: public SwXFramesBaseClass
,
306 public SwUnoCollection
308 const FlyCntType m_eType
;
310 virtual ~SwXFrames() override
;
312 SwXFrames(SwDoc
* pDoc
, FlyCntType eSet
);
315 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
createEnumeration() override
;
318 virtual sal_Int32 SAL_CALL
getCount() override
;
319 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
322 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
323 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
324 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
327 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
328 virtual sal_Bool SAL_CALL
hasElements( ) override
;
331 virtual OUString SAL_CALL
getImplementationName() override
;
332 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
333 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
336 class SwXTextFrames final
: public SwXFrames
338 virtual ~SwXTextFrames() override
;
340 SwXTextFrames(SwDoc
* pDoc
);
343 virtual OUString SAL_CALL
getImplementationName() override
;
344 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
345 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
349 class SwXTextGraphicObjects final
: public SwXFrames
351 virtual ~SwXTextGraphicObjects() override
;
353 SwXTextGraphicObjects(SwDoc
* pDoc
);
356 virtual OUString SAL_CALL
getImplementationName() override
;
357 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
358 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
362 class SwXTextEmbeddedObjects final
: public SwXFrames
364 virtual ~SwXTextEmbeddedObjects() override
;
366 SwXTextEmbeddedObjects(SwDoc
* pDoc
);
369 virtual OUString SAL_CALL
getImplementationName() override
;
370 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
371 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
375 class SwXTextSections final
: public SwCollectionBaseClass
,
376 public SwUnoCollection
378 virtual ~SwXTextSections() override
;
380 SwXTextSections(SwDoc
* pDoc
);
383 virtual sal_Int32 SAL_CALL
getCount() override
;
384 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
387 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
388 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
389 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
392 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
393 virtual sal_Bool SAL_CALL
hasElements( ) override
;
396 virtual OUString SAL_CALL
getImplementationName() override
;
397 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
398 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
400 static rtl::Reference
<SwXTextSection
> GetObject( SwSectionFormat
& rFormat
);
403 class SwXBookmarks final
: public SwCollectionBaseClass
,
404 public SwUnoCollection
406 virtual ~SwXBookmarks() override
;
408 SwXBookmarks(SwDoc
* pDoc
);
411 virtual sal_Int32 SAL_CALL
getCount() override
;
412 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
415 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
416 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
417 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
420 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
421 virtual sal_Bool SAL_CALL
hasElements( ) override
;
424 virtual OUString SAL_CALL
getImplementationName() override
;
425 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
426 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
430 class SwXNumberingRulesCollection final
: public cppu::WeakImplHelper
432 css::container::XIndexAccess
434 public SwUnoCollection
436 virtual ~SwXNumberingRulesCollection() override
;
439 SwXNumberingRulesCollection( SwDoc
* pDoc
);
442 virtual sal_Int32 SAL_CALL
getCount() override
;
443 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
446 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
447 virtual sal_Bool SAL_CALL
hasElements( ) override
;
453 css::container::XIndexAccess
,
454 css::lang::XServiceInfo
456 SwSimpleIndexAccessBaseClass
;
458 class SAL_DLLPUBLIC_RTTI SwXFootnotes final
: public SwSimpleIndexAccessBaseClass
,
459 public SwUnoCollection
461 const bool m_bEndnote
;
463 virtual ~SwXFootnotes() override
;
465 SwXFootnotes(bool bEnd
, SwDoc
* pDoc
);
468 SW_DLLPUBLIC
virtual sal_Int32 SAL_CALL
getCount() override
;
469 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
472 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
473 virtual sal_Bool SAL_CALL
hasElements( ) override
;
476 virtual OUString SAL_CALL
getImplementationName() override
;
477 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
478 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
480 SW_DLLPUBLIC
rtl::Reference
<SwXFootnote
> getFootnoteByIndex(sal_Int32 nIndex
) ;
482 static rtl::Reference
<SwXFootnote
> GetObject( SwDoc
& rDoc
, const SwFormatFootnote
& rFormat
);
485 class SwXReferenceMarks final
: public SwCollectionBaseClass
,
486 public SwUnoCollection
488 virtual ~SwXReferenceMarks() override
;
490 SwXReferenceMarks(SwDoc
* pDoc
);
493 virtual sal_Int32 SAL_CALL
getCount() override
;
494 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
497 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
498 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
499 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
502 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
503 virtual sal_Bool SAL_CALL
hasElements( ) override
;
506 virtual OUString SAL_CALL
getImplementationName() override
;
507 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
508 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
514 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */