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
;
42 const SvEventDescription
* sw_GetSupportedMacroItems();
50 SwUnoCollection(SwDoc
* p
) :
52 m_bObjectValid(true){}
54 virtual ~SwUnoCollection() {}
56 virtual void Invalidate();
57 bool IsValid() const {return m_bObjectValid
;}
59 SwDoc
* GetDoc() const {return m_pDoc
;}
62 /** entries in this enum are mapped in an array in unocoll.cxx */
63 enum class SwServiceType
{
79 ContentIndexMark
= 15,
84 FieldTypeDateTime
= 20,
88 FieldTypeFileName
= 24,
89 FieldTypePageNum
= 25,
91 FieldTypeChapter
= 27,
93 FieldTypeGetReference
= 29,
94 FieldTypeConditionedText
= 30,
95 FieldTypeAnnotation
= 31,
99 FieldTypeHiddenPara
= 35,
100 FieldTypeDocInfo
= 36,
101 FieldTypeTemplateName
= 37,
102 FieldTypeUserExt
= 38,
103 FieldTypeRefPageSet
= 39,
104 FieldTypeRefPageGet
= 40,
105 FieldTypeJumpEdit
= 41,
106 FieldTypeScript
= 42,
107 FieldTypeDatabaseNextSet
= 43,
108 FieldTypeDatabaseNumSet
= 44,
109 FieldTypeDatabaseSetNum
= 45,
110 FieldTypeDatabase
= 46,
111 FieldTypeDatabaseName
= 47,
112 FieldTypeTableFormula
= 48,
113 FieldTypePageCount
= 49,
114 FieldTypeParagraphCount
= 50,
115 FieldTypeWordCount
= 51,
116 FieldTypeCharacterCount
= 52,
117 FieldTypeTableCount
= 53,
118 FieldTypeGraphicObjectCount
= 54,
119 FieldTypeEmbeddedObjectCount
= 55,
120 FieldTypeDocInfoChangeAuthor
= 56,
121 FieldTypeDocInfoChangeDateTime
= 57,
122 FieldTypeDocInfoEditTime
= 58,
123 FieldTypeDocInfoDescription
= 59,
124 FieldTypeDocInfoCreateAuthor
= 60,
125 FieldTypeDocInfoCreateDateTime
= 61,
126 FieldTypeDummy1
= 63,
127 FieldTypeDummy2
= 64,
128 FieldTypeDummy3
= 65,
129 FieldTypeDocInfoCustom
= 66,
130 FieldTypeDocInfoPrintAuthor
= 67,
131 FieldTypeDocInfoPrintDateTime
= 68,
132 FieldTypeDocInfoKeywords
= 69,
133 FieldTypeDocInfoSubject
= 70,
134 FieldTypeDocInfoTitle
= 71,
135 FieldTypeDocInfoRevision
= 72,
136 FieldTypeBibliography
= 73,
137 FieldTypeCombinedCharacters
= 74,
138 FieldTypeDropdown
= 75,
139 FieldTypeMetafield
= 76,
140 FieldTypeDummy4
= 77,
141 FieldTypeDummy5
= 78,
142 FieldTypeDummy6
= 79,
143 FieldTypeDummy7
= 80,
144 FieldMasterUser
= 81,
146 FieldMasterSetExp
= 83,
147 FieldMasterDatabase
= 84,
148 FieldMasterBibliography
= 85,
149 FieldMasterDummy2
= 86,
150 FieldMasterDummy3
= 87,
151 FieldMasterDummy4
= 88,
152 FieldMasterDummy5
= 89,
153 IndexIllustrations
= 90,
156 IndexBibliography
= 93,
158 FieldTypeInputUser
= 95,
159 FieldTypeHiddenText
= 96,
160 StyleConditionalParagraph
= 97,
163 IndexHeaderSection
= 100,
168 TypeTextGraphic
= 105,
169 Chart2DataProvider
= 106,
171 TypeFormFieldMark
= 108,
173 VbaObjectProvider
= 110,
174 VbaCodeNameProvider
= 111,
175 VbaProjectNameProvider
= 112,
180 ContentControl
= 117,
185 // case-corrected versions of service-names (see #i67811)
187 #define CSS_TEXT_TEXTFIELD_DATE_TIME "com.sun.star.text.textfield.DateTime"
188 #define CSS_TEXT_TEXTFIELD_USER "com.sun.star.text.textfield.User"
189 #define CSS_TEXT_TEXTFIELD_SET_EXPRESSION "com.sun.star.text.textfield.SetExpression"
190 #define CSS_TEXT_TEXTFIELD_GET_EXPRESSION "com.sun.star.text.textfield.GetExpression"
191 #define CSS_TEXT_TEXTFIELD_FILE_NAME "com.sun.star.text.textfield.FileName"
192 #define CSS_TEXT_TEXTFIELD_PAGE_NUMBER "com.sun.star.text.textfield.PageNumber"
193 #define CSS_TEXT_TEXTFIELD_AUTHOR "com.sun.star.text.textfield.Author"
194 #define CSS_TEXT_TEXTFIELD_CHAPTER "com.sun.star.text.textfield.Chapter"
195 #define CSS_TEXT_TEXTFIELD_GET_REFERENCE "com.sun.star.text.textfield.GetReference"
196 #define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT "com.sun.star.text.textfield.ConditionalText"
197 #define CSS_TEXT_TEXTFIELD_ANNOTATION "com.sun.star.text.textfield.Annotation"
198 #define CSS_TEXT_TEXTFIELD_INPUT "com.sun.star.text.textfield.Input"
199 #define CSS_TEXT_TEXTFIELD_MACRO "com.sun.star.text.textfield.Macro"
200 #define CSS_TEXT_TEXTFIELD_DDE "com.sun.star.text.textfield.DDE"
201 #define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH "com.sun.star.text.textfield.HiddenParagraph"
202 #define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME "com.sun.star.text.textfield.TemplateName"
203 #define CSS_TEXT_TEXTFIELD_EXTENDED_USER "com.sun.star.text.textfield.ExtendedUser"
204 #define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET "com.sun.star.text.textfield.ReferencePageSet"
205 #define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET "com.sun.star.text.textfield.ReferencePageGet"
206 #define CSS_TEXT_TEXTFIELD_JUMP_EDIT "com.sun.star.text.textfield.JumpEdit"
207 #define CSS_TEXT_TEXTFIELD_SCRIPT "com.sun.star.text.textfield.Script"
208 #define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET "com.sun.star.text.textfield.DatabaseNextSet"
209 #define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET "com.sun.star.text.textfield.DatabaseNumberOfSet"
210 #define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER "com.sun.star.text.textfield.DatabaseSetNumber"
211 #define CSS_TEXT_TEXTFIELD_DATABASE "com.sun.star.text.textfield.Database"
212 #define CSS_TEXT_TEXTFIELD_DATABASE_NAME "com.sun.star.text.textfield.DatabaseName"
213 #define CSS_TEXT_TEXTFIELD_TABLE_FORMULA "com.sun.star.text.textfield.TableFormula"
214 #define CSS_TEXT_TEXTFIELD_PAGE_COUNT "com.sun.star.text.textfield.PageCount"
215 #define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT "com.sun.star.text.textfield.ParagraphCount"
216 #define CSS_TEXT_TEXTFIELD_WORD_COUNT "com.sun.star.text.textfield.WordCount"
217 #define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT "com.sun.star.text.textfield.CharacterCount"
218 #define CSS_TEXT_TEXTFIELD_TABLE_COUNT "com.sun.star.text.textfield.TableCount"
219 #define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT "com.sun.star.text.textfield.GraphicObjectCount"
220 #define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT "com.sun.star.text.textfield.EmbeddedObjectCount"
221 #define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR "com.sun.star.text.textfield.docinfo.ChangeAuthor"
222 #define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME "com.sun.star.text.textfield.docinfo.ChangeDateTime"
223 #define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME "com.sun.star.text.textfield.docinfo.EditTime"
224 #define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION "com.sun.star.text.textfield.docinfo.Description"
225 #define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR "com.sun.star.text.textfield.docinfo.CreateAuthor"
226 #define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME "com.sun.star.text.textfield.docinfo.CreateDateTime"
227 #define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR "com.sun.star.text.textfield.docinfo.PrintAuthor"
228 #define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME "com.sun.star.text.textfield.docinfo.PrintDateTime"
229 #define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS "com.sun.star.text.textfield.docinfo.KeyWords"
230 #define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT "com.sun.star.text.textfield.docinfo.Subject"
231 #define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE "com.sun.star.text.textfield.docinfo.Title"
232 #define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION "com.sun.star.text.textfield.docinfo.Revision"
233 #define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM "com.sun.star.text.textfield.docinfo.Custom"
234 #define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY "com.sun.star.text.textfield.Bibliography"
235 #define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS "com.sun.star.text.textfield.CombinedCharacters"
236 #define CSS_TEXT_TEXTFIELD_DROP_DOWN "com.sun.star.text.textfield.DropDown"
237 #define CSS_TEXT_TEXTFIELD_INPUT_USER "com.sun.star.text.textfield.InputUser"
238 #define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT "com.sun.star.text.textfield.HiddenText"
239 #define CSS_TEXT_FIELDMASTER_USER "com.sun.star.text.fieldmaster.User"
240 #define CSS_TEXT_FIELDMASTER_DDE "com.sun.star.text.fieldmaster.DDE"
241 #define CSS_TEXT_FIELDMASTER_SET_EXPRESSION "com.sun.star.text.fieldmaster.SetExpression"
242 #define CSS_TEXT_FIELDMASTER_DATABASE "com.sun.star.text.fieldmaster.Database"
243 #define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY "com.sun.star.text.fieldmaster.Bibliography"
245 class SwXServiceProvider
248 static OUString
GetProviderName(SwServiceType nObjectType
);
249 static SwServiceType
GetProviderType(std::u16string_view rServiceName
);
250 static css::uno::Reference
< css::uno::XInterface
> MakeInstance(SwServiceType nObjectType
, SwDoc
& rDoc
);
251 static css::uno::Sequence
<OUString
> GetAllServiceNames();
258 css::container::XNameAccess
,
259 css::container::XIndexAccess
,
260 css::lang::XServiceInfo
262 SwCollectionBaseClass
;
263 class SW_DLLPUBLIC SwXTextTables final
: public SwCollectionBaseClass
,
264 public SwUnoCollection
266 virtual ~SwXTextTables() override
;
268 SwXTextTables(SwDoc
* pDoc
);
271 virtual sal_Int32 SAL_CALL
getCount( ) override
;
272 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
275 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
276 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
277 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
280 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
281 virtual sal_Bool SAL_CALL
hasElements( ) override
;
284 virtual OUString SAL_CALL
getImplementationName() override
;
285 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
286 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
288 static css::uno::Reference
<css::text::XTextTable
> GetObject(SwFrameFormat
& rFormat
);
294 css::container::XEnumerationAccess
,
295 css::container::XNameAccess
,
296 css::container::XIndexAccess
,
297 css::lang::XServiceInfo
298 > SwXFramesBaseClass
;
300 class SwXFrames
: public SwXFramesBaseClass
,
301 public SwUnoCollection
303 const FlyCntType m_eType
;
305 virtual ~SwXFrames() override
;
307 SwXFrames(SwDoc
* pDoc
, FlyCntType eSet
);
310 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
createEnumeration() override
;
313 virtual sal_Int32 SAL_CALL
getCount() override
;
314 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
317 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
318 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
319 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
322 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
323 virtual sal_Bool SAL_CALL
hasElements( ) override
;
326 virtual OUString SAL_CALL
getImplementationName() override
;
327 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
328 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
331 class SwXTextFrames final
: public SwXFrames
333 virtual ~SwXTextFrames() override
;
335 SwXTextFrames(SwDoc
* pDoc
);
338 virtual OUString SAL_CALL
getImplementationName() override
;
339 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
340 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
344 class SwXTextGraphicObjects final
: public SwXFrames
346 virtual ~SwXTextGraphicObjects() override
;
348 SwXTextGraphicObjects(SwDoc
* pDoc
);
351 virtual OUString SAL_CALL
getImplementationName() override
;
352 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
353 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
357 class SwXTextEmbeddedObjects final
: public SwXFrames
359 virtual ~SwXTextEmbeddedObjects() override
;
361 SwXTextEmbeddedObjects(SwDoc
* pDoc
);
364 virtual OUString SAL_CALL
getImplementationName() override
;
365 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
366 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
370 class SwXTextSections final
: public SwCollectionBaseClass
,
371 public SwUnoCollection
373 virtual ~SwXTextSections() override
;
375 SwXTextSections(SwDoc
* pDoc
);
378 virtual sal_Int32 SAL_CALL
getCount() override
;
379 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
382 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
383 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
384 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
387 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
388 virtual sal_Bool SAL_CALL
hasElements( ) override
;
391 virtual OUString SAL_CALL
getImplementationName() override
;
392 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
393 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
395 static css::uno::Reference
< css::text::XTextSection
> GetObject( SwSectionFormat
& rFormat
);
398 class SwXBookmarks final
: public SwCollectionBaseClass
,
399 public SwUnoCollection
401 virtual ~SwXBookmarks() override
;
403 SwXBookmarks(SwDoc
* pDoc
);
406 virtual sal_Int32 SAL_CALL
getCount() override
;
407 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
410 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
411 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
412 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
415 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
416 virtual sal_Bool SAL_CALL
hasElements( ) override
;
419 virtual OUString SAL_CALL
getImplementationName() override
;
420 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
421 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
425 class SwXNumberingRulesCollection final
: public cppu::WeakImplHelper
427 css::container::XIndexAccess
429 public SwUnoCollection
431 virtual ~SwXNumberingRulesCollection() override
;
434 SwXNumberingRulesCollection( SwDoc
* pDoc
);
437 virtual sal_Int32 SAL_CALL
getCount() override
;
438 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
441 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
442 virtual sal_Bool SAL_CALL
hasElements( ) override
;
448 css::container::XIndexAccess
,
449 css::lang::XServiceInfo
451 SwSimpleIndexAccessBaseClass
;
453 class SwXFootnotes final
: public SwSimpleIndexAccessBaseClass
,
454 public SwUnoCollection
456 const bool m_bEndnote
;
458 virtual ~SwXFootnotes() override
;
460 SwXFootnotes(bool bEnd
, SwDoc
* pDoc
);
463 virtual sal_Int32 SAL_CALL
getCount() override
;
464 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
467 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
468 virtual sal_Bool SAL_CALL
hasElements( ) override
;
471 virtual OUString SAL_CALL
getImplementationName() override
;
472 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
473 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
475 static css::uno::Reference
< css::text::XFootnote
> GetObject( SwDoc
& rDoc
, const SwFormatFootnote
& rFormat
);
478 class SwXReferenceMarks final
: public SwCollectionBaseClass
,
479 public SwUnoCollection
481 virtual ~SwXReferenceMarks() override
;
483 SwXReferenceMarks(SwDoc
* pDoc
);
486 virtual sal_Int32 SAL_CALL
getCount() override
;
487 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
490 virtual css::uno::Any SAL_CALL
getByName(const OUString
& Name
) override
;
491 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
492 virtual sal_Bool SAL_CALL
hasByName(const OUString
& Name
) override
;
495 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
496 virtual sal_Bool SAL_CALL
hasElements( ) override
;
499 virtual OUString SAL_CALL
getImplementationName() override
;
500 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
501 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
507 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */