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 OUString sRet;
479 const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
480 if(static_cast<sal_uInt16>(nObjectType) < nEntries)
481 sRet = OUString::createFromAscii(aProvNamesId[static_cast<sal_uInt16>(nObjectType)].pName);
482 return sRet;
483}
484
486{
487 const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
488 uno::Sequence<OUString> aRet(nEntries);
489 OUString* pArray = aRet.getArray();
490 sal_uInt16 n = 0;
491 for(const ProvNamesId_Type & i : aProvNamesId)
492 {
493 OUString sProv(OUString::createFromAscii(i.pName));
494 if(!sProv.isEmpty())
495 {
496 pArray[n] = sProv;
497 n++;
498 }
499 }
500 aRet.realloc(n);
501 return aRet;
502
503}
504
505SwServiceType SwXServiceProvider::GetProviderType(std::u16string_view rServiceName)
506{
507 for(const ProvNamesId_Type & i : aProvNamesId)
508 {
509 if (o3tl::equalsAscii(rServiceName, i.pName))
510 return i.nType;
511 }
513}
514
515uno::Reference<uno::XInterface>
517{
518 SolarMutexGuard aGuard;
519 uno::Reference< uno::XInterface > xRet;
520 switch(nObjectType)
521 {
523 {
524 xRet = static_cast<cppu::OWeakObject*>(SwXTextTable::CreateXTextTable(nullptr).get());
525 }
526 break;
528 {
529 xRet = static_cast<cppu::OWeakObject*>(SwXTextFrame::CreateXTextFrame(rDoc, nullptr).get());
530 }
531 break;
533 case SwServiceType::TypeTextGraphic /* #i47503# */ :
534 {
535 xRet = static_cast<cppu::OWeakObject*>(SwXTextGraphicObject::CreateXTextGraphicObject(rDoc, nullptr).get());
536
537 }
538 break;
540 {
541 xRet = static_cast<cppu::OWeakObject*>(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(rDoc, nullptr).get());
542 }
543 break;
545 {
546 xRet = static_cast<cppu::OWeakObject*>(SwXBookmark::CreateXBookmark(rDoc, nullptr).get());
547 }
548 break;
550 {
551 xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr).get());
552 }
553 break;
555 {
556 xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true).get());
557 }
558 break;
560#if HAVE_FEATURE_SCRIPTING
561 {
562 xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
563 }
564#endif
565 break;
567#if HAVE_FEATURE_SCRIPTING
568 {
569 if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
570 {
571 xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
572 }
573 }
574#endif
575 break;
577#if HAVE_FEATURE_SCRIPTING
578 {
579 uno::Reference< container::XNameContainer > xProjProv = rDoc.GetVBATemplateToProjectCache();
580 if (!xProjProv.is() && rDoc.GetDocShell()
582 {
583 xProjProv = new SwVbaProjectNameProvider;
584 rDoc.SetVBATemplateToProjectCache(xProjProv);
585 }
586 xRet = xProjProv;
587 }
588#endif
589 break;
591#if HAVE_FEATURE_SCRIPTING
592 {
593 uno::Any aGlobs;
594 BasicManager *pBasicMan = rDoc.GetDocShell()->GetBasicManager();
595 if (pBasicMan && !pBasicMan->GetGlobalUNOConstant("VBAGlobals", aGlobs))
596 {
597 uno::Sequence< uno::Any > aArgs{ uno::Any(rDoc.GetDocShell()->GetModel()) };
598 aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
599 pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
600 }
601 aGlobs >>= xRet;
602 }
603#endif
604 break;
605
607 xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr).get());
608 break;
610 xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr, true).get());
611 break;
615 {
617 if(SwServiceType::ContentIndexMark== nObjectType)
619 else if(SwServiceType::UserIndexMark == nObjectType)
620 eType = TOX_USER;
621 xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType).get());
622 }
623 break;
631 {
633 if(SwServiceType::ContentIndex == nObjectType)
635 else if(SwServiceType::UserIndex == nObjectType)
636 eType = TOX_USER;
637 else if(SwServiceType::IndexIllustrations == nObjectType)
638 {
640 }
641 else if(SwServiceType::IndexObjects == nObjectType)
642 {
644 }
645 else if(SwServiceType::IndexBibliography == nObjectType)
646 {
648 }
649 else if(SwServiceType::IndexTables == nObjectType)
650 {
652 }
653 xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType).get());
654 }
655 break;
658 xRet = static_cast<cppu::OWeakObject*>(SwXTextSection::CreateXTextSection(nullptr,
659 (SwServiceType::IndexHeaderSection == nObjectType)).get());
660
661 break;
663 xRet = static_cast<cppu::OWeakObject*>(SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr).get());
664 break;
673 {
674 SfxStyleFamily eFamily = SfxStyleFamily::Char;
675 switch(nObjectType)
676 {
678 eFamily = SfxStyleFamily::Para;
679 break;
681 eFamily = SfxStyleFamily::Para;
683 break;
685 eFamily = SfxStyleFamily::Frame;
686 break;
688 eFamily = SfxStyleFamily::Page;
689 break;
691 eFamily = SfxStyleFamily::Pseudo;
692 break;
694 eFamily = SfxStyleFamily::Table;
695 break;
697 eFamily = SfxStyleFamily::Cell;
698 break;
699 default: break;
700 }
701 if(!xRet.is())
702 xRet = SwXStyleFamilies::CreateStyle(eFamily, rDoc);
703 }
704 break;
757 // NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0
758 xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType).get());
759 break;
761 xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType).get());
762 break;
767 {
769 switch(nObjectType)
770 {
775 default: break;
776 }
777 xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId).get());
778 }
779 break;
781 {
783 if(!pType)
784 {
785 SwAuthorityFieldType aType(&rDoc);
786 pType = rDoc.getIDocumentFieldsAccess().InsertFieldType(aType);
787 }
788 xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, pType).get());
789 }
790 break;
792 xRet = static_cast<cppu::OWeakObject*>(SwXParagraph::CreateXParagraph(rDoc, nullptr).get());
793 break;
795 xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
796 break;
799 break;
801 xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
802 break;
805 break;
808 break;
811 break;
813 // #i64497# If a chart is in a temporary document during clipboard
814 // paste, there should be no data provider, so that own data is used
815 // This should not happen during copy/paste, as this will unlink
816 // charts using table data.
817 if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED)
818 xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
819 else
820 SAL_WARN("sw.uno",
821 "not creating chart data provider for embedded object");
822
823 break;
825 xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, false).get());
826 break;
828 xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, true).get());
829 break;
831 xRet = static_cast<cppu::OWeakObject*>(SwXLineBreak::CreateXLineBreak(nullptr).get());
832 break;
834 xRet = static_cast<cppu::OWeakObject*>(SwXContentControl::CreateXContentControl(rDoc).get());
835 break;
836 default:
837 throw uno::RuntimeException();
838 }
839 return xRet;
840}
841
842//SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
844 SwUnoCollection(pDc)
845{
846
847}
848
850{
851
852}
853
855{
856 SolarMutexGuard aGuard;
857 sal_Int32 nRet = 0;
858 if(IsValid())
859 nRet = static_cast<sal_Int32>(GetDoc()->GetTableFrameFormatCount(true));
860 return nRet;
861}
862
863uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex)
864{
865 SolarMutexGuard aGuard;
866 uno::Any aRet;
867 if (!IsValid())
868 throw uno::RuntimeException();
869
870 if (nInputIndex < 0)
871 throw IndexOutOfBoundsException();
872
873 SwAutoFormatGetDocNode aGetHt( &GetDoc()->GetNodes() );
874 size_t nIndex = static_cast<size_t>(nInputIndex);
875 size_t nCurrentIndex = 0;
876
877 for(SwTableFormat* pFormat: *GetDoc()->GetTableFrameFormats())
878 {
879 if (!pFormat->GetInfo(aGetHt))
880 {
881 if (nCurrentIndex == nIndex)
882 {
883 uno::Reference<XTextTable> xTable = SwXTextTables::GetObject(*pFormat);
884 aRet <<= xTable;
885 return aRet;
886 }
887 else
888 nCurrentIndex++;
889 }
890 }
891 throw IndexOutOfBoundsException();
892}
893
894uno::Any SwXTextTables::getByName(const OUString& rItemName)
895{
896 SolarMutexGuard aGuard;
897 uno::Any aRet;
898 if(!IsValid())
899 throw uno::RuntimeException();
900
901 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
902 uno::Reference< XTextTable > xTable;
903 for( size_t i = 0; i < nCount; ++i)
904 {
905 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
906 if (rItemName == rFormat.GetName())
907 {
908 xTable = SwXTextTables::GetObject(rFormat);
909 aRet <<= xTable;
910 break;
911 }
912 }
913 if(!xTable.is())
914 throw NoSuchElementException();
915
916 return aRet;
917}
918
919uno::Sequence< OUString > SwXTextTables::getElementNames()
920{
921 SolarMutexGuard aGuard;
922 if(!IsValid())
923 throw uno::RuntimeException();
924 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
925 uno::Sequence<OUString> aSeq(static_cast<sal_Int32>(nCount));
926 if(nCount)
927 {
928 OUString* pArray = aSeq.getArray();
929 for( size_t i = 0; i < nCount; ++i)
930 {
931 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
932
933 pArray[i] = rFormat.GetName();
934 }
935 }
936 return aSeq;
937}
938
939sal_Bool SwXTextTables::hasByName(const OUString& rName)
940{
941 SolarMutexGuard aGuard;
942 bool bRet= false;
943 if(!IsValid())
944 throw uno::RuntimeException();
945
946 const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
947 for( size_t i = 0; i < nCount; ++i)
948 {
949 SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
950 if (rName == rFormat.GetName())
951 {
952 bRet = true;
953 break;
954 }
955 }
956 return bRet;
957}
958
959uno::Type SAL_CALL
961{
963}
964
966{
967 SolarMutexGuard aGuard;
968 if(!IsValid())
969 throw uno::RuntimeException();
970 return 0 != GetDoc()->GetTableFrameFormatCount(true);
971}
972
974{
975 return "SwXTextTables";
976}
977
978sal_Bool SwXTextTables::supportsService(const OUString& rServiceName)
979{
980 return cppu::supportsService(this, rServiceName);
981}
982
984{
985 return { "com.sun.star.text.TextTables" };
986}
987
988uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat)
989{
990 return SwXTextTable::CreateXTextTable(& rFormat);
991}
992
993namespace
994{
995 template<FlyCntType T> struct UnoFrameWrap_traits {};
996
997 template<>
998 struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
999 {
1000 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1001 {
1002 uno::Reference<text::XTextFrame> const xRet(
1003 SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat));
1004 return uno::Any(xRet);
1005 }
1006 static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); };
1007 };
1008
1009 template<>
1010 struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
1011 {
1012 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1013 {
1014 uno::Reference<text::XTextContent> const xRet(
1015 SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1016 return uno::Any(xRet);
1017 }
1018 static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
1019 };
1020
1021 template<>
1022 struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
1023 {
1024 static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1025 {
1026 uno::Reference<text::XTextContent> const xRet(
1027 SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1028 return uno::Any(xRet);
1029 }
1030 static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
1031 };
1032
1033 template<FlyCntType T>
1034 uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat)
1035 {
1036 return UnoFrameWrap_traits<T>::wrapFrame(*pFormat);
1037 }
1038
1039 // runtime adapter for lcl_UnoWrapFrame
1041 uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat, FlyCntType eType)
1042 {
1043 switch(eType)
1044 {
1045 case FLYCNTTYPE_FRM:
1046 return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFormat);
1047 case FLYCNTTYPE_GRF:
1048 return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFormat);
1049 case FLYCNTTYPE_OLE:
1050 return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFormat);
1051 default:
1052 throw uno::RuntimeException();
1053 }
1054 }
1055
1056 template<FlyCntType T>
1057 class SwXFrameEnumeration
1059 {
1060 private:
1061 std::vector< Any > m_aFrames;
1062 protected:
1063 virtual ~SwXFrameEnumeration() override {};
1064 public:
1065 SwXFrameEnumeration(const SwDoc& rDoc);
1066
1067 //XEnumeration
1068 virtual sal_Bool SAL_CALL hasMoreElements() override;
1069 virtual Any SAL_CALL nextElement() override;
1070
1071 //XServiceInfo
1072 virtual OUString SAL_CALL getImplementationName() override;
1073 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
1074 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1075 };
1076}
1077
1078template<FlyCntType T>
1079SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc& rDoc)
1080{
1081 SolarMutexGuard aGuard;
1082 for(sw::SpzFrameFormat* pFormat: *rDoc.GetSpzFrameFormats())
1083 {
1084 // #i104937#
1085 if(pFormat->Which() != RES_FLYFRMFMT || SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT))
1086 continue;
1087 const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1088 if(!pIdx || !pIdx->GetNodes().IsDocNodes())
1089 continue;
1090 const SwNode* pNd = rDoc.GetNodes()[ pIdx->GetIndex() + 1 ];
1091 if(UnoFrameWrap_traits<T>::filter(pNd))
1092 m_aFrames.push_back(lcl_UnoWrapFrame<T>(pFormat));
1093 }
1094}
1095
1096template<FlyCntType T>
1097sal_Bool SwXFrameEnumeration<T>::hasMoreElements()
1098{
1099 SolarMutexGuard aGuard;
1100 return !m_aFrames.empty();
1101}
1102
1103template<FlyCntType T>
1104Any SwXFrameEnumeration<T>::nextElement()
1105{
1106 SolarMutexGuard aGuard;
1107 if(m_aFrames.empty())
1108 throw NoSuchElementException();
1109
1110 Any aResult = m_aFrames.back();
1111 m_aFrames.pop_back();
1112 return aResult;
1113}
1114
1115template<FlyCntType T>
1116OUString SwXFrameEnumeration<T>::getImplementationName()
1117{
1118 return "SwXFrameEnumeration";
1119}
1120
1121template<FlyCntType T>
1122sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName)
1123{
1124 return cppu::supportsService(this, ServiceName);
1125}
1126
1127template<FlyCntType T>
1128Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames()
1129{
1130 return { OUString("com.sun.star.container.XEnumeration") };
1131}
1132
1134{
1135 return "SwXFrames";
1136}
1137
1138sal_Bool SwXFrames::supportsService(const OUString& rServiceName)
1139{
1140 return cppu::supportsService(this, rServiceName);
1141}
1142
1144{
1145 return { OUString("com.sun.star.text.TextFrames") };
1146}
1147
1149 SwUnoCollection(_pDoc),
1150 m_eType(eSet)
1151{}
1152
1154{}
1155
1156uno::Reference<container::XEnumeration> SwXFrames::createEnumeration()
1157{
1158 SolarMutexGuard aGuard;
1159 if(!IsValid())
1160 throw uno::RuntimeException();
1161 switch(m_eType)
1162 {
1163 case FLYCNTTYPE_FRM:
1164 return uno::Reference< container::XEnumeration >(
1165 new SwXFrameEnumeration<FLYCNTTYPE_FRM>(*GetDoc()));
1166 case FLYCNTTYPE_GRF:
1167 return uno::Reference< container::XEnumeration >(
1168 new SwXFrameEnumeration<FLYCNTTYPE_GRF>(*GetDoc()));
1169 case FLYCNTTYPE_OLE:
1170 return uno::Reference< container::XEnumeration >(
1171 new SwXFrameEnumeration<FLYCNTTYPE_OLE>(*GetDoc()));
1172 default:
1173 throw uno::RuntimeException();
1174 }
1175}
1176
1178{
1179 SolarMutexGuard aGuard;
1180 if(!IsValid())
1181 throw uno::RuntimeException();
1182 // Ignore TextBoxes for TextFrames.
1183 return static_cast<sal_Int32>(GetDoc()->GetFlyCount(m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM));
1184}
1185
1187{
1188 SolarMutexGuard aGuard;
1189 if(!IsValid())
1190 throw uno::RuntimeException();
1191 if(nIndex < 0)
1192 throw IndexOutOfBoundsException();
1193 // Ignore TextBoxes for TextFrames.
1194 SwFrameFormat* pFormat = GetDoc()->GetFlyNum(static_cast<size_t>(nIndex), m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM);
1195 if(!pFormat)
1196 throw IndexOutOfBoundsException();
1197 return lcl_UnoWrapFrame(pFormat, m_eType);
1198}
1199
1200uno::Any SwXFrames::getByName(const OUString& rName)
1201{
1202 SolarMutexGuard aGuard;
1203 if(!IsValid())
1204 throw uno::RuntimeException();
1205 const SwFrameFormat* pFormat;
1206 switch(m_eType)
1207 {
1208 case FLYCNTTYPE_GRF:
1209 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Grf);
1210 break;
1211 case FLYCNTTYPE_OLE:
1212 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Ole);
1213 break;
1214 default:
1215 pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Text);
1216 break;
1217 }
1218 if(!pFormat)
1219 throw NoSuchElementException();
1220 return lcl_UnoWrapFrame(const_cast<SwFrameFormat*>(pFormat), m_eType);
1221}
1222
1223uno::Sequence<OUString> SwXFrames::getElementNames()
1224{
1225 SolarMutexGuard aGuard;
1226 if(!IsValid())
1227 throw uno::RuntimeException();
1228 const Reference<XEnumeration> xEnum = createEnumeration();
1229 std::vector<OUString> vNames;
1230 while(xEnum->hasMoreElements())
1231 {
1232 Reference<container::XNamed> xNamed;
1233 xEnum->nextElement() >>= xNamed;
1234 if(xNamed.is())
1235 vNames.push_back(xNamed->getName());
1236 }
1237 return ::comphelper::containerToSequence(vNames);
1238}
1239
1240sal_Bool SwXFrames::hasByName(const OUString& rName)
1241{
1242 SolarMutexGuard aGuard;
1243 if(!IsValid())
1244 throw uno::RuntimeException();
1245 switch(m_eType)
1246 {
1247 case FLYCNTTYPE_GRF:
1248 return GetDoc()->FindFlyByName(rName, SwNodeType::Grf) != nullptr;
1249 case FLYCNTTYPE_OLE:
1250 return GetDoc()->FindFlyByName(rName, SwNodeType::Ole) != nullptr;
1251 default:
1252 return GetDoc()->FindFlyByName(rName, SwNodeType::Text) != nullptr;
1253 }
1254}
1255
1257{
1258 SolarMutexGuard aGuard;
1259 switch(m_eType)
1260 {
1261 case FLYCNTTYPE_FRM:
1263 case FLYCNTTYPE_GRF:
1265 case FLYCNTTYPE_OLE:
1267 default:
1268 return uno::Type();
1269 }
1270}
1271
1273{
1274 SolarMutexGuard aGuard;
1275 if(!IsValid())
1276 throw uno::RuntimeException();
1277 return GetDoc()->GetFlyCount(m_eType) > 0;
1278}
1279
1280
1282{
1283 return "SwXTextFrames";
1284}
1285
1286sal_Bool SwXTextFrames::supportsService(const OUString& rServiceName)
1287{
1288 return cppu::supportsService(this, rServiceName);
1289}
1290
1292{
1293 return { "com.sun.star.text.TextFrames" };
1294}
1295
1298{
1299}
1300
1302{
1303}
1304
1306{
1307 return "SwXTextGraphicObjects";
1308}
1309
1311{
1312 return cppu::supportsService(this, rServiceName);
1313}
1314
1316{
1317 return { "com.sun.star.text.TextGraphicObjects" };
1318}
1319
1322{
1323}
1324
1326{
1327}
1328
1330{
1331 return "SwXTextEmbeddedObjects";
1332}
1333
1335{
1336 return cppu::supportsService(this, rServiceName);
1337}
1338
1340{
1341 return { "com.sun.star.text.TextEmbeddedObjects" };
1342}
1343
1346{
1347}
1348
1350{
1351}
1352
1354{
1355 return "SwXTextSections";
1356}
1357
1358sal_Bool SwXTextSections::supportsService(const OUString& rServiceName)
1359{
1360 return cppu::supportsService(this, rServiceName);
1361}
1362
1364{
1365 return { "com.sun.star.text.TextSections" };
1366}
1367
1369 SwUnoCollection(_pDoc)
1370{
1371}
1372
1374{
1375}
1376
1378{
1379 SolarMutexGuard aGuard;
1380 if(!IsValid())
1381 throw uno::RuntimeException();
1382 const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1383 size_t nCount = rSectFormats.size();
1384 for(size_t i = nCount; i; --i)
1385 {
1386 if( !rSectFormats[i - 1]->IsInNodesArr())
1387 nCount--;
1388 }
1389 return nCount;
1390}
1391
1393{
1394 SolarMutexGuard aGuard;
1395 uno::Reference< XTextSection > xRet;
1396 if(!IsValid())
1397 throw uno::RuntimeException();
1398
1399 SwSectionFormats& rFormats = GetDoc()->GetSections();
1400
1401 const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1402 const size_t nCount = rSectFormats.size();
1403 for(size_t i = 0; i < nCount; ++i)
1404 {
1405 if( !rSectFormats[i]->IsInNodesArr())
1406 nIndex ++;
1407 else if(static_cast<size_t>(nIndex) == i)
1408 break;
1409 if(static_cast<size_t>(nIndex) == i)
1410 break;
1411 }
1412 if(nIndex < 0 || o3tl::make_unsigned(nIndex) >= rFormats.size())
1413 throw IndexOutOfBoundsException();
1414
1415 SwSectionFormat* pFormat = rFormats[nIndex];
1416 xRet = GetObject(*pFormat);
1417
1418 return Any(xRet);
1419}
1420
1422{
1423 SolarMutexGuard aGuard;
1424 uno::Any aRet;
1425 if(!IsValid())
1426 throw uno::RuntimeException();
1427
1428 SwSectionFormats& rFormats = GetDoc()->GetSections();
1429 uno::Reference< XTextSection > xSect;
1430 for(size_t i = 0; i < rFormats.size(); ++i)
1431 {
1432 SwSectionFormat* pFormat = rFormats[i];
1433 if (pFormat->IsInNodesArr()
1434 && (rName == pFormat->GetSection()->GetSectionName()))
1435 {
1436 xSect = GetObject(*pFormat);
1437 aRet <<= xSect;
1438 break;
1439 }
1440 }
1441 if(!xSect.is())
1442 throw NoSuchElementException();
1443
1444 return aRet;
1445}
1446
1447uno::Sequence< OUString > SwXTextSections::getElementNames()
1448{
1449 SolarMutexGuard aGuard;
1450 if(!IsValid())
1451 throw uno::RuntimeException();
1452 size_t nCount = GetDoc()->GetSections().size();
1453 SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1454 for(size_t i = nCount; i; --i)
1455 {
1456 if( !rSectFormats[i - 1]->IsInNodesArr())
1457 nCount--;
1458 }
1459
1460 uno::Sequence<OUString> aSeq(nCount);
1461 if(nCount)
1462 {
1463 SwSectionFormats& rFormats = GetDoc()->GetSections();
1464 OUString* pArray = aSeq.getArray();
1465 size_t nIndex = 0;
1466 for( size_t i = 0; i < nCount; ++i, ++nIndex)
1467 {
1468 const SwSectionFormat* pFormat = rFormats[nIndex];
1469 while(!pFormat->IsInNodesArr())
1470 {
1471 pFormat = rFormats[++nIndex];
1472 }
1473 pArray[i] = pFormat->GetSection()->GetSectionName();
1474 }
1475 }
1476 return aSeq;
1477}
1478
1480{
1481 SolarMutexGuard aGuard;
1482 bool bRet = false;
1483 if(IsValid())
1484 {
1485 SwSectionFormats& rFormats = GetDoc()->GetSections();
1486 for(size_t i = 0; i < rFormats.size(); ++i)
1487 {
1488 const SwSectionFormat* pFormat = rFormats[i];
1489 if (rName == pFormat->GetSection()->GetSectionName())
1490 {
1491 bRet = true;
1492 break;
1493 }
1494 }
1495 }
1496 else
1497 {
1498 // special handling for dbg_ methods
1499 if( !rName.startsWith("dbg_"))
1500 throw uno::RuntimeException();
1501 }
1502 return bRet;
1503}
1504
1506{
1508}
1509
1511{
1512 SolarMutexGuard aGuard;
1513 size_t nCount = 0;
1514 if(!IsValid())
1515 throw uno::RuntimeException();
1516
1517 SwSectionFormats& rFormats = GetDoc()->GetSections();
1518 nCount = rFormats.size();
1519
1520 return nCount > 0;
1521}
1522
1523uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFormat& rFormat )
1524{
1525 return SwXTextSection::CreateXTextSection(&rFormat);
1526}
1527
1529{
1530 return "SwXBookmarks";
1531}
1532
1533sal_Bool SwXBookmarks::supportsService(const OUString& rServiceName)
1534{
1535 return cppu::supportsService(this, rServiceName);
1536}
1537
1539{
1540 return { "com.sun.star.text.Bookmarks" };
1541}
1542
1544 SwUnoCollection(_pDoc)
1545{ }
1546
1548{ }
1549
1551{
1552 SolarMutexGuard aGuard;
1553 if(!IsValid())
1554 throw uno::RuntimeException();
1555
1556 sal_Int32 count(0);
1557 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1559 pMarkAccess->getBookmarksBegin();
1560 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1561 {
1564 {
1565 ++count; // only count real bookmarks
1566 }
1567 }
1568 return count;
1569}
1570
1572{
1573 SolarMutexGuard aGuard;
1574 if(!IsValid())
1575 throw uno::RuntimeException();
1576 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1577 if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
1578 throw IndexOutOfBoundsException();
1579
1580 sal_Int32 count(0);
1582 pMarkAccess->getBookmarksBegin();
1583 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1584 {
1587 {
1588 if (count == nIndex)
1589 {
1590 uno::Any aRet;
1591 const uno::Reference< text::XTextContent > xRef =
1593 aRet <<= xRef;
1594 return aRet;
1595 }
1596 ++count; // only count real bookmarks
1597 }
1598 }
1599 throw IndexOutOfBoundsException();
1600}
1601
1602uno::Any SwXBookmarks::getByName(const OUString& rName)
1603{
1604 SolarMutexGuard aGuard;
1605 if(!IsValid())
1606 throw uno::RuntimeException();
1607
1608 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1609 IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
1610 if(ppBkmk == pMarkAccess->getBookmarksEnd())
1611 throw NoSuchElementException();
1612
1613 uno::Any aRet;
1614 const uno::Reference< text::XTextContent > xRef =
1616 aRet <<= xRef;
1617 return aRet;
1618}
1619
1620uno::Sequence< OUString > SwXBookmarks::getElementNames()
1621{
1622 SolarMutexGuard aGuard;
1623 if(!IsValid())
1624 throw uno::RuntimeException();
1625
1626 std::vector< OUString > ret;
1627 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1629 pMarkAccess->getBookmarksBegin();
1630 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1631 {
1634 {
1635 ret.push_back((*ppMark)->GetName()); // only add real bookmarks
1636 }
1637 }
1639}
1640
1641sal_Bool SwXBookmarks::hasByName(const OUString& rName)
1642{
1643 SolarMutexGuard aGuard;
1644 if(!IsValid())
1645 throw uno::RuntimeException();
1646
1647 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1648 return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
1649}
1650
1652{
1654}
1655
1657{
1658 SolarMutexGuard aGuard;
1659 if(!IsValid())
1660 throw uno::RuntimeException();
1661
1662 IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1664 pMarkAccess->getBookmarksBegin();
1665 ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1666 {
1669 {
1670 return true;
1671 }
1672 }
1673 return false;
1674}
1675
1677 SwUnoCollection(_pDoc)
1678{
1679}
1680
1682{
1683}
1684
1686{
1687 SolarMutexGuard aGuard;
1688 if(!IsValid())
1689 throw uno::RuntimeException();
1690 return GetDoc()->GetNumRuleTable().size();
1691}
1692
1694{
1695 SolarMutexGuard aGuard;
1696 uno::Any aRet;
1697 if(!IsValid())
1698 throw uno::RuntimeException();
1699
1700 uno::Reference< XIndexReplace > xRef;
1701 if ( o3tl::make_unsigned(nIndex) < GetDoc()->GetNumRuleTable().size() )
1702 {
1703 xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTable()[ nIndex ], GetDoc());
1704 aRet <<= xRef;
1705 }
1706
1707 if(!xRef.is())
1708 throw IndexOutOfBoundsException();
1709
1710 return aRet;
1711}
1712
1714{
1716}
1717
1719{
1720 SolarMutexGuard aGuard;
1721 if(!IsValid())
1722 throw uno::RuntimeException();
1723 return !GetDoc()->GetNumRuleTable().empty();
1724}
1725
1727{
1728 return "SwXFootnotes";
1729}
1730
1731sal_Bool SwXFootnotes::supportsService(const OUString& rServiceName)
1732{
1733 return cppu::supportsService(this, rServiceName);
1734}
1735
1737{
1738 return { "com.sun.star.text.Footnotes" };
1739}
1740
1742 : SwUnoCollection(_pDoc)
1743 , m_bEndnote(bEnd)
1744{
1745}
1746
1748{
1749}
1750
1752{
1753 SolarMutexGuard aGuard;
1754 if(!IsValid())
1755 throw uno::RuntimeException();
1756 sal_Int32 nCount = 0;
1757 const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1758 SwTextFootnote* pTextFootnote;
1759 for( size_t n = 0; n < nFootnoteCnt; ++n )
1760 {
1761 pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1762 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1763 if ( rFootnote.IsEndNote() != m_bEndnote )
1764 continue;
1765 nCount++;
1766 }
1767 return nCount;
1768}
1769
1771{
1772 SolarMutexGuard aGuard;
1773 uno::Any aRet;
1774 sal_Int32 nCount = 0;
1775 if(!IsValid())
1776 throw uno::RuntimeException();
1777
1778 const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1779 SwTextFootnote* pTextFootnote;
1780 uno::Reference< XFootnote > xRef;
1781 for( size_t n = 0; n < nFootnoteCnt; ++n )
1782 {
1783 pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1784 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1785 if ( rFootnote.IsEndNote() != m_bEndnote )
1786 continue;
1787
1788 if(nCount == nIndex)
1789 {
1791 &const_cast<SwFormatFootnote&>(rFootnote));
1792 aRet <<= xRef;
1793 break;
1794 }
1795 nCount++;
1796 }
1797 if(!xRef.is())
1798 throw IndexOutOfBoundsException();
1799
1800 return aRet;
1801}
1802
1804{
1806}
1807
1809{
1810 SolarMutexGuard aGuard;
1811 if(!IsValid())
1812 throw uno::RuntimeException();
1813 return !GetDoc()->GetFootnoteIdxs().empty();
1814}
1815
1816Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFormatFootnote& rFormat )
1817{
1818 return SwXFootnote::CreateXFootnote(rDoc, &const_cast<SwFormatFootnote&>(rFormat));
1819}
1820
1822{
1823 return "SwXReferenceMarks";
1824}
1825
1827{
1828 return cppu::supportsService(this, rServiceName);
1829}
1830
1832{
1833 return { "com.sun.star.text.ReferenceMarks" };
1834}
1835
1837 SwUnoCollection(_pDoc)
1838{
1839}
1840
1842{
1843}
1844
1846{
1847 SolarMutexGuard aGuard;
1848 if(!IsValid())
1849 throw uno::RuntimeException();
1850 return GetDoc()->GetRefMarks();
1851}
1852
1854{
1855 SolarMutexGuard aGuard;
1856 uno::Any aRet;
1857 if(!IsValid())
1858 throw uno::RuntimeException();
1859 uno::Reference< XTextContent > xRef;
1860 if(0 <= nIndex && nIndex < SAL_MAX_UINT16)
1861 {
1862 SwFormatRefMark *const pMark = const_cast<SwFormatRefMark*>(
1863 GetDoc()->GetRefMark(o3tl::narrowing<sal_uInt16>(nIndex)));
1864 if(pMark)
1865 {
1867 aRet <<= xRef;
1868 }
1869 }
1870 if(!xRef.is())
1871 throw IndexOutOfBoundsException();
1872 return aRet;
1873}
1874
1876{
1877 SolarMutexGuard aGuard;
1878 uno::Any aRet;
1879 if(!IsValid())
1880 throw uno::RuntimeException();
1881
1882 SwFormatRefMark *const pMark =
1883 const_cast<SwFormatRefMark*>(GetDoc()->GetRefMark(rName));
1884 if(!pMark)
1885 throw NoSuchElementException();
1886
1887 uno::Reference<XTextContent> const xRef =
1889 aRet <<= xRef;
1890
1891 return aRet;
1892}
1893
1894uno::Sequence< OUString > SwXReferenceMarks::getElementNames()
1895{
1896 SolarMutexGuard aGuard;
1897 uno::Sequence<OUString> aRet;
1898 if(!IsValid())
1899 throw uno::RuntimeException();
1900
1901 std::vector<OUString> aStrings;
1902 const sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
1903 aRet.realloc(nCount);
1904 OUString* pNames = aRet.getArray();
1905 for(sal_uInt16 i = 0; i < nCount; i++)
1906 pNames[i] = aStrings[i];
1907
1908 return aRet;
1909}
1910
1912{
1913 SolarMutexGuard aGuard;
1914 if(!IsValid())
1915 throw uno::RuntimeException();
1916 return nullptr != GetDoc()->GetRefMark( rName);
1917}
1918
1920{
1922}
1923
1925{
1926 SolarMutexGuard aGuard;
1927 if(!IsValid())
1928 throw uno::RuntimeException();
1929 return 0 != GetDoc()->GetRefMarks();
1930}
1931
1933{
1934 m_bObjectValid = false;
1935 m_pDoc = nullptr;
1936}
1937
1938/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SVXCORE_DLLPUBLIC css::uno::Reference< css::uno::XInterface > SvxXTextColumns_createInstance() noexcept
const char * pName
const OUString & GetName() const
void SetGlobalUNOConstant(const OUString &rName, const css::uno::Any &_rValue, css::uno::Any *pOldValue=nullptr)
bool GetGlobalUNOConstant(const OUString &rName, css::uno::Any &aOut)
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:502
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:197
SwSectionFormats & GetSections()
Definition: doc.hxx:1356
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:778
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
Definition: doc.cxx:241
const sw::TableFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:826
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:112
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1081
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1104
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:69
const SwFlyFrameFormat * FindFlyByName(const OUString &rName, SwNodeType nNdTyp=SwNodeType::NONE) const
Definition: doclay.cxx:1420
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
void SetVBATemplateToProjectCache(css::uno::Reference< css::container::XNameContainer > const &xCache)
Definition: doc.hxx:1651
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1060
SwTableFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:795
const css::uno::Reference< css::container::XNameContainer > & GetVBATemplateToProjectCache() const
Definition: doc.hxx:1652
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
bool IsEndNote() const
Definition: fmtftn.hxx:75
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:72
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:119
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsGrfNode() const
Definition: node.hxx:195
bool IsNoTextNode() const
Definition: node.hxx:194
bool IsOLENode() const
Definition: node.hxx:193
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2555
SwSection * GetSection() const
Definition: section.cxx:646
bool IsInNodesArr() const
Definition: section.cxx:885
Array of Undo-history.
Definition: docary.hxx:193
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:1932
size_t size() const
Definition: docary.hxx:88
bool empty() const
Definition: docary.hxx:86
static rtl::Reference< SwXBookmark > CreateXBookmark(SwDoc &rDoc, ::sw::mark::IMark *pBookmark)
Definition: unobkm.cxx:157
SwXBookmarks(SwDoc *pDoc)
Definition: unocoll.cxx:1543
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1538
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1533
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1620
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1602
virtual ~SwXBookmarks() override
Definition: unocoll.cxx:1547
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1641
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1571
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1528
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1651
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1656
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1550
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:1638
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:1747
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1803
static css::uno::Reference< css::text::XFootnote > GetObject(SwDoc &rDoc, const SwFormatFootnote &rFormat)
Definition: unocoll.cxx:1816
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1808
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1736
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1751
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1770
const bool m_bEndnote
Definition: unocoll.hxx:456
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1726
SwXFootnotes(bool bEnd, SwDoc *pDoc)
Definition: unocoll.cxx:1741
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1731
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1143
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1186
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1256
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1272
const FlyCntType m_eType
Definition: unocoll.hxx:303
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1240
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1133
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1200
SwXFrames(SwDoc *pDoc, FlyCntType eSet)
Definition: unocoll.cxx:1148
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unocoll.cxx:1156
virtual ~SwXFrames() override
Definition: unocoll.cxx:1153
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1177
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1138
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1223
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:1676
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1713
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1685
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1693
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1718
virtual ~SwXNumberingRulesCollection() override
Definition: unocoll.cxx:1681
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:1894
virtual ~SwXReferenceMarks() override
Definition: unocoll.cxx:1841
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1826
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1845
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1924
SwXReferenceMarks(SwDoc *pDoc)
Definition: unocoll.cxx:1836
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1875
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1911
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1821
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1831
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1919
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1853
static SwServiceType GetProviderType(std::u16string_view rServiceName)
Definition: unocoll.cxx:505
static css::uno::Sequence< OUString > GetAllServiceNames()
Definition: unocoll.cxx:485
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
Definition: unocoll.cxx:516
static OUString GetProviderName(SwServiceType nObjectType)
Definition: unocoll.cxx:476
static css::uno::Reference< css::style::XStyle > CreateStyle(SfxStyleFamily eFamily, SwDoc &rDoc)
Definition: unostyle.cxx:999
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:1008
static rtl::Reference< SwXTextEmbeddedObject > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3501
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1329
SwXTextEmbeddedObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1344
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1334
virtual ~SwXTextEmbeddedObjects() override
Definition: unocoll.cxx:1349
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1339
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:3234
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1281
SwXTextFrames(SwDoc *pDoc)
Definition: unocoll.cxx:1296
virtual ~SwXTextFrames() override
Definition: unocoll.cxx:1301
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1291
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1286
static rtl::Reference< SwXTextGraphicObject > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3454
SwXTextGraphicObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1320
virtual ~SwXTextGraphicObjects() override
Definition: unocoll.cxx:1325
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1315
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1305
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1310
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:1421
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1523
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1447
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1353
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1505
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1392
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1479
SwXTextSections(SwDoc *pDoc)
Definition: unocoll.cxx:1368
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1510
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1358
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1363
virtual ~SwXTextSections() override
Definition: unocoll.cxx:1373
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1377
static rtl::Reference< SwXTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
Definition: unotbl.cxx:1953
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:960
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:939
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:978
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:983
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:988
SwXTextTables(SwDoc *pDoc)
Definition: unocoll.cxx:843
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:965
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:863
virtual ~SwXTextTables() override
Definition: unocoll.cxx:849
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:854
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:919
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:973
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:894
css::uno::Type const & get()
bool empty() const
size_type size() const
int nCount
const EnumerationType m_eType
SwFieldIds
Definition: fldbas.hxx:49
@ 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(162)
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, std::string_view 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)