LibreOffice Module sw (master) 1
unocoll.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <config_features.h>
21
22#include <hintids.hxx>
23#include <doc.hxx>
26#include <docary.hxx>
27#include <unocoll.hxx>
28#include <unosett.hxx>
29#include <section.hxx>
30#include <IMark.hxx>
31#include <ftnidx.hxx>
32#include <fmtftn.hxx>
33#include <txtftn.hxx>
34#include <com/sun/star/text/XTextTable.hpp>
35#include <o3tl/safeint.hxx>
36#include <o3tl/string_view.hxx>
37#include <svtools/unoimap.hxx>
38#include <svtools/unoevent.hxx>
40#include <unotbl.hxx>
41#include <unostyle.hxx>
42#include <unofield.hxx>
43#include <unoidx.hxx>
44#include <unoframe.hxx>
45#include <textboxhelper.hxx>
46#include <unofootnote.hxx>
47#include <unolinebreak.hxx>
48#include <vcl/svapp.hxx>
49#include <fmtcntnt.hxx>
50#include <authfld.hxx>
51#include <SwXTextDefaults.hxx>
52#include <unochart.hxx>
55#include <unosection.hxx>
56#include <unoparagraph.hxx>
57#include <unobookmark.hxx>
58#include <unorefmark.hxx>
59#include <unometa.hxx>
60#include <unocontentcontrol.hxx>
61#include <docsh.hxx>
62#include <hints.hxx>
63#include <frameformats.hxx>
64#include <com/sun/star/document/XCodeNameQuery.hpp>
65#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
66#include <com/sun/star/form/XFormsSupplier.hpp>
67#include <com/sun/star/script/ModuleInfo.hpp>
68#include <com/sun/star/script/ModuleType.hpp>
69#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
70#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
72#include <basic/basmgr.hxx>
75#include <sfx2/event.hxx>
76#include <sal/log.hxx>
77
78using namespace ::com::sun::star;
79using namespace ::com::sun::star::document;
80using namespace ::com::sun::star::uno;
81using namespace ::com::sun::star::text;
82using namespace ::com::sun::star::container;
83using namespace ::com::sun::star::lang;
84
85#if HAVE_FEATURE_SCRIPTING
86
87namespace {
88
89class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery >
90{
91 SwDocShell* mpDocShell;
92 OUString msThisDocumentCodeName;
93public:
94 explicit SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
95 // XCodeNameQuery
96
97 OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) override
98 {
99 // #FIXME not implemented...
100 return OUString();
101 }
102
103 OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) override
104 {
105 // Initialise the code name
106 if ( msThisDocumentCodeName.isEmpty() )
107 {
108 try
109 {
110 uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
111 uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
112 OUString sProjectName( "Standard");
113 if ( !mpDocShell->GetBasicManager()->GetName().isEmpty() )
114 {
115 sProjectName = mpDocShell->GetBasicManager()->GetName();
116 }
117 uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
118 const uno::Sequence< OUString > sModuleNames = xLib->getElementNames();
119 uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
120
121 auto pModuleName = std::find_if(sModuleNames.begin(), sModuleNames.end(), [&xVBAModuleInfo](const OUString& rName) {
122 return xVBAModuleInfo->hasModuleInfo(rName)
123 && xVBAModuleInfo->getModuleInfo(rName).ModuleType == script::ModuleType::DOCUMENT; });
124 if (pModuleName != sModuleNames.end())
125 msThisDocumentCodeName = *pModuleName;
126 }
127 catch( uno::Exception& )
128 {
129 }
130 }
131 OUString sCodeName;
132 if ( mpDocShell )
133 {
134 // need to find the page ( and index ) for this control
135 uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
136 uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
137
138 try
139 {
140 uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
141 uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
142 // get the www-standard container
143 uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
144 sal_Int32 nCntrls = xFormControls->getCount();
145 for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
146 {
147 uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
148 bool bMatched = ( xControl == xIf );
149 if ( bMatched )
150 {
151 sCodeName = msThisDocumentCodeName;
152 break;
153 }
154 }
155 }
156 catch( uno::Exception& )
157 {
158 }
159 }
160 // #TODO Probably should throw here ( if !bMatched )
161 return sCodeName;
162 }
163};
164
165}
166
167typedef std::unordered_map< OUString, OUString > StringHashMap;
168
169namespace {
170
171class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer >
172{
173 StringHashMap mTemplateToProject;
174public:
175 SwVbaProjectNameProvider()
176 {
177 }
178 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
179 {
180 return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
181 }
182 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
183 {
184 if ( !hasByName( aName ) )
185 throw container::NoSuchElementException();
186 return uno::Any( mTemplateToProject.find( aName )->second );
187 }
188 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
189 {
190 return comphelper::mapKeysToSequence( mTemplateToProject );
191 }
192
193 virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) override
194 {
195
196 OUString sProjectName;
197 aElement >>= sProjectName;
198 SAL_INFO("sw.uno", "Template cache inserting template name " << aName
199 << " with project " << sProjectName);
200 mTemplateToProject[ aName ] = sProjectName;
201 }
202
203 virtual void SAL_CALL removeByName( const OUString& Name ) override
204 {
205 if ( !hasByName( Name ) )
206 throw container::NoSuchElementException();
207 mTemplateToProject.erase( Name );
208 }
209 virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) override
210 {
211 if ( !hasByName( aName ) )
212 throw container::NoSuchElementException();
213 insertByName( aName, aElement ); // insert will overwrite
214 }
215 // XElemenAccess
216 virtual css::uno::Type SAL_CALL getElementType( ) override
217 {
219 }
220 virtual sal_Bool SAL_CALL hasElements( ) override
221 {
222
223 return ( !mTemplateToProject.empty() );
224 }
225
226};
227
228class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess >
229{
230 SwDocShell* mpDocShell;
231public:
232 explicit SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
233 {
234 // #FIXME #TODO is the code name for ThisDocument read anywhere?
235 }
236
237 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
238 {
239 // #FIXME #TODO we really need to be checking against the codename for
240 // ThisDocument
241 if ( aName == "ThisDocument" )
242 return true;
243 return false;
244 }
245
246 css::uno::Any SAL_CALL getByName( const OUString& aName ) override
247 {
248 if ( !hasByName( aName ) )
249 throw container::NoSuchElementException();
250 uno::Sequence< uno::Any > aArgs{ uno::Any(uno::Reference< uno::XInterface >()),
251 uno::Any(mpDocShell->GetModel()) };
252 uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
253 SAL_INFO("sw.uno",
254 "Creating Object ( ooo.vba.word.Document ) 0x" << xDocObj.get());
255 return uno::Any( xDocObj );
256 }
257 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
258 {
259 uno::Sequence< OUString > aNames;
260 return aNames;
261 }
262 // XElemenAccess
263 virtual css::uno::Type SAL_CALL getElementType( ) override { return uno::Type(); }
264 virtual sal_Bool SAL_CALL hasElements( ) override { return true; }
265
266};
267
268}
269
270#endif
271
272namespace {
273
274struct ProvNamesId_Type
275{
276 const char * pName;
278};
279
280}
281
282// note: this thing is indexed as an array, so do not insert/remove entries!
283const ProvNamesId_Type aProvNamesId[] =
284{
285 { "com.sun.star.text.TextTable", SwServiceType::TypeTextTable },
286 { "com.sun.star.text.TextFrame", SwServiceType::TypeTextFrame },
287 { "com.sun.star.text.GraphicObject", SwServiceType::TypeGraphic },
288 { "com.sun.star.text.TextEmbeddedObject", SwServiceType::TypeOLE },
289 { "com.sun.star.text.Bookmark", SwServiceType::TypeBookmark },
290 { "com.sun.star.text.Footnote", SwServiceType::TypeFootnote },
291 { "com.sun.star.text.Endnote", SwServiceType::TypeEndnote },
292 { "com.sun.star.text.DocumentIndexMark", SwServiceType::TypeIndexMark },
293 { "com.sun.star.text.DocumentIndex", SwServiceType::TypeIndex },
294 { "com.sun.star.text.ReferenceMark", SwServiceType::ReferenceMark },
295 { "com.sun.star.style.CharacterStyle", SwServiceType::StyleCharacter },
296 { "com.sun.star.style.ParagraphStyle", SwServiceType::StyleParagraph },
297 { "com.sun.star.style.FrameStyle", SwServiceType::StyleFrame },
298 { "com.sun.star.style.PageStyle", SwServiceType::StylePage },
299 { "com.sun.star.style.NumberingStyle", SwServiceType::StyleNumbering },
300 { "com.sun.star.text.ContentIndexMark", SwServiceType::ContentIndexMark },
301 { "com.sun.star.text.ContentIndex", SwServiceType::ContentIndex },
302 { "com.sun.star.text.UserIndexMark", SwServiceType::UserIndexMark },
303 { "com.sun.star.text.UserIndex", SwServiceType::UserIndex },
304 { "com.sun.star.text.TextSection", SwServiceType::TextSection },
305 { "com.sun.star.text.TextField.DateTime", SwServiceType::FieldTypeDateTime },
306 { "com.sun.star.text.TextField.User", SwServiceType::FieldTypeUser },
307 { "com.sun.star.text.TextField.SetExpression", SwServiceType::FieldTypeSetExp },
308 { "com.sun.star.text.TextField.GetExpression", SwServiceType::FieldTypeGetExp },
309 { "com.sun.star.text.TextField.FileName", SwServiceType::FieldTypeFileName },
310 { "com.sun.star.text.TextField.PageNumber", SwServiceType::FieldTypePageNum },
311 { "com.sun.star.text.TextField.Author", SwServiceType::FieldTypeAuthor },
312 { "com.sun.star.text.TextField.Chapter", SwServiceType::FieldTypeChapter },
314 { "com.sun.star.text.TextField.GetReference", SwServiceType::FieldTypeGetReference },
315 { "com.sun.star.text.TextField.ConditionalText", SwServiceType::FieldTypeConditionedText },
316 { "com.sun.star.text.TextField.Annotation", SwServiceType::FieldTypeAnnotation },
317 { "com.sun.star.text.TextField.Input", SwServiceType::FieldTypeInput },
318 { "com.sun.star.text.TextField.Macro", SwServiceType::FieldTypeMacro },
319 { "com.sun.star.text.TextField.DDE", SwServiceType::FieldTypeDDE },
320 { "com.sun.star.text.TextField.HiddenParagraph", SwServiceType::FieldTypeHiddenPara },
321 { "" /*com.sun.star.text.TextField.DocumentInfo"*/, SwServiceType::FieldTypeDocInfo },
322 { "com.sun.star.text.TextField.TemplateName", SwServiceType::FieldTypeTemplateName },
323 { "com.sun.star.text.TextField.ExtendedUser", SwServiceType::FieldTypeUserExt },
324 { "com.sun.star.text.TextField.ReferencePageSet", SwServiceType::FieldTypeRefPageSet },
325 { "com.sun.star.text.TextField.ReferencePageGet", SwServiceType::FieldTypeRefPageGet },
326 { "com.sun.star.text.TextField.JumpEdit", SwServiceType::FieldTypeJumpEdit },
327 { "com.sun.star.text.TextField.Script", SwServiceType::FieldTypeScript },
328 { "com.sun.star.text.TextField.DatabaseNextSet", SwServiceType::FieldTypeDatabaseNextSet },
329 { "com.sun.star.text.TextField.DatabaseNumberOfSet", SwServiceType::FieldTypeDatabaseNumSet },
330 { "com.sun.star.text.TextField.DatabaseSetNumber", SwServiceType::FieldTypeDatabaseSetNum },
331 { "com.sun.star.text.TextField.Database", SwServiceType::FieldTypeDatabase },
332 { "com.sun.star.text.TextField.DatabaseName", SwServiceType::FieldTypeDatabaseName },
333 { "com.sun.star.text.TextField.TableFormula", SwServiceType::FieldTypeTableFormula },
334 { "com.sun.star.text.TextField.PageCount", SwServiceType::FieldTypePageCount },
335 { "com.sun.star.text.TextField.ParagraphCount", SwServiceType::FieldTypeParagraphCount },
336 { "com.sun.star.text.TextField.WordCount", SwServiceType::FieldTypeWordCount },
337 { "com.sun.star.text.TextField.CharacterCount", SwServiceType::FieldTypeCharacterCount },
338 { "com.sun.star.text.TextField.TableCount", SwServiceType::FieldTypeTableCount },
339 { "com.sun.star.text.TextField.GraphicObjectCount", SwServiceType::FieldTypeGraphicObjectCount },
340 { "com.sun.star.text.TextField.EmbeddedObjectCount", SwServiceType::FieldTypeEmbeddedObjectCount },
341 { "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SwServiceType::FieldTypeDocInfoChangeAuthor },
342 { "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SwServiceType::FieldTypeDocInfoChangeDateTime },
343 { "com.sun.star.text.TextField.DocInfo.EditTime", SwServiceType::FieldTypeDocInfoEditTime },
344 { "com.sun.star.text.TextField.DocInfo.Description", SwServiceType::FieldTypeDocInfoDescription },
345 { "com.sun.star.text.TextField.DocInfo.CreateAuthor", SwServiceType::FieldTypeDocInfoCreateAuthor },
346 { "com.sun.star.text.TextField.DocInfo.CreateDateTime", SwServiceType::FieldTypeDocInfoCreateDateTime },
351 { "com.sun.star.text.TextField.DocInfo.Custom", SwServiceType::FieldTypeDocInfoCustom },
352 { "com.sun.star.text.TextField.DocInfo.PrintAuthor", SwServiceType::FieldTypeDocInfoPrintAuthor },
353 { "com.sun.star.text.TextField.DocInfo.PrintDateTime", SwServiceType::FieldTypeDocInfoPrintDateTime },
354 { "com.sun.star.text.TextField.DocInfo.KeyWords", SwServiceType::FieldTypeDocInfoKeywords },
355 { "com.sun.star.text.TextField.DocInfo.Subject", SwServiceType::FieldTypeDocInfoSubject },
356 { "com.sun.star.text.TextField.DocInfo.Title", SwServiceType::FieldTypeDocInfoTitle },
357 { "com.sun.star.text.TextField.DocInfo.Revision", SwServiceType::FieldTypeDocInfoRevision },
358 { "com.sun.star.text.TextField.Bibliography", SwServiceType::FieldTypeBibliography },
359 { "com.sun.star.text.TextField.CombinedCharacters", SwServiceType::FieldTypeCombinedCharacters },
360 { "com.sun.star.text.TextField.DropDown", SwServiceType::FieldTypeDropdown },
361 { "com.sun.star.text.textfield.MetadataField", SwServiceType::FieldTypeMetafield },
366 { "com.sun.star.text.FieldMaster.User", SwServiceType::FieldMasterUser },
367 { "com.sun.star.text.FieldMaster.DDE", SwServiceType::FieldMasterDDE },
368 { "com.sun.star.text.FieldMaster.SetExpression", SwServiceType::FieldMasterSetExp },
369 { "com.sun.star.text.FieldMaster.Database", SwServiceType::FieldMasterDatabase },
370 { "com.sun.star.text.FieldMaster.Bibliography", SwServiceType::FieldMasterBibliography },
375 { "com.sun.star.text.IllustrationsIndex", SwServiceType::IndexIllustrations },
376 { "com.sun.star.text.ObjectIndex", SwServiceType::IndexObjects },
377 { "com.sun.star.text.TableIndex", SwServiceType::IndexTables },
378 { "com.sun.star.text.Bibliography", SwServiceType::IndexBibliography },
379 { "com.sun.star.text.Paragraph", SwServiceType::Paragraph },
380 { "com.sun.star.text.TextField.InputUser", SwServiceType::FieldTypeInputUser },
381 { "com.sun.star.text.TextField.HiddenText", SwServiceType::FieldTypeHiddenText },
382 { "com.sun.star.style.ConditionalParagraphStyle", SwServiceType::StyleConditionalParagraph },
383 { "com.sun.star.text.NumberingRules", SwServiceType::NumberingRules },
384 { "com.sun.star.text.TextColumns", SwServiceType::TextColumns },
385 { "com.sun.star.text.IndexHeaderSection", SwServiceType::IndexHeaderSection },
386 { "com.sun.star.text.Defaults", SwServiceType::Defaults },
387 { "com.sun.star.image.ImageMapRectangleObject", SwServiceType::IMapRectangle },
388 { "com.sun.star.image.ImageMapCircleObject", SwServiceType::IMapCircle },
389 { "com.sun.star.image.ImageMapPolygonObject", SwServiceType::IMapPolygon },
390 { "com.sun.star.text.TextGraphicObject", SwServiceType::TypeTextGraphic },
391 { "com.sun.star.chart2.data.DataProvider", SwServiceType::Chart2DataProvider },
392 { "com.sun.star.text.Fieldmark", SwServiceType::TypeFieldMark },
393 { "com.sun.star.text.FormFieldmark", SwServiceType::TypeFormFieldMark },
394 { "com.sun.star.text.InContentMetadata", SwServiceType::TypeMeta },
395 { "ooo.vba.VBAObjectModuleObjectProvider", SwServiceType::VbaObjectProvider },
396 { "ooo.vba.VBACodeNameProvider", SwServiceType::VbaCodeNameProvider },
397 { "ooo.vba.VBAProjectNameProvider", SwServiceType::VbaProjectNameProvider },
398 { "ooo.vba.VBAGlobals", SwServiceType::VbaGlobals },
399
400 // case-correct versions of the service names (see #i67811)
458 { "com.sun.star.style.TableStyle", SwServiceType::StyleTable },
459 { "com.sun.star.style.CellStyle", SwServiceType::StyleCell },
460 { "com.sun.star.text.LineBreak", SwServiceType::LineBreak },
461 { "com.sun.star.text.ContentControl", SwServiceType::ContentControl }
462};
463
465{
466 static const SvEventDescription aMacroDescriptionsImpl[] =
467 {
468 { SvMacroItemId::OnMouseOver, "OnMouseOver" },
469 { SvMacroItemId::OnMouseOut, "OnMouseOut" },
470 { SvMacroItemId::NONE, nullptr }
471 };
472
473 return aMacroDescriptionsImpl;
474}
475
477{
478 SolarMutexGuard aGuard;
479 OUString sRet;
480 const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
481 if(static_cast<sal_uInt16>(nObjectType) < nEntries)
482 sRet = OUString::createFromAscii(aProvNamesId[static_cast<sal_uInt16>(nObjectType)].pName);
483 return sRet;
484}
485
487{
488 const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
489 uno::Sequence<OUString> aRet(nEntries);
490 OUString* pArray = aRet.getArray();
491 sal_uInt16 n = 0;
492 for(const ProvNamesId_Type & i : aProvNamesId)
493 {
494 OUString sProv(OUString::createFromAscii(i.pName));
495 if(!sProv.isEmpty())
496 {
497 pArray[n] = sProv;
498 n++;
499 }
500 }
501 aRet.realloc(n);
502 return aRet;
503
504}
505
506SwServiceType SwXServiceProvider::GetProviderType(std::u16string_view rServiceName)
507{
508 for(const ProvNamesId_Type & i : aProvNamesId)
509 {
510 if (o3tl::equalsAscii(rServiceName, i.pName))
511 return i.nType;
512 }
514}
515
516uno::Reference<uno::XInterface>
518{
519 SolarMutexGuard aGuard;
520 uno::Reference< uno::XInterface > xRet;
521 switch(nObjectType)
522 {
524 {
525 xRet = static_cast<cppu::OWeakObject*>(SwXTextTable::CreateXTextTable(nullptr).get());
526 }
527 break;
529 {
530 xRet = static_cast<cppu::OWeakObject*>(SwXTextFrame::CreateXTextFrame(rDoc, nullptr).get());
531 }
532 break;
534 case SwServiceType::TypeTextGraphic /* #i47503# */ :
535 {
536 xRet = static_cast<cppu::OWeakObject*>(SwXTextGraphicObject::CreateXTextGraphicObject(rDoc, nullptr).get());
537
538 }
539 break;
541 {
542 xRet = static_cast<cppu::OWeakObject*>(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(rDoc, nullptr).get());
543 }
544 break;
546 {
547 xRet = static_cast<cppu::OWeakObject*>(SwXBookmark::CreateXBookmark(rDoc, nullptr).get());
548 }
549 break;
551 {
552 xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr).get());
553 }
554 break;
556 {
557 xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true).get());
558 }
559 break;
561#if HAVE_FEATURE_SCRIPTING
562 {
563 xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
564 }
565#endif
566 break;
568#if HAVE_FEATURE_SCRIPTING
569 {
570 if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
571 {
572 xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
573 }
574 }
575#endif
576 break;
578#if HAVE_FEATURE_SCRIPTING
579 {
580 uno::Reference< container::XNameContainer > xProjProv = rDoc.GetVBATemplateToProjectCache();
581 if (!xProjProv.is() && rDoc.GetDocShell()
583 {
584 xProjProv = new SwVbaProjectNameProvider;
585 rDoc.SetVBATemplateToProjectCache(xProjProv);
586 }
587 xRet = xProjProv;
588 }
589#endif
590 break;
592#if HAVE_FEATURE_SCRIPTING
593 {
594 uno::Any aGlobs;
595 BasicManager *pBasicMan = rDoc.GetDocShell()->GetBasicManager();
596 if (pBasicMan && !pBasicMan->GetGlobalUNOConstant("VBAGlobals", aGlobs))
597 {
598 uno::Sequence< uno::Any > aArgs{ uno::Any(rDoc.GetDocShell()->GetModel()) };
599 aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
600 pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
601 }
602 aGlobs >>= xRet;
603 }
604#endif
605 break;
606
608 xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr).get());
609 break;
611 xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr, true).get());
612 break;
616 {
618 if(SwServiceType::ContentIndexMark== nObjectType)
620 else if(SwServiceType::UserIndexMark == nObjectType)
621 eType = TOX_USER;
622 xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType).get());
623 }
624 break;
632 {
634 if(SwServiceType::ContentIndex == nObjectType)
636 else if(SwServiceType::UserIndex == nObjectType)
637 eType = TOX_USER;
638 else if(SwServiceType::IndexIllustrations == nObjectType)
639 {
641 }
642 else if(SwServiceType::IndexObjects == nObjectType)
643 {
645 }
646 else if(SwServiceType::IndexBibliography == nObjectType)
647 {
649 }
650 else if(SwServiceType::IndexTables == nObjectType)
651 {
653 }
654 xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType).get());
655 }
656 break;
659 xRet = static_cast<cppu::OWeakObject*>(SwXTextSection::CreateXTextSection(nullptr,
660 (SwServiceType::IndexHeaderSection == nObjectType)).get());
661
662 break;
664 xRet = static_cast<cppu::OWeakObject*>(SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr).get());
665 break;
674 {
675 SfxStyleFamily eFamily = SfxStyleFamily::Char;
676 switch(nObjectType)
677 {
679 eFamily = SfxStyleFamily::Para;
680 break;
682 eFamily = SfxStyleFamily::Para;
684 break;
686 eFamily = SfxStyleFamily::Frame;
687 break;
689 eFamily = SfxStyleFamily::Page;
690 break;
692 eFamily = SfxStyleFamily::Pseudo;
693 break;
695 eFamily = SfxStyleFamily::Table;
696 break;
698 eFamily = SfxStyleFamily::Cell;
699 break;
700 default: break;
701 }
702 if(!xRet.is())
703 xRet = SwXStyleFamilies::CreateStyle(eFamily, rDoc);
704 }
705 break;
758 // NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0
759 xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType).get());
760 break;
762 xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType).get());
763 break;
768 {
770 switch(nObjectType)
771 {
776 default: break;
777 }
778 xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId).get());
779 }
780 break;
782 {
784 if(!pType)
785 {
786 SwAuthorityFieldType aType(&rDoc);
787 pType = rDoc.getIDocumentFieldsAccess().InsertFieldType(aType);
788 }
789 xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, pType).get());
790 }
791 break;
793 xRet = static_cast<cppu::OWeakObject*>(SwXParagraph::CreateXParagraph(rDoc, nullptr).get());
794 break;
796 xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
797 break;
800 break;
802 xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
803 break;
806 break;
809 break;
812 break;
814 // #i64497# If a chart is in a temporary document during clipboard
815 // paste, there should be no data provider, so that own data is used
816 // This should not happen during copy/paste, as this will unlink
817 // charts using table data.
818 if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED)
819 xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
820 else
821 SAL_WARN("sw.uno",
822 "not creating chart data provider for embedded object");
823
824 break;
826 xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, false).get());
827 break;
829 xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, true).get());
830 break;
832 xRet = static_cast<cppu::OWeakObject*>(SwXLineBreak::CreateXLineBreak(nullptr).get());
833 break;
835 xRet = static_cast<cppu::OWeakObject*>(SwXContentControl::CreateXContentControl(rDoc).get());
836 break;
837 default:
838 throw uno::RuntimeException();
839 }
840 return xRet;
841}
842
843//SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
845 SwUnoCollection(pDc)
846{
847
848}
849
851{
852
853}
854
856{
857 SolarMutexGuard aGuard;
858 sal_Int32 nRet = 0;
859 if(IsValid())
860 nRet = static_cast<sal_Int32>(GetDoc()->GetTableFrameFormatCount(true));
861 return nRet;
862}
863
864uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex)
865{
866 SolarMutexGuard aGuard;
867 uno::Any aRet;
868 if (!IsValid())
869 throw uno::RuntimeException();
870
871 if (nInputIndex < 0)
872 throw IndexOutOfBoundsException();
873
874 SwAutoFormatGetDocNode aGetHt( &GetDoc()->GetNodes() );
875 size_t nIndex = static_cast<size_t>(nInputIndex);
876 size_t nCurrentIndex = 0;
877
878 for (SwFrameFormat* const & pFormat : *GetDoc()->GetTableFrameFormats())
879 {
880 if (!pFormat->GetInfo(aGetHt))
881 {
882 if (nCurrentIndex == nIndex)
883 {
884 uno::Reference<XTextTable> xTable = SwXTextTables::GetObject(*pFormat);
885 aRet <<= xTable;
886 return aRet;
887 }
888 else
889 nCurrentIndex++;
890 }
891 }
892 throw IndexOutOfBoundsException();
893}
894
895uno::Any SwXTextTables::getByName(const OUString& rItemName)
896{
897 SolarMutexGuard aGuard;
898 uno::Any aRet;
899 if(!IsValid())
900 throw uno::RuntimeException();
901
902 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
903 uno::Reference< XTextTable > xTable;
904 for( size_t i = 0; i < nCount; ++i)
905 {
906 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
907 if (rItemName == rFormat.GetName())
908 {
909 xTable = SwXTextTables::GetObject(rFormat);
910 aRet <<= xTable;
911 break;
912 }
913 }
914 if(!xTable.is())
915 throw NoSuchElementException();
916
917 return aRet;
918}
919
920uno::Sequence< OUString > SwXTextTables::getElementNames()
921{
922 SolarMutexGuard aGuard;
923 if(!IsValid())
924 throw uno::RuntimeException();
925 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
926 uno::Sequence<OUString> aSeq(static_cast<sal_Int32>(nCount));
927 if(nCount)
928 {
929 OUString* pArray = aSeq.getArray();
930 for( size_t i = 0; i < nCount; ++i)
931 {
932 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
933
934 pArray[i] = rFormat.GetName();
935 }
936 }
937 return aSeq;
938}
939
940sal_Bool SwXTextTables::hasByName(const OUString& rName)
941{
942 SolarMutexGuard aGuard;
943 bool bRet= false;
944 if(!IsValid())
945 throw uno::RuntimeException();
946
947 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
948 for( size_t i = 0; i < nCount; ++i)
949 {
950 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
951 if (rName == rFormat.GetName())
952 {
953 bRet = true;
954 break;
955 }
956 }
957 return bRet;
958}
959
960uno::Type SAL_CALL
962{
964}
965
967{
968 SolarMutexGuard aGuard;
969 if(!IsValid())
970 throw uno::RuntimeException();
971 return 0 != GetDoc()->GetTableFrameFormatCount(true);
972}
973
975{
976 return "SwXTextTables";
977}
978
979sal_Bool SwXTextTables::supportsService(const OUString& rServiceName)
980{
981 return cppu::supportsService(this, rServiceName);
982}
983
985{
986 return { "com.sun.star.text.TextTables" };
987}
988
989uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat)
990{
991 return SwXTextTable::CreateXTextTable(& rFormat);
992}
993
994namespace
995{
996 template<FlyCntType T> struct UnoFrameWrap_traits {};
997
998 template<>
999 struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
1000 {
1001 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1002 {
1003 uno::Reference<text::XTextFrame> const xRet(
1004 SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat));
1005 return uno::Any(xRet);
1006 }
1007 static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); };
1008 };
1009
1010 template<>
1011 struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
1012 {
1013 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1014 {
1015 uno::Reference<text::XTextContent> const xRet(
1016 SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1017 return uno::Any(xRet);
1018 }
1019 static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
1020 };
1021
1022 template<>
1023 struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
1024 {
1025 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1026 {
1027 uno::Reference<text::XTextContent> const xRet(
1028 SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1029 return uno::Any(xRet);
1030 }
1031 static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
1032 };
1033
1034 template<FlyCntType T>
1035 uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat)
1036 {
1037 return UnoFrameWrap_traits<T>::wrapFrame(*pFormat);
1038 }
1039
1040 // runtime adapter for lcl_UnoWrapFrame
1042 uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat, FlyCntType eType)
1043 {
1044 switch(eType)
1045 {
1046 case FLYCNTTYPE_FRM:
1047 return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFormat);
1048 case FLYCNTTYPE_GRF:
1049 return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFormat);
1050 case FLYCNTTYPE_OLE:
1051 return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFormat);
1052 default:
1053 throw uno::RuntimeException();
1054 }
1055 }
1056
1057 template<FlyCntType T>
1058 class SwXFrameEnumeration
1060 {
1061 private:
1062 std::vector< Any > m_aFrames;
1063 protected:
1064 virtual ~SwXFrameEnumeration() override {};
1065 public:
1066 SwXFrameEnumeration(const SwDoc& rDoc);
1067
1068 //XEnumeration
1069 virtual sal_Bool SAL_CALL hasMoreElements() override;
1070 virtual Any SAL_CALL nextElement() override;
1071
1072 //XServiceInfo
1073 virtual OUString SAL_CALL getImplementationName() override;
1074 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
1075 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1076 };
1077}
1078
1079template<FlyCntType T>
1080SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc& rDoc)
1081{
1082 SolarMutexGuard aGuard;
1083 const SwFrameFormats* const pFormats = rDoc.GetSpzFrameFormats();
1084 if (pFormats->empty())
1085 return;
1086 // #i104937#
1087 const size_t nSize = pFormats->size();
1088 // #i104937#
1089 SwFrameFormat* pFormat( nullptr );
1090 for( size_t i = 0; i < nSize; ++i )
1091 {
1092 // #i104937#
1093 pFormat = (*pFormats)[i];
1094 if(pFormat->Which() != RES_FLYFRMFMT || SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT))
1095 continue;
1096 const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1097 if(!pIdx || !pIdx->GetNodes().IsDocNodes())
1098 continue;
1099 const SwNode* pNd = rDoc.GetNodes()[ pIdx->GetIndex() + 1 ];
1100 if(UnoFrameWrap_traits<T>::filter(pNd))
1101 m_aFrames.push_back(lcl_UnoWrapFrame<T>(pFormat));
1102 }
1103}
1104
1105template<FlyCntType T>
1106sal_Bool SwXFrameEnumeration<T>::hasMoreElements()
1107{
1108 SolarMutexGuard aGuard;
1109 return !m_aFrames.empty();
1110}
1111
1112template<FlyCntType T>
1113Any SwXFrameEnumeration<T>::nextElement()
1114{
1115 SolarMutexGuard aGuard;
1116 if(m_aFrames.empty())
1117 throw NoSuchElementException();
1118
1119 Any aResult = m_aFrames.back();
1120 m_aFrames.pop_back();
1121 return aResult;
1122}
1123
1124template<FlyCntType T>
1125OUString SwXFrameEnumeration<T>::getImplementationName()
1126{
1127 return "SwXFrameEnumeration";
1128}
1129
1130template<FlyCntType T>
1131sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName)
1132{
1133 return cppu::supportsService(this, ServiceName);
1134}
1135
1136template<FlyCntType T>
1137Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames()
1138{
1139 return { OUString("com.sun.star.container.XEnumeration") };
1140}
1141
1143{
1144 return "SwXFrames";
1145}
1146
1147sal_Bool SwXFrames::supportsService(const OUString& rServiceName)
1148{
1149 return cppu::supportsService(this, rServiceName);
1150}
1151
1153{
1154 return { OUString("com.sun.star.text.TextFrames") };
1155}
1156
1158 SwUnoCollection(_pDoc),
1159 m_eType(eSet)
1160{}
1161
1163{}
1164
1165uno::Reference<container::XEnumeration> SwXFrames::createEnumeration()
1166{
1167 SolarMutexGuard aGuard;
1168 if(!IsValid())
1169 throw uno::RuntimeException();
1170 switch(m_eType)
1171 {
1172 case FLYCNTTYPE_FRM:
1173 return uno::Reference< container::XEnumeration >(
1174 new SwXFrameEnumeration<FLYCNTTYPE_FRM>(*GetDoc()));
1175 case FLYCNTTYPE_GRF:
1176 return uno::Reference< container::XEnumeration >(
1177 new SwXFrameEnumeration<FLYCNTTYPE_GRF>(*GetDoc()));
1178 case FLYCNTTYPE_OLE:
1179 return uno::Reference< container::XEnumeration >(
1180 new SwXFrameEnumeration<FLYCNTTYPE_OLE>(*GetDoc()));
1181 default:
1182 throw uno::RuntimeException();
1183 }
1184}
1185
1187{
1188 SolarMutexGuard aGuard;
1189 if(!IsValid())
1190 throw uno::RuntimeException();
1191 // Ignore TextBoxes for TextFrames.
1192 return static_cast<sal_Int32>(GetDoc()->GetFlyCount(m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM));
1193}
1194
1196{
1197 SolarMutexGuard aGuard;
1198 if(!IsValid())
1199 throw uno::RuntimeException();
1200 if(nIndex < 0)
1201 throw IndexOutOfBoundsException();
1202 // Ignore TextBoxes for TextFrames.
1203 SwFrameFormat* pFormat = GetDoc()->GetFlyNum(static_cast<size_t>(nIndex), m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM);
1204 if(!pFormat)
1205 throw IndexOutOfBoundsException();
1206 return lcl_UnoWrapFrame(pFormat, m_eType);
1207}
1208
1209uno::Any SwXFrames::getByName(const OUString& rName)
1210{
1211 SolarMutexGuard aGuard;
1212 if(!IsValid())
1213 throw uno::RuntimeException();
1214 const SwFrameFormat* pFormat;
1215 switch(m_eType)
1216 {
1217 case FLYCNTTYPE_GRF:
1218 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Grf);
1219 break;
1220 case FLYCNTTYPE_OLE:
1221 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Ole);
1222 break;
1223 default:
1224 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Text);
1225 break;
1226 }
1227 if(!pFormat)
1228 throw NoSuchElementException();
1229 return lcl_UnoWrapFrame(const_cast<SwFrameFormat*>(pFormat), m_eType);
1230}
1231
1232uno::Sequence<OUString> SwXFrames::getElementNames()
1233{
1234 SolarMutexGuard aGuard;
1235 if(!IsValid())
1236 throw uno::RuntimeException();
1237 const Reference<XEnumeration> xEnum = createEnumeration();
1238 std::vector<OUString> vNames;
1239 while(xEnum->hasMoreElements())
1240 {
1241 Reference<container::XNamed> xNamed;
1242 xEnum->nextElement() >>= xNamed;
1243 if(xNamed.is())
1244 vNames.push_back(xNamed->getName());
1245 }
1246 return ::comphelper::containerToSequence(vNames);
1247}
1248
1249sal_Bool SwXFrames::hasByName(const OUString& rName)
1250{
1251 SolarMutexGuard aGuard;
1252 if(!IsValid())
1253 throw uno::RuntimeException();
1254 switch(m_eType)
1255 {
1256 case FLYCNTTYPE_GRF:
1257 return GetDoc()->FindFlyByName(rName, SwNodeType::Grf) != nullptr;
1258 case FLYCNTTYPE_OLE:
1259 return GetDoc()->FindFlyByName(rName, SwNodeType::Ole) != nullptr;
1260 default:
1261 return GetDoc()->FindFlyByName(rName, SwNodeType::Text) != nullptr;
1262 }
1263}
1264
1266{
1267 SolarMutexGuard aGuard;
1268 switch(m_eType)
1269 {
1270 case FLYCNTTYPE_FRM:
1272 case FLYCNTTYPE_GRF:
1274 case FLYCNTTYPE_OLE:
1276 default:
1277 return uno::Type();
1278 }
1279}
1280
1282{
1283 SolarMutexGuard aGuard;
1284 if(!IsValid())
1285 throw uno::RuntimeException();
1286 return GetDoc()->GetFlyCount(m_eType) > 0;
1287}
1288
1289
1291{
1292 return "SwXTextFrames";
1293}
1294
1295sal_Bool SwXTextFrames::supportsService(const OUString& rServiceName)
1296{
1297 return cppu::supportsService(this, rServiceName);
1298}
1299
1301{
1302 return { "com.sun.star.text.TextFrames" };
1303}
1304
1307{
1308}
1309
1311{
1312}
1313
1315{
1316 return "SwXTextGraphicObjects";
1317}
1318
1320{
1321 return cppu::supportsService(this, rServiceName);
1322}
1323
1325{
1326 return { "com.sun.star.text.TextGraphicObjects" };
1327}
1328
1331{
1332}
1333
1335{
1336}
1337
1339{
1340 return "SwXTextEmbeddedObjects";
1341}
1342
1344{
1345 return cppu::supportsService(this, rServiceName);
1346}
1347
1349{
1350 return { "com.sun.star.text.TextEmbeddedObjects" };
1351}
1352
1355{
1356}
1357
1359{
1360}
1361
1363{
1364 return "SwXTextSections";
1365}
1366
1367sal_Bool SwXTextSections::supportsService(const OUString& rServiceName)
1368{
1369 return cppu::supportsService(this, rServiceName);
1370}
1371
1373{
1374 return { "com.sun.star.text.TextSections" };
1375}
1376
1378 SwUnoCollection(_pDoc)
1379{
1380}
1381
1383{
1384}
1385
1387{
1388 SolarMutexGuard aGuard;
1389 if(!IsValid())
1390 throw uno::RuntimeException();
1391 const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1392 size_t nCount = rSectFormats.size();
1393 for(size_t i = nCount; i; --i)
1394 {
1395 if( !rSectFormats[i - 1]->IsInNodesArr())
1396 nCount--;
1397 }
1398 return nCount;
1399}
1400
1402{
1403 SolarMutexGuard aGuard;
1404 uno::Reference< XTextSection > xRet;
1405 if(!IsValid())
1406 throw uno::RuntimeException();
1407
1408 SwSectionFormats& rFormats = GetDoc()->GetSections();
1409
1410 const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1411 const size_t nCount = rSectFormats.size();
1412 for(size_t i = 0; i < nCount; ++i)
1413 {
1414 if( !rSectFormats[i]->IsInNodesArr())
1415 nIndex ++;
1416 else if(static_cast<size_t>(nIndex) == i)
1417 break;
1418 if(static_cast<size_t>(nIndex) == i)
1419 break;
1420 }
1421 if(nIndex < 0 || o3tl::make_unsigned(nIndex) >= rFormats.size())
1422 throw IndexOutOfBoundsException();
1423
1424 SwSectionFormat* pFormat = rFormats[nIndex];
1425 xRet = GetObject(*pFormat);
1426
1427 return Any(xRet);
1428}
1429
1431{
1432 SolarMutexGuard aGuard;
1433 uno::Any aRet;
1434 if(!IsValid())
1435 throw uno::RuntimeException();
1436
1437 SwSectionFormats& rFormats = GetDoc()->GetSections();
1438 uno::Reference< XTextSection > xSect;
1439 for(size_t i = 0; i < rFormats.size(); ++i)
1440 {
1441 SwSectionFormat* pFormat = rFormats[i];
1442 if (pFormat->IsInNodesArr()
1443 && (rName == pFormat->GetSection()->GetSectionName()))
1444 {
1445 xSect = GetObject(*pFormat);
1446 aRet <<= xSect;
1447 break;
1448 }
1449 }
1450 if(!xSect.is())
1451 throw NoSuchElementException();
1452
1453 return aRet;
1454}
1455
1456uno::Sequence< OUString > SwXTextSections::getElementNames()
1457{
1458 SolarMutexGuard aGuard;
1459 if(!IsValid())
1460 throw uno::RuntimeException();
1461 size_t nCount = GetDoc()->GetSections().size();
1462 SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1463 for(size_t i = nCount; i; --i)
1464 {
1465 if( !rSectFormats[i - 1]->IsInNodesArr())
1466 nCount--;
1467 }
1468
1469 uno::Sequence<OUString> aSeq(nCount);
1470 if(nCount)
1471 {
1472 SwSectionFormats& rFormats = GetDoc()->GetSections();
1473 OUString* pArray = aSeq.getArray();
1474 size_t nIndex = 0;
1475 for( size_t i = 0; i < nCount; ++i, ++nIndex)
1476 {
1477 const SwSectionFormat* pFormat = rFormats[nIndex];
1478 while(!pFormat->IsInNodesArr())
1479 {
1480 pFormat = rFormats[++nIndex];
1481 }
1482 pArray[i] = pFormat->GetSection()->GetSectionName();
1483 }
1484 }
1485 return aSeq;
1486}
1487
1489{
1490 SolarMutexGuard aGuard;
1491 bool bRet = false;
1492 if(IsValid())
1493 {
1494 SwSectionFormats& rFormats = GetDoc()->GetSections();
1495 for(size_t i = 0; i < rFormats.size(); ++i)
1496 {
1497 const SwSectionFormat* pFormat = rFormats[i];
1498 if (rName == pFormat->GetSection()->GetSectionName())
1499 {
1500 bRet = true;
1501 break;
1502 }
1503 }
1504 }
1505 else
1506 {
1507 // special handling for dbg_ methods
1508 if( !rName.startsWith("dbg_"))
1509 throw uno::RuntimeException();
1510 }
1511 return bRet;
1512}
1513
1515{
1517}
1518
1520{
1521 SolarMutexGuard aGuard;
1522 size_t nCount = 0;
1523 if(!IsValid())
1524 throw uno::RuntimeException();
1525
1526 SwSectionFormats& rFormats = GetDoc()->GetSections();
1527 nCount = rFormats.size();
1528
1529 return nCount > 0;
1530}
1531
1532uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFormat& rFormat )
1533{
1534 return SwXTextSection::CreateXTextSection(&rFormat);
1535}
1536
1538{
1539 return "SwXBookmarks";
1540}
1541
1542sal_Bool SwXBookmarks::supportsService(const OUString& rServiceName)
1543{
1544 return cppu::supportsService(this, rServiceName);
1545}
1546
1548{
1549 return { "com.sun.star.text.Bookmarks" };
1550}
1551
1553 SwUnoCollection(_pDoc)
1554{ }
1555
1557{ }
1558
1560{
1561 SolarMutexGuard aGuard;
1562 if(!IsValid())
1563 throw uno::RuntimeException();
1564
1565 sal_Int32 count(0);
1566 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1568 pMarkAccess->getBookmarksBegin();
1569 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1570 {
1573 {
1574 ++count; // only count real bookmarks
1575 }
1576 }
1577 return count;
1578}
1579
1581{
1582 SolarMutexGuard aGuard;
1583 if(!IsValid())
1584 throw uno::RuntimeException();
1585 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1586 if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
1587 throw IndexOutOfBoundsException();
1588
1589 sal_Int32 count(0);
1591 pMarkAccess->getBookmarksBegin();
1592 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1593 {
1596 {
1597 if (count == nIndex)
1598 {
1599 uno::Any aRet;
1600 const uno::Reference< text::XTextContent > xRef =
1602 aRet <<= xRef;
1603 return aRet;
1604 }
1605 ++count; // only count real bookmarks
1606 }
1607 }
1608 throw IndexOutOfBoundsException();
1609}
1610
1611uno::Any SwXBookmarks::getByName(const OUString& rName)
1612{
1613 SolarMutexGuard aGuard;
1614 if(!IsValid())
1615 throw uno::RuntimeException();
1616
1617 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1618 IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
1619 if(ppBkmk == pMarkAccess->getBookmarksEnd())
1620 throw NoSuchElementException();
1621
1622 uno::Any aRet;
1623 const uno::Reference< text::XTextContent > xRef =
1625 aRet <<= xRef;
1626 return aRet;
1627}
1628
1629uno::Sequence< OUString > SwXBookmarks::getElementNames()
1630{
1631 SolarMutexGuard aGuard;
1632 if(!IsValid())
1633 throw uno::RuntimeException();
1634
1635 std::vector< OUString > ret;
1636 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1638 pMarkAccess->getBookmarksBegin();
1639 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1640 {
1643 {
1644 ret.push_back((*ppMark)->GetName()); // only add real bookmarks
1645 }
1646 }
1648}
1649
1650sal_Bool SwXBookmarks::hasByName(const OUString& rName)
1651{
1652 SolarMutexGuard aGuard;
1653 if(!IsValid())
1654 throw uno::RuntimeException();
1655
1656 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1657 return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
1658}
1659
1661{
1663}
1664
1666{
1667 SolarMutexGuard aGuard;
1668 if(!IsValid())
1669 throw uno::RuntimeException();
1670
1671 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1673 pMarkAccess->getBookmarksBegin();
1674 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1675 {
1678 {
1679 return true;
1680 }
1681 }
1682 return false;
1683}
1684
1686 SwUnoCollection(_pDoc)
1687{
1688}
1689
1691{
1692}
1693
1695{
1696 SolarMutexGuard aGuard;
1697 if(!IsValid())
1698 throw uno::RuntimeException();
1699 return GetDoc()->GetNumRuleTable().size();
1700}
1701
1703{
1704 SolarMutexGuard aGuard;
1705 uno::Any aRet;
1706 if(!IsValid())
1707 throw uno::RuntimeException();
1708
1709 uno::Reference< XIndexReplace > xRef;
1710 if ( o3tl::make_unsigned(nIndex) < GetDoc()->GetNumRuleTable().size() )
1711 {
1712 xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTable()[ nIndex ], GetDoc());
1713 aRet <<= xRef;
1714 }
1715
1716 if(!xRef.is())
1717 throw IndexOutOfBoundsException();
1718
1719 return aRet;
1720}
1721
1723{
1725}
1726
1728{
1729 SolarMutexGuard aGuard;
1730 if(!IsValid())
1731 throw uno::RuntimeException();
1732 return !GetDoc()->GetNumRuleTable().empty();
1733}
1734
1736{
1737 return "SwXFootnotes";
1738}
1739
1740sal_Bool SwXFootnotes::supportsService(const OUString& rServiceName)
1741{
1742 return cppu::supportsService(this, rServiceName);
1743}
1744
1746{
1747 return { "com.sun.star.text.Footnotes" };
1748}
1749
1751 : SwUnoCollection(_pDoc)
1752 , m_bEndnote(bEnd)
1753{
1754}
1755
1757{
1758}
1759
1761{
1762 SolarMutexGuard aGuard;
1763 if(!IsValid())
1764 throw uno::RuntimeException();
1765 sal_Int32 nCount = 0;
1766 const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1767 SwTextFootnote* pTextFootnote;
1768 for( size_t n = 0; n < nFootnoteCnt; ++n )
1769 {
1770 pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1771 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1772 if ( rFootnote.IsEndNote() != m_bEndnote )
1773 continue;
1774 nCount++;
1775 }
1776 return nCount;
1777}
1778
1780{
1781 SolarMutexGuard aGuard;
1782 uno::Any aRet;
1783 sal_Int32 nCount = 0;
1784 if(!IsValid())
1785 throw uno::RuntimeException();
1786
1787 const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1788 SwTextFootnote* pTextFootnote;
1789 uno::Reference< XFootnote > xRef;
1790 for( size_t n = 0; n < nFootnoteCnt; ++n )
1791 {
1792 pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1793 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1794 if ( rFootnote.IsEndNote() != m_bEndnote )
1795 continue;
1796
1797 if(nCount == nIndex)
1798 {
1800 &const_cast<SwFormatFootnote&>(rFootnote));
1801 aRet <<= xRef;
1802 break;
1803 }
1804 nCount++;
1805 }
1806 if(!xRef.is())
1807 throw IndexOutOfBoundsException();
1808
1809 return aRet;
1810}
1811
1813{
1815}
1816
1818{
1819 SolarMutexGuard aGuard;
1820 if(!IsValid())
1821 throw uno::RuntimeException();
1822 return !GetDoc()->GetFootnoteIdxs().empty();
1823}
1824
1825Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFormatFootnote& rFormat )
1826{
1827 return SwXFootnote::CreateXFootnote(rDoc, &const_cast<SwFormatFootnote&>(rFormat));
1828}
1829
1831{
1832 return "SwXReferenceMarks";
1833}
1834
1836{
1837 return cppu::supportsService(this, rServiceName);
1838}
1839
1841{
1842 return { "com.sun.star.text.ReferenceMarks" };
1843}
1844
1846 SwUnoCollection(_pDoc)
1847{
1848}
1849
1851{
1852}
1853
1855{
1856 SolarMutexGuard aGuard;
1857 if(!IsValid())
1858 throw uno::RuntimeException();
1859 return GetDoc()->GetRefMarks();
1860}
1861
1863{
1864 SolarMutexGuard aGuard;
1865 uno::Any aRet;
1866 if(!IsValid())
1867 throw uno::RuntimeException();
1868 uno::Reference< XTextContent > xRef;
1869 if(0 <= nIndex && nIndex < SAL_MAX_UINT16)
1870 {
1871 SwFormatRefMark *const pMark = const_cast<SwFormatRefMark*>(
1872 GetDoc()->GetRefMark(o3tl::narrowing<sal_uInt16>(nIndex)));
1873 if(pMark)
1874 {
1876 aRet <<= xRef;
1877 }
1878 }
1879 if(!xRef.is())
1880 throw IndexOutOfBoundsException();
1881 return aRet;
1882}
1883
1885{
1886 SolarMutexGuard aGuard;
1887 uno::Any aRet;
1888 if(!IsValid())
1889 throw uno::RuntimeException();
1890
1891 SwFormatRefMark *const pMark =
1892 const_cast<SwFormatRefMark*>(GetDoc()->GetRefMark(rName));
1893 if(!pMark)
1894 throw NoSuchElementException();
1895
1896 uno::Reference<XTextContent> const xRef =
1898 aRet <<= xRef;
1899
1900 return aRet;
1901}
1902
1903uno::Sequence< OUString > SwXReferenceMarks::getElementNames()
1904{
1905 SolarMutexGuard aGuard;
1906 uno::Sequence<OUString> aRet;
1907 if(!IsValid())
1908 throw uno::RuntimeException();
1909
1910 std::vector<OUString> aStrings;
1911 const sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
1912 aRet.realloc(nCount);
1913 OUString* pNames = aRet.getArray();
1914 for(sal_uInt16 i = 0; i < nCount; i++)
1915 pNames[i] = aStrings[i];
1916
1917 return aRet;
1918}
1919
1921{
1922 SolarMutexGuard aGuard;
1923 if(!IsValid())
1924 throw uno::RuntimeException();
1925 return nullptr != GetDoc()->GetRefMark( rName);
1926}
1927
1929{
1931}
1932
1934{
1935 SolarMutexGuard aGuard;
1936 if(!IsValid())
1937 throw uno::RuntimeException();
1938 return 0 != GetDoc()->GetRefMarks();
1939}
1940
1942{
1943 m_bObjectValid = false;
1944 m_pDoc = nullptr;
1945}
1946
1947/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxXTextColumns_createInstance() noexcept
const char * pName
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t findBookmark(const OUString &rMark) const =0
Finds a bookmark by name.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:489
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual sal_Int32 getBookmarksCount() const =0
returns the number of IBookmarks.
BasicManager * GetBasicManager() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
SfxObjectCreateMode GetCreateMode() const
Definition: doc.hxx:195
SwSectionFormats & GetSections()
Definition: doc.hxx:1348
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:769
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
Definition: doc.cxx:235
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:115
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1075
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1097
SwNodes & GetNodes()
Definition: doc.hxx:418
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:68
const SwFlyFrameFormat * FindFlyByName(const OUString &rName, SwNodeType nNdTyp=SwNodeType::NONE) const
Definition: doclay.cxx:1404
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:643
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1874
void SetVBATemplateToProjectCache(css::uno::Reference< css::container::XNameContainer > const &xCache)
Definition: doc.hxx:1643
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1053
const css::uno::Reference< css::container::XNameContainer > & GetVBATemplateToProjectCache() const
Definition: doc.hxx:1644
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:753
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:786
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:820
SwDocShell * GetDocShell()
Definition: doc.hxx:1362
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:243
bool IsEndNote() const
Definition: fmtftn.hxx:73
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const OUString & GetName() const
Definition: format.hxx:131
Style of a layout element.
Definition: frmfmt.hxx:62
Specific frame formats (frames, DrawObjects).
bool empty() const
size_t size() const
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:175
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsGrfNode() const
Definition: node.hxx:707
bool IsNoTextNode() const
Definition: node.hxx:699
bool IsOLENode() const
Definition: node.hxx:703
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2543
SwSection * GetSection() const
Definition: section.cxx:646
bool IsInNodesArr() const
Definition: section.cxx:893
Array of Undo-history.
Definition: docary.hxx:192
const OUString & GetSectionName() const
Definition: section.hxx:171
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
bool m_bObjectValid
Definition: unocoll.hxx:47
SwDoc * GetDoc() const
Definition: unocoll.hxx:59
SwDoc * m_pDoc
Definition: unocoll.hxx:46
bool IsValid() const
Definition: unocoll.hxx:57
virtual void Invalidate()
Definition: unocoll.cxx:1941
size_t size() const
Definition: docary.hxx:87
bool empty() const
Definition: docary.hxx:85
static rtl::Reference< SwXBookmark > CreateXBookmark(SwDoc &rDoc, ::sw::mark::IMark *pBookmark)
Definition: unobkm.cxx:157
SwXBookmarks(SwDoc *pDoc)
Definition: unocoll.cxx:1552
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1547
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1542
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1629
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1611
virtual ~SwXBookmarks() override
Definition: unocoll.cxx:1556
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1650
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1580
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1537
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1660
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1665
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1559
static rtl::Reference< SwXContentControl > CreateXContentControl(SwContentControl &rContentControl, const css::uno::Reference< css::text::XText > &xParentText=nullptr, std::unique_ptr< const TextRangeList_t > &&pPortions=std::unique_ptr< const TextRangeList_t >())
static rtl::Reference< SwXDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1640
static rtl::Reference< SwXDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:401
static rtl::Reference< SwXFieldMaster > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:524
static rtl::Reference< SwXBookmark > CreateXFieldmark(SwDoc &rDoc, ::sw::mark::IMark *pMark, bool isReplacementObject=false)
Definition: unobkm.cxx:674
static rtl::Reference< SwXFootnote > CreateXFootnote(SwDoc &rDoc, SwFormatFootnote *pFootnoteFormat, bool isEndnote=false)
Definition: unoftn.cxx:142
virtual ~SwXFootnotes() override
Definition: unocoll.cxx:1756
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1812
static css::uno::Reference< css::text::XFootnote > GetObject(SwDoc &rDoc, const SwFormatFootnote &rFormat)
Definition: unocoll.cxx:1825
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1817
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1745
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1760
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1779
const bool m_bEndnote
Definition: unocoll.hxx:456
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1735
SwXFootnotes(bool bEnd, SwDoc *pDoc)
Definition: unocoll.cxx:1750
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1740
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1152
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1195
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1265
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1281
const FlyCntType m_eType
Definition: unocoll.hxx:303
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1249
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1142
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1209
SwXFrames(SwDoc *pDoc, FlyCntType eSet)
Definition: unocoll.cxx:1157
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unocoll.cxx:1165
virtual ~SwXFrames() override
Definition: unocoll.cxx:1162
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1186
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1147
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1232
static rtl::Reference< SwXLineBreak > CreateXLineBreak(SwFormatLineBreak *pLineBreakFormat)
static rtl::Reference< SwXMeta > CreateXMeta(::sw::Meta &rMeta, css::uno::Reference< css::text::XText > const &xParentText=nullptr, std::unique_ptr< TextRangeList_t const > &&pPortions=std::unique_ptr< TextRangeList_t const >())
SwXNumberingRulesCollection(SwDoc *pDoc)
Definition: unocoll.cxx:1685
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1722
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1694
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1702
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1727
virtual ~SwXNumberingRulesCollection() override
Definition: unocoll.cxx:1690
static rtl::Reference< SwXParagraph > CreateXParagraph(SwDoc &rDoc, SwTextNode *pTextNode, css::uno::Reference< css::text::XText > const &xParentText=nullptr, const sal_Int32 nSelStart=-1, const sal_Int32 nSelEnd=- 1)
static rtl::Reference< SwXReferenceMark > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:126
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1903
virtual ~SwXReferenceMarks() override
Definition: unocoll.cxx:1850
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1835
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1854
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1933
SwXReferenceMarks(SwDoc *pDoc)
Definition: unocoll.cxx:1845
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1884
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1920
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1830
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1840
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1928
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1862
static SwServiceType GetProviderType(std::u16string_view rServiceName)
Definition: unocoll.cxx:506
static css::uno::Sequence< OUString > GetAllServiceNames()
Definition: unocoll.cxx:486
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
Definition: unocoll.cxx:517
static OUString GetProviderName(SwServiceType nObjectType)
Definition: unocoll.cxx:476
static css::uno::Reference< css::style::XStyle > CreateStyle(SfxStyleFamily eFamily, SwDoc &rDoc)
Definition: unostyle.cxx:997
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:1006
static rtl::Reference< SwXTextEmbeddedObject > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3498
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1338
SwXTextEmbeddedObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1353
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1343
virtual ~SwXTextEmbeddedObjects() override
Definition: unocoll.cxx:1358
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1348
static rtl::Reference< SwXTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1194
static SW_DLLPUBLIC rtl::Reference< SwXTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3222
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1290
SwXTextFrames(SwDoc *pDoc)
Definition: unocoll.cxx:1305
virtual ~SwXTextFrames() override
Definition: unocoll.cxx:1310
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1300
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1295
static rtl::Reference< SwXTextGraphicObject > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3451
SwXTextGraphicObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1329
virtual ~SwXTextGraphicObjects() override
Definition: unocoll.cxx:1334
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1324
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1314
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1319
static rtl::Reference< SwXTextSection > CreateXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader=false)
Definition: unosect.cxx:194
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1430
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1532
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1456
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1362
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1514
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1401
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1488
SwXTextSections(SwDoc *pDoc)
Definition: unocoll.cxx:1377
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1519
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1367
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1372
virtual ~SwXTextSections() override
Definition: unocoll.cxx:1382
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1386
static rtl::Reference< SwXTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
Definition: unotbl.cxx:1964
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:961
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:940
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:979
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:984
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:989
SwXTextTables(SwDoc *pDoc)
Definition: unocoll.cxx:844
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:966
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:864
virtual ~SwXTextTables() override
Definition: unocoll.cxx:850
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:855
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:920
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:974
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:895
css::uno::Type const & get()
bool empty() const
size_type size() const
int nCount
const EnumerationType m_eType
SwFieldIds
Definition: fldbas.hxx:45
@ Database
For old documents the Field-Which IDs must be preserved !!!
@ TableOfAuthorities
FlyCntType
Definition: flyenum.hxx:24
@ FLYCNTTYPE_GRF
Definition: flyenum.hxx:27
@ FLYCNTTYPE_OLE
Definition: flyenum.hxx:28
@ FLYCNTTYPE_FRM
Definition: flyenum.hxx:26
DocumentType eType
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
std::unordered_map< OUString, OUString > StringHashMap
sal_Int32 nIndex
OUString aName
sal_Int64 n
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
size
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
bool equalsAscii(std::u16string_view s1, const char *s2)
bool isAlienWordDoc(SfxObjectShell const &rDocShell)
css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs(SfxObjectShell const *pShell, const char *_pAsciiName, const css::uno::Sequence< css::uno::Any > &aArgs)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
QPRO_FUNC_TYPE nType
SfxStyleFamily
TOXTypes
Definition: toxe.hxx:40
@ TOX_USER
Definition: toxe.hxx:42
@ TOX_CONTENT
Definition: toxe.hxx:43
@ TOX_TABLES
Definition: toxe.hxx:46
@ TOX_INDEX
Definition: toxe.hxx:41
@ TOX_OBJECTS
Definition: toxe.hxx:45
@ TOX_AUTHORITIES
Definition: toxe.hxx:47
@ TOX_ILLUSTRATIONS
Definition: toxe.hxx:44
#define SAL_MAX_UINT16
unsigned char sal_Bool
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base
const SvEventDescription * sw_GetSupportedMacroItems()
Definition: unocoll.cxx:464
const ProvNamesId_Type aProvNamesId[]
Definition: unocoll.cxx:283
#define CSS_TEXT_TEXTFIELD_PAGE_COUNT
Definition: unocoll.hxx:214
#define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET
Definition: unocoll.hxx:208
#define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY
Definition: unocoll.hxx:234
#define CSS_TEXT_TEXTFIELD_MACRO
Definition: unocoll.hxx:199
#define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH
Definition: unocoll.hxx:201
#define CSS_TEXT_FIELDMASTER_USER
Definition: unocoll.hxx:239
#define CSS_TEXT_FIELDMASTER_DATABASE
Definition: unocoll.hxx:242
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
@ FieldTypeConditionedText
@ FieldTypeGraphicObjectCount
@ StyleConditionalParagraph
@ FieldTypeDocInfoRevision
@ FieldTypeDatabaseNextSet
@ FieldTypeDocInfoPrintAuthor
@ FieldTypeDocInfoCreateDateTime
@ FieldTypeDocInfoKeywords
@ FieldTypeDocInfoDescription
@ FieldTypeDocInfoChangeAuthor
@ FieldTypeEmbeddedObjectCount
@ FieldTypeDocInfoEditTime
@ FieldTypeCombinedCharacters
@ FieldTypeDocInfoCreateAuthor
@ FieldTypeDocInfoPrintDateTime
@ FieldTypeDocInfoChangeDateTime
#define CSS_TEXT_TEXTFIELD_TABLE_COUNT
Definition: unocoll.hxx:218
#define CSS_TEXT_TEXTFIELD_ANNOTATION
Definition: unocoll.hxx:197
#define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT
Definition: unocoll.hxx:196
#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME
Definition: unocoll.hxx:228
#define CSS_TEXT_TEXTFIELD_INPUT
Definition: unocoll.hxx:198
#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME
Definition: unocoll.hxx:226
#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET
Definition: unocoll.hxx:204
#define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER
Definition: unocoll.hxx:210
#define CSS_TEXT_TEXTFIELD_PAGE_NUMBER
Definition: unocoll.hxx:192
#define CSS_TEXT_FIELDMASTER_SET_EXPRESSION
Definition: unocoll.hxx:241
#define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY
Definition: unocoll.hxx:243
#define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME
Definition: unocoll.hxx:202
#define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION
Definition: unocoll.hxx:224
#define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT
Definition: unocoll.hxx:238
#define CSS_TEXT_TEXTFIELD_TABLE_FORMULA
Definition: unocoll.hxx:213
#define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS
Definition: unocoll.hxx:229
#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR
Definition: unocoll.hxx:221
#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET
Definition: unocoll.hxx:205
#define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME
Definition: unocoll.hxx:223
#define CSS_TEXT_TEXTFIELD_GET_EXPRESSION
Definition: unocoll.hxx:190
#define CSS_TEXT_TEXTFIELD_SCRIPT
Definition: unocoll.hxx:207
#define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION
Definition: unocoll.hxx:232
#define CSS_TEXT_TEXTFIELD_FILE_NAME
Definition: unocoll.hxx:191
#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR
Definition: unocoll.hxx:225
#define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT
Definition: unocoll.hxx:219
#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT
Definition: unocoll.hxx:220
#define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET
Definition: unocoll.hxx:209
#define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT
Definition: unocoll.hxx:217
#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR
Definition: unocoll.hxx:227
#define CSS_TEXT_TEXTFIELD_WORD_COUNT
Definition: unocoll.hxx:216
#define CSS_TEXT_TEXTFIELD_DROP_DOWN
Definition: unocoll.hxx:236
#define CSS_TEXT_TEXTFIELD_DATABASE_NAME
Definition: unocoll.hxx:212
#define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE
Definition: unocoll.hxx:231
#define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM
Definition: unocoll.hxx:233
#define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT
Definition: unocoll.hxx:230
#define CSS_TEXT_TEXTFIELD_DATE_TIME
Definition: unocoll.hxx:187
#define CSS_TEXT_TEXTFIELD_CHAPTER
Definition: unocoll.hxx:194
#define CSS_TEXT_TEXTFIELD_JUMP_EDIT
Definition: unocoll.hxx:206
#define CSS_TEXT_TEXTFIELD_DATABASE
Definition: unocoll.hxx:211
#define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS
Definition: unocoll.hxx:235
#define CSS_TEXT_FIELDMASTER_DDE
Definition: unocoll.hxx:240
#define CSS_TEXT_TEXTFIELD_GET_REFERENCE
Definition: unocoll.hxx:195
#define CSS_TEXT_TEXTFIELD_AUTHOR
Definition: unocoll.hxx:193
#define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT
Definition: unocoll.hxx:215
#define CSS_TEXT_TEXTFIELD_INPUT_USER
Definition: unocoll.hxx:237
#define CSS_TEXT_TEXTFIELD_USER
Definition: unocoll.hxx:188
#define CSS_TEXT_TEXTFIELD_SET_EXPRESSION
Definition: unocoll.hxx:189
#define CSS_TEXT_TEXTFIELD_EXTENDED_USER
Definition: unocoll.hxx:203
#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME
Definition: unocoll.hxx:222
#define CSS_TEXT_TEXTFIELD_DDE
Definition: unocoll.hxx:200
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapPolygonObject_createInstance(const SvEventDescription *pSupportedMacroItems)
SVT_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvUnoImageMapRectangleObject_createInstance(const SvEventDescription *pSupportedMacroItems)