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 <svtools/unoimap.hxx>
37 #include <svtools/unoevent.hxx>
38 #include <svx/SvxXTextColumns.hxx>
39 #include <unotbl.hxx>
40 #include <unostyle.hxx>
41 #include <unofield.hxx>
42 #include <unoidx.hxx>
43 #include <unoframe.hxx>
44 #include <textboxhelper.hxx>
45 #include <unofootnote.hxx>
46 #include <vcl/svapp.hxx>
47 #include <fmtcntnt.hxx>
48 #include <authfld.hxx>
49 #include <SwXTextDefaults.hxx>
50 #include <unochart.hxx>
51 #include <comphelper/sequence.hxx>
53 #include <unosection.hxx>
54 #include <unoparagraph.hxx>
55 #include <unobookmark.hxx>
56 #include <unorefmark.hxx>
57 #include <unometa.hxx>
58 #include <docsh.hxx>
59 #include <hints.hxx>
60 #include <frameformats.hxx>
61 #include <com/sun/star/document/XCodeNameQuery.hpp>
62 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
63 #include <com/sun/star/form/XFormsSupplier.hpp>
64 #include <com/sun/star/script/ModuleInfo.hpp>
65 #include <com/sun/star/script/ModuleType.hpp>
66 #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
67 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
69 #include <basic/basmgr.hxx>
71 #include <cppuhelper/implbase.hxx>
72 #include <sfx2/event.hxx>
73 #include <sal/log.hxx>
74 
75 using namespace ::com::sun::star;
76 using namespace ::com::sun::star::document;
77 using namespace ::com::sun::star::uno;
78 using namespace ::com::sun::star::text;
79 using namespace ::com::sun::star::container;
80 using namespace ::com::sun::star::lang;
81 
82 #if HAVE_FEATURE_SCRIPTING
83 
84 namespace {
85 
86 class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery >
87 {
88  SwDocShell* mpDocShell;
89  OUString msThisDocumentCodeName;
90 public:
91  explicit SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
92  // XCodeNameQuery
93 
94  OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) override
95  {
96  // #FIXME not implemented...
97  return OUString();
98  }
99 
100  OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) override
101  {
102  // Initialise the code name
103  if ( msThisDocumentCodeName.isEmpty() )
104  {
105  try
106  {
107  uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
108  uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
109  OUString sProjectName( "Standard");
110  if ( !mpDocShell->GetBasicManager()->GetName().isEmpty() )
111  {
112  sProjectName = mpDocShell->GetBasicManager()->GetName();
113  }
114  uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
115  const uno::Sequence< OUString > sModuleNames = xLib->getElementNames();
116  uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
117 
118  auto pModuleName = std::find_if(sModuleNames.begin(), sModuleNames.end(), [&xVBAModuleInfo](const OUString& rName) {
119  return xVBAModuleInfo->hasModuleInfo(rName)
120  && xVBAModuleInfo->getModuleInfo(rName).ModuleType == script::ModuleType::DOCUMENT; });
121  if (pModuleName != sModuleNames.end())
122  msThisDocumentCodeName = *pModuleName;
123  }
124  catch( uno::Exception& )
125  {
126  }
127  }
128  OUString sCodeName;
129  if ( mpDocShell )
130  {
131  // need to find the page ( and index ) for this control
132  uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
133  uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
134 
135  try
136  {
137  uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
138  uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
139  // get the www-standard container
140  uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
141  sal_Int32 nCntrls = xFormControls->getCount();
142  for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
143  {
144  uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
145  bool bMatched = ( xControl == xIf );
146  if ( bMatched )
147  {
148  sCodeName = msThisDocumentCodeName;
149  break;
150  }
151  }
152  }
153  catch( uno::Exception& )
154  {
155  }
156  }
157  // #TODO Probably should throw here ( if !bMatched )
158  return sCodeName;
159  }
160 };
161 
162 }
163 
164 typedef std::unordered_map< OUString, OUString > StringHashMap;
165 
166 namespace {
167 
168 class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer >
169 {
170  StringHashMap mTemplateToProject;
171 public:
172  SwVbaProjectNameProvider()
173  {
174  }
175  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
176  {
177  return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
178  }
179  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
180  {
181  if ( !hasByName( aName ) )
182  throw container::NoSuchElementException();
183  return uno::makeAny( mTemplateToProject.find( aName )->second );
184  }
185  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
186  {
187  return comphelper::mapKeysToSequence( mTemplateToProject );
188  }
189 
190  virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) override
191  {
192 
193  OUString sProjectName;
194  aElement >>= sProjectName;
195  SAL_INFO("sw.uno", "Template cache inserting template name " << aName
196  << " with project " << sProjectName);
197  mTemplateToProject[ aName ] = sProjectName;
198  }
199 
200  virtual void SAL_CALL removeByName( const OUString& Name ) override
201  {
202  if ( !hasByName( Name ) )
203  throw container::NoSuchElementException();
204  mTemplateToProject.erase( Name );
205  }
206  virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) override
207  {
208  if ( !hasByName( aName ) )
209  throw container::NoSuchElementException();
210  insertByName( aName, aElement ); // insert will overwrite
211  }
212  // XElemenAccess
213  virtual css::uno::Type SAL_CALL getElementType( ) override
214  {
216  }
217  virtual sal_Bool SAL_CALL hasElements( ) override
218  {
219 
220  return ( !mTemplateToProject.empty() );
221  }
222 
223 };
224 
225 class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess >
226 {
227  SwDocShell* mpDocShell;
228 public:
229  explicit SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
230  {
231  // #FIXME #TODO is the code name for ThisDocument read anywhere?
232  }
233 
234  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
235  {
236  // #FIXME #TODO we really need to be checking against the codename for
237  // ThisDocument
238  if ( aName == "ThisDocument" )
239  return true;
240  return false;
241  }
242 
243  css::uno::Any SAL_CALL getByName( const OUString& aName ) override
244  {
245  if ( !hasByName( aName ) )
246  throw container::NoSuchElementException();
247  uno::Sequence< uno::Any > aArgs( 2 );
248  aArgs[0] <<= uno::Reference< uno::XInterface >();
249  aArgs[1] <<= mpDocShell->GetModel();
250  uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
251  SAL_INFO("sw.uno",
252  "Creating Object ( ooo.vba.word.Document ) 0x" << xDocObj.get());
253  return uno::makeAny( xDocObj );
254  }
255  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
256  {
257  uno::Sequence< OUString > aNames;
258  return aNames;
259  }
260  // XElemenAccess
261  virtual css::uno::Type SAL_CALL getElementType( ) override { return uno::Type(); }
262  virtual sal_Bool SAL_CALL hasElements( ) override { return true; }
263 
264 };
265 
266 }
267 
268 #endif
269 
270 namespace {
271 
272 struct ProvNamesId_Type
273 {
274  const char * pName;
276 };
277 
278 }
279 
280 // note: this thing is indexed as an array, so do not insert/remove entries!
281 const ProvNamesId_Type aProvNamesId[] =
282 {
283  { "com.sun.star.text.TextTable", SwServiceType::TypeTextTable },
284  { "com.sun.star.text.TextFrame", SwServiceType::TypeTextFrame },
285  { "com.sun.star.text.GraphicObject", SwServiceType::TypeGraphic },
286  { "com.sun.star.text.TextEmbeddedObject", SwServiceType::TypeOLE },
287  { "com.sun.star.text.Bookmark", SwServiceType::TypeBookmark },
288  { "com.sun.star.text.Footnote", SwServiceType::TypeFootnote },
289  { "com.sun.star.text.Endnote", SwServiceType::TypeEndnote },
290  { "com.sun.star.text.DocumentIndexMark", SwServiceType::TypeIndexMark },
291  { "com.sun.star.text.DocumentIndex", SwServiceType::TypeIndex },
292  { "com.sun.star.text.ReferenceMark", SwServiceType::ReferenceMark },
293  { "com.sun.star.style.CharacterStyle", SwServiceType::StyleCharacter },
294  { "com.sun.star.style.ParagraphStyle", SwServiceType::StyleParagraph },
295  { "com.sun.star.style.FrameStyle", SwServiceType::StyleFrame },
296  { "com.sun.star.style.PageStyle", SwServiceType::StylePage },
297  { "com.sun.star.style.NumberingStyle", SwServiceType::StyleNumbering },
298  { "com.sun.star.text.ContentIndexMark", SwServiceType::ContentIndexMark },
299  { "com.sun.star.text.ContentIndex", SwServiceType::ContentIndex },
300  { "com.sun.star.text.UserIndexMark", SwServiceType::UserIndexMark },
301  { "com.sun.star.text.UserIndex", SwServiceType::UserIndex },
302  { "com.sun.star.text.TextSection", SwServiceType::TextSection },
303  { "com.sun.star.text.TextField.DateTime", SwServiceType::FieldTypeDateTime },
304  { "com.sun.star.text.TextField.User", SwServiceType::FieldTypeUser },
305  { "com.sun.star.text.TextField.SetExpression", SwServiceType::FieldTypeSetExp },
306  { "com.sun.star.text.TextField.GetExpression", SwServiceType::FieldTypeGetExp },
307  { "com.sun.star.text.TextField.FileName", SwServiceType::FieldTypeFileName },
308  { "com.sun.star.text.TextField.PageNumber", SwServiceType::FieldTypePageNum },
309  { "com.sun.star.text.TextField.Author", SwServiceType::FieldTypeAuthor },
310  { "com.sun.star.text.TextField.Chapter", SwServiceType::FieldTypeChapter },
312  { "com.sun.star.text.TextField.GetReference", SwServiceType::FieldTypeGetReference },
313  { "com.sun.star.text.TextField.ConditionalText", SwServiceType::FieldTypeConditionedText },
314  { "com.sun.star.text.TextField.Annotation", SwServiceType::FieldTypeAnnotation },
315  { "com.sun.star.text.TextField.Input", SwServiceType::FieldTypeInput },
316  { "com.sun.star.text.TextField.Macro", SwServiceType::FieldTypeMacro },
317  { "com.sun.star.text.TextField.DDE", SwServiceType::FieldTypeDDE },
318  { "com.sun.star.text.TextField.HiddenParagraph", SwServiceType::FieldTypeHiddenPara },
319  { "" /*com.sun.star.text.TextField.DocumentInfo"*/, SwServiceType::FieldTypeDocInfo },
320  { "com.sun.star.text.TextField.TemplateName", SwServiceType::FieldTypeTemplateName },
321  { "com.sun.star.text.TextField.ExtendedUser", SwServiceType::FieldTypeUserExt },
322  { "com.sun.star.text.TextField.ReferencePageSet", SwServiceType::FieldTypeRefPageSet },
323  { "com.sun.star.text.TextField.ReferencePageGet", SwServiceType::FieldTypeRefPageGet },
324  { "com.sun.star.text.TextField.JumpEdit", SwServiceType::FieldTypeJumpEdit },
325  { "com.sun.star.text.TextField.Script", SwServiceType::FieldTypeScript },
326  { "com.sun.star.text.TextField.DatabaseNextSet", SwServiceType::FieldTypeDatabaseNextSet },
327  { "com.sun.star.text.TextField.DatabaseNumberOfSet", SwServiceType::FieldTypeDatabaseNumSet },
328  { "com.sun.star.text.TextField.DatabaseSetNumber", SwServiceType::FieldTypeDatabaseSetNum },
329  { "com.sun.star.text.TextField.Database", SwServiceType::FieldTypeDatabase },
330  { "com.sun.star.text.TextField.DatabaseName", SwServiceType::FieldTypeDatabaseName },
331  { "com.sun.star.text.TextField.TableFormula", SwServiceType::FieldTypeTableFormula },
332  { "com.sun.star.text.TextField.PageCount", SwServiceType::FieldTypePageCount },
333  { "com.sun.star.text.TextField.ParagraphCount", SwServiceType::FieldTypeParagraphCount },
334  { "com.sun.star.text.TextField.WordCount", SwServiceType::FieldTypeWordCount },
335  { "com.sun.star.text.TextField.CharacterCount", SwServiceType::FieldTypeCharacterCount },
336  { "com.sun.star.text.TextField.TableCount", SwServiceType::FieldTypeTableCount },
337  { "com.sun.star.text.TextField.GraphicObjectCount", SwServiceType::FieldTypeGraphicObjectCount },
338  { "com.sun.star.text.TextField.EmbeddedObjectCount", SwServiceType::FieldTypeEmbeddedObjectCount },
339  { "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SwServiceType::FieldTypeDocInfoChangeAuthor },
340  { "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SwServiceType::FieldTypeDocInfoChangeDateTime },
341  { "com.sun.star.text.TextField.DocInfo.EditTime", SwServiceType::FieldTypeDocInfoEditTime },
342  { "com.sun.star.text.TextField.DocInfo.Description", SwServiceType::FieldTypeDocInfoDescription },
343  { "com.sun.star.text.TextField.DocInfo.CreateAuthor", SwServiceType::FieldTypeDocInfoCreateAuthor },
344  { "com.sun.star.text.TextField.DocInfo.CreateDateTime", SwServiceType::FieldTypeDocInfoCreateDateTime },
349  { "com.sun.star.text.TextField.DocInfo.Custom", SwServiceType::FieldTypeDocInfoCustom },
350  { "com.sun.star.text.TextField.DocInfo.PrintAuthor", SwServiceType::FieldTypeDocInfoPrintAuthor },
351  { "com.sun.star.text.TextField.DocInfo.PrintDateTime", SwServiceType::FieldTypeDocInfoPrintDateTime },
352  { "com.sun.star.text.TextField.DocInfo.KeyWords", SwServiceType::FieldTypeDocInfoKeywords },
353  { "com.sun.star.text.TextField.DocInfo.Subject", SwServiceType::FieldTypeDocInfoSubject },
354  { "com.sun.star.text.TextField.DocInfo.Title", SwServiceType::FieldTypeDocInfoTitle },
355  { "com.sun.star.text.TextField.DocInfo.Revision", SwServiceType::FieldTypeDocInfoRevision },
356  { "com.sun.star.text.TextField.Bibliography", SwServiceType::FieldTypeBibliography },
357  { "com.sun.star.text.TextField.CombinedCharacters", SwServiceType::FieldTypeCombinedCharacters },
358  { "com.sun.star.text.TextField.DropDown", SwServiceType::FieldTypeDropdown },
359  { "com.sun.star.text.textfield.MetadataField", SwServiceType::FieldTypeMetafield },
364  { "com.sun.star.text.FieldMaster.User", SwServiceType::FieldMasterUser },
365  { "com.sun.star.text.FieldMaster.DDE", SwServiceType::FieldMasterDDE },
366  { "com.sun.star.text.FieldMaster.SetExpression", SwServiceType::FieldMasterSetExp },
367  { "com.sun.star.text.FieldMaster.Database", SwServiceType::FieldMasterDatabase },
368  { "com.sun.star.text.FieldMaster.Bibliography", SwServiceType::FieldMasterBibliography },
373  { "com.sun.star.text.IllustrationsIndex", SwServiceType::IndexIllustrations },
374  { "com.sun.star.text.ObjectIndex", SwServiceType::IndexObjects },
375  { "com.sun.star.text.TableIndex", SwServiceType::IndexTables },
376  { "com.sun.star.text.Bibliography", SwServiceType::IndexBibliography },
377  { "com.sun.star.text.Paragraph", SwServiceType::Paragraph },
378  { "com.sun.star.text.TextField.InputUser", SwServiceType::FieldTypeInputUser },
379  { "com.sun.star.text.TextField.HiddenText", SwServiceType::FieldTypeHiddenText },
380  { "com.sun.star.style.ConditionalParagraphStyle", SwServiceType::StyleConditionalParagraph },
381  { "com.sun.star.text.NumberingRules", SwServiceType::NumberingRules },
382  { "com.sun.star.text.TextColumns", SwServiceType::TextColumns },
383  { "com.sun.star.text.IndexHeaderSection", SwServiceType::IndexHeaderSection },
384  { "com.sun.star.text.Defaults", SwServiceType::Defaults },
385  { "com.sun.star.image.ImageMapRectangleObject", SwServiceType::IMapRectangle },
386  { "com.sun.star.image.ImageMapCircleObject", SwServiceType::IMapCircle },
387  { "com.sun.star.image.ImageMapPolygonObject", SwServiceType::IMapPolygon },
388  { "com.sun.star.text.TextGraphicObject", SwServiceType::TypeTextGraphic },
389  { "com.sun.star.chart2.data.DataProvider", SwServiceType::Chart2DataProvider },
390  { "com.sun.star.text.Fieldmark", SwServiceType::TypeFieldMark },
391  { "com.sun.star.text.FormFieldmark", SwServiceType::TypeFormFieldMark },
392  { "com.sun.star.text.InContentMetadata", SwServiceType::TypeMeta },
393  { "ooo.vba.VBAObjectModuleObjectProvider", SwServiceType::VbaObjectProvider },
394  { "ooo.vba.VBACodeNameProvider", SwServiceType::VbaCodeNameProvider },
395  { "ooo.vba.VBAProjectNameProvider", SwServiceType::VbaProjectNameProvider },
396  { "ooo.vba.VBAGlobals", SwServiceType::VbaGlobals },
397 
398  // case-correct versions of the service names (see #i67811)
456  { "com.sun.star.style.TableStyle", SwServiceType::StyleTable },
457  { "com.sun.star.style.CellStyle", SwServiceType::StyleCell }
458 };
459 
461 {
462  static const SvEventDescription aMacroDescriptionsImpl[] =
463  {
464  { SvMacroItemId::OnMouseOver, "OnMouseOver" },
465  { SvMacroItemId::OnMouseOut, "OnMouseOut" },
466  { SvMacroItemId::NONE, nullptr }
467  };
468 
469  return aMacroDescriptionsImpl;
470 }
471 
473 {
474  SolarMutexGuard aGuard;
475  OUString sRet;
476  const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
477  if(static_cast<sal_uInt16>(nObjectType) < nEntries)
478  sRet = OUString::createFromAscii(aProvNamesId[static_cast<sal_uInt16>(nObjectType)].pName);
479  return sRet;
480 }
481 
482 uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
483 {
484  const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
485  uno::Sequence<OUString> aRet(nEntries);
486  OUString* pArray = aRet.getArray();
487  sal_uInt16 n = 0;
488  for(const ProvNamesId_Type & i : aProvNamesId)
489  {
490  OUString sProv(OUString::createFromAscii(i.pName));
491  if(!sProv.isEmpty())
492  {
493  pArray[n] = sProv;
494  n++;
495  }
496  }
497  aRet.realloc(n);
498  return aRet;
499 
500 }
501 
503 {
504  for(const ProvNamesId_Type & i : aProvNamesId)
505  {
506  if (rServiceName.equalsAscii(i.pName))
507  return i.nType;
508  }
509  return SwServiceType::Invalid;
510 }
511 
512 uno::Reference<uno::XInterface>
514 {
515  SolarMutexGuard aGuard;
516  uno::Reference< uno::XInterface > xRet;
517  switch(nObjectType)
518  {
520  {
521  xRet = SwXTextTable::CreateXTextTable(nullptr);
522  }
523  break;
525  {
526  xRet = SwXTextFrame::CreateXTextFrame(rDoc, nullptr);
527  }
528  break;
530  case SwServiceType::TypeTextGraphic /* #i47503# */ :
531  {
533 
534  }
535  break;
537  {
539  }
540  break;
542  {
543  xRet = SwXBookmark::CreateXBookmark(rDoc, nullptr);
544  }
545  break;
547  {
548  xRet = SwXFieldmark::CreateXFieldmark(rDoc, nullptr);
549  }
550  break;
552  {
553  xRet = SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true);
554  }
555  break;
557 #if HAVE_FEATURE_SCRIPTING
558  {
559  xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
560  }
561 #endif
562  break;
564 #if HAVE_FEATURE_SCRIPTING
565  {
566  if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
567  {
568  xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
569  }
570  }
571 #endif
572  break;
574 #if HAVE_FEATURE_SCRIPTING
575  {
576  uno::Reference< container::XNameContainer > xProjProv = rDoc.GetVBATemplateToProjectCache();
577  if (!xProjProv.is() && rDoc.GetDocShell()
579  {
580  xProjProv = new SwVbaProjectNameProvider;
581  rDoc.SetVBATemplateToProjectCache(xProjProv);
582  }
583  xRet = xProjProv;
584  }
585 #endif
586  break;
588 #if HAVE_FEATURE_SCRIPTING
589  {
590  uno::Any aGlobs;
591  BasicManager *pBasicMan = rDoc.GetDocShell()->GetBasicManager();
592  if (pBasicMan && !pBasicMan->GetGlobalUNOConstant("VBAGlobals", aGlobs))
593  {
594  uno::Sequence< uno::Any > aArgs(1);
595  aArgs[ 0 ] <<= rDoc.GetDocShell()->GetModel();
596  aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
597  pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
598  }
599  aGlobs >>= xRet;
600  }
601 #endif
602  break;
603 
605  xRet = SwXFootnote::CreateXFootnote(rDoc, nullptr);
606  break;
608  xRet = SwXFootnote::CreateXFootnote(rDoc, nullptr, true);
609  break;
613  {
615  if(SwServiceType::ContentIndexMark== nObjectType)
616  eType = TOX_CONTENT;
617  else if(SwServiceType::UserIndexMark == nObjectType)
618  eType = TOX_USER;
619  xRet = SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType);
620  }
621  break;
629  {
631  if(SwServiceType::ContentIndex == nObjectType)
632  eType = TOX_CONTENT;
633  else if(SwServiceType::UserIndex == nObjectType)
634  eType = TOX_USER;
635  else if(SwServiceType::IndexIllustrations == nObjectType)
636  {
637  eType = TOX_ILLUSTRATIONS;
638  }
639  else if(SwServiceType::IndexObjects == nObjectType)
640  {
641  eType = TOX_OBJECTS;
642  }
643  else if(SwServiceType::IndexBibliography == nObjectType)
644  {
645  eType = TOX_AUTHORITIES;
646  }
647  else if(SwServiceType::IndexTables == nObjectType)
648  {
649  eType = TOX_TABLES;
650  }
651  xRet = SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType);
652  }
653  break;
656  xRet = SwXTextSection::CreateXTextSection(nullptr,
657  (SwServiceType::IndexHeaderSection == nObjectType));
658 
659  break;
661  xRet = SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr);
662  break;
671  {
672  SfxStyleFamily eFamily = SfxStyleFamily::Char;
673  switch(nObjectType)
674  {
676  eFamily = SfxStyleFamily::Para;
677  break;
679  eFamily = SfxStyleFamily::Para;
681  break;
683  eFamily = SfxStyleFamily::Frame;
684  break;
686  eFamily = SfxStyleFamily::Page;
687  break;
689  eFamily = SfxStyleFamily::Pseudo;
690  break;
692  eFamily = SfxStyleFamily::Table;
693  break;
695  eFamily = SfxStyleFamily::Cell;
696  break;
697  default: break;
698  }
699  if(!xRet.is())
700  xRet = SwXStyleFamilies::CreateStyle(eFamily, rDoc);
701  }
702  break;
755  // NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0
756  xRet = SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType);
757  break;
759  xRet = SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType);
760  break;
765  {
767  switch(nObjectType)
768  {
769  case SwServiceType::FieldMasterUser: nResId = SwFieldIds::User; break;
770  case SwServiceType::FieldMasterDDE: nResId = SwFieldIds::Dde; break;
773  default: break;
774  }
775  xRet = SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId);
776  }
777  break;
779  {
781  if(!pType)
782  {
783  SwAuthorityFieldType aType(&rDoc);
784  pType = rDoc.getIDocumentFieldsAccess().InsertFieldType(aType);
785  }
786  xRet = SwXFieldMaster::CreateXFieldMaster(&rDoc, pType);
787  }
788  break;
790  xRet = SwXParagraph::CreateXParagraph(rDoc, nullptr);
791  break;
793  xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
794  break;
797  break;
799  xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
800  break;
803  break;
806  break;
809  break;
811  // #i64497# If a chart is in a temporary document during clipboard
812  // paste, there should be no data provider, so that own data is used
813  // This should not happen during copy/paste, as this will unlink
814  // charts using table data.
815  if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED)
816  xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
817  else
818  SAL_WARN("sw.uno",
819  "not creating chart data provider for embedded object");
820 
821  break;
823  xRet = SwXMeta::CreateXMeta(rDoc, false);
824  break;
826  xRet = SwXMeta::CreateXMeta(rDoc, true);
827  break;
828  default:
829  throw uno::RuntimeException();
830  }
831  return xRet;
832 }
833 
834 //SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
836  SwUnoCollection(pDc)
837 {
838 
839 }
840 
842 {
843 
844 }
845 
847 {
848  SolarMutexGuard aGuard;
849  sal_Int32 nRet = 0;
850  if(IsValid())
851  nRet = static_cast<sal_Int32>(GetDoc()->GetTableFrameFormatCount(true));
852  return nRet;
853 }
854 
855 uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex)
856 {
857  SolarMutexGuard aGuard;
858  uno::Any aRet;
859  if (!IsValid())
860  throw uno::RuntimeException();
861 
862  if (nInputIndex < 0)
863  throw IndexOutOfBoundsException();
864 
865  SwAutoFormatGetDocNode aGetHt( &GetDoc()->GetNodes() );
866  size_t nIndex = static_cast<size_t>(nInputIndex);
867  size_t nCurrentIndex = 0;
868 
869  for (SwFrameFormat* const & pFormat : *GetDoc()->GetTableFrameFormats())
870  {
871  if (!pFormat->GetInfo(aGetHt))
872  {
873  if (nCurrentIndex == nIndex)
874  {
875  uno::Reference<XTextTable> xTable = SwXTextTables::GetObject(*pFormat);
876  aRet <<= xTable;
877  return aRet;
878  }
879  else
880  nCurrentIndex++;
881  }
882  }
883  throw IndexOutOfBoundsException();
884 }
885 
886 uno::Any SwXTextTables::getByName(const OUString& rItemName)
887 {
888  SolarMutexGuard aGuard;
889  uno::Any aRet;
890  if(!IsValid())
891  throw uno::RuntimeException();
892 
893  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
894  uno::Reference< XTextTable > xTable;
895  for( size_t i = 0; i < nCount; ++i)
896  {
897  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
898  if (rItemName == rFormat.GetName())
899  {
900  xTable = SwXTextTables::GetObject(rFormat);
901  aRet <<= xTable;
902  break;
903  }
904  }
905  if(!xTable.is())
906  throw NoSuchElementException();
907 
908  return aRet;
909 }
910 
911 uno::Sequence< OUString > SwXTextTables::getElementNames()
912 {
913  SolarMutexGuard aGuard;
914  if(!IsValid())
915  throw uno::RuntimeException();
916  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
917  uno::Sequence<OUString> aSeq(static_cast<sal_Int32>(nCount));
918  if(nCount)
919  {
920  OUString* pArray = aSeq.getArray();
921  for( size_t i = 0; i < nCount; ++i)
922  {
923  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
924 
925  pArray[i] = rFormat.GetName();
926  }
927  }
928  return aSeq;
929 }
930 
931 sal_Bool SwXTextTables::hasByName(const OUString& rName)
932 {
933  SolarMutexGuard aGuard;
934  bool bRet= false;
935  if(!IsValid())
936  throw uno::RuntimeException();
937 
938  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
939  for( size_t i = 0; i < nCount; ++i)
940  {
941  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
942  if (rName == rFormat.GetName())
943  {
944  bRet = true;
945  break;
946  }
947  }
948  return bRet;
949 }
950 
951 uno::Type SAL_CALL
953 {
955 }
956 
958 {
959  SolarMutexGuard aGuard;
960  if(!IsValid())
961  throw uno::RuntimeException();
962  return 0 != GetDoc()->GetTableFrameFormatCount(true);
963 }
964 
966 {
967  return "SwXTextTables";
968 }
969 
970 sal_Bool SwXTextTables::supportsService(const OUString& rServiceName)
971 {
972  return cppu::supportsService(this, rServiceName);
973 }
974 
975 uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames()
976 {
977  return { "com.sun.star.text.TextTables" };
978 }
979 
980 uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat)
981 {
982  return SwXTextTable::CreateXTextTable(& rFormat);
983 }
984 
985 namespace
986 {
987  template<FlyCntType T> struct UnoFrameWrap_traits {};
988 
989  template<>
990  struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
991  {
992  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
993  {
994  uno::Reference<text::XTextFrame> const xRet(
995  SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat));
996  return uno::makeAny(xRet);
997  }
998  static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); };
999  };
1000 
1001  template<>
1002  struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
1003  {
1004  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1005  {
1006  uno::Reference<text::XTextContent> const xRet(
1007  SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1008  return uno::makeAny(xRet);
1009  }
1010  static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
1011  };
1012 
1013  template<>
1014  struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
1015  {
1016  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1017  {
1018  uno::Reference<text::XTextContent> const xRet(
1019  SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1020  return uno::makeAny(xRet);
1021  }
1022  static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
1023  };
1024 
1025  template<FlyCntType T>
1026  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat)
1027  {
1028  return UnoFrameWrap_traits<T>::wrapFrame(*pFormat);
1029  }
1030 
1031  // runtime adapter for lcl_UnoWrapFrame
1033  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat, FlyCntType eType)
1034  {
1035  switch(eType)
1036  {
1037  case FLYCNTTYPE_FRM:
1038  return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFormat);
1039  case FLYCNTTYPE_GRF:
1040  return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFormat);
1041  case FLYCNTTYPE_OLE:
1042  return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFormat);
1043  default:
1044  throw uno::RuntimeException();
1045  }
1046  }
1047 
1048  template<FlyCntType T>
1049  class SwXFrameEnumeration
1050  : public SwSimpleEnumeration_Base
1051  {
1052  private:
1053  std::vector< Any > m_aFrames;
1054  protected:
1055  virtual ~SwXFrameEnumeration() override {};
1056  public:
1057  SwXFrameEnumeration(const SwDoc& rDoc);
1058 
1059  //XEnumeration
1060  virtual sal_Bool SAL_CALL hasMoreElements() override;
1061  virtual Any SAL_CALL nextElement() override;
1062 
1063  //XServiceInfo
1064  virtual OUString SAL_CALL getImplementationName() override;
1065  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
1066  virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1067  };
1068 }
1069 
1070 template<FlyCntType T>
1071 SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc& rDoc)
1072 {
1073  SolarMutexGuard aGuard;
1074  const SwFrameFormats* const pFormats = rDoc.GetSpzFrameFormats();
1075  if (pFormats->empty())
1076  return;
1077  // #i104937#
1078  const size_t nSize = pFormats->size();
1079  // #i104937#
1080  SwFrameFormat* pFormat( nullptr );
1081  for( size_t i = 0; i < nSize; ++i )
1082  {
1083  // #i104937#
1084  pFormat = (*pFormats)[i];
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 
1096 template<FlyCntType T>
1097 sal_Bool SwXFrameEnumeration<T>::hasMoreElements()
1098 {
1099  SolarMutexGuard aGuard;
1100  return !m_aFrames.empty();
1101 }
1102 
1103 template<FlyCntType T>
1104 Any 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 
1115 template<FlyCntType T>
1116 OUString SwXFrameEnumeration<T>::getImplementationName()
1117 {
1118  return "SwXFrameEnumeration";
1119 }
1120 
1121 template<FlyCntType T>
1122 sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName)
1123 {
1124  return cppu::supportsService(this, ServiceName);
1125 }
1126 
1127 template<FlyCntType T>
1128 Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames()
1129 {
1130  return { OUString("com.sun.star.container.XEnumeration") };
1131 }
1132 
1134 {
1135  return "SwXFrames";
1136 }
1137 
1138 sal_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 
1156 uno::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 
1200 uno::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 
1223 uno::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 
1240 sal_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 
1286 sal_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 
1297  SwXFrames(_pDoc, FLYCNTTYPE_FRM)
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 
1321  SwXFrames(_pDoc, FLYCNTTYPE_GRF)
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 
1345  SwXFrames(_pDoc, FLYCNTTYPE_OLE)
1346 {
1347 }
1348 
1350 {
1351 }
1352 
1354 {
1355  return "SwXTextSections";
1356 }
1357 
1358 sal_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 makeAny(xRet);
1419 }
1420 
1421 uno::Any SwXTextSections::getByName(const OUString& rName)
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 
1447 uno::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 
1479 sal_Bool SwXTextSections::hasByName(const OUString& rName)
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 
1523 uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFormat& rFormat )
1524 {
1525  return SwXTextSection::CreateXTextSection(&rFormat);
1526 }
1527 
1529 {
1530  return "SwXBookmarks";
1531 }
1532 
1533 sal_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  {
1563  IDocumentMarkAccess::GetType(**ppMark))
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  {
1586  IDocumentMarkAccess::GetType(**ppMark))
1587  {
1588  if (count == nIndex)
1589  {
1590  uno::Any aRet;
1591  const uno::Reference< text::XTextContent > xRef =
1592  SwXBookmark::CreateXBookmark(*GetDoc(), *ppMark);
1593  aRet <<= xRef;
1594  return aRet;
1595  }
1596  ++count; // only count real bookmarks
1597  }
1598  }
1599  throw IndexOutOfBoundsException();
1600 }
1601 
1602 uno::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 =
1615  SwXBookmark::CreateXBookmark(*GetDoc(), *ppBkmk);
1616  aRet <<= xRef;
1617  return aRet;
1618 }
1619 
1620 uno::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  {
1633  IDocumentMarkAccess::GetType(**ppMark))
1634  {
1635  ret.push_back((*ppMark)->GetName()); // only add real bookmarks
1636  }
1637  }
1638  return comphelper::containerToSequence(ret);
1639 }
1640 
1641 sal_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  {
1668  IDocumentMarkAccess::GetType(**ppMark))
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 
1731 sal_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 
1816 Reference<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 
1826 sal_Bool SwXReferenceMarks::supportsService(const OUString& rServiceName)
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 
1894 uno::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: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS
Definition: unocoll.hxx:227
static css::uno::Reference< css::rdf::XMetadatable > 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 >())
SwDoc * GetDoc() const
Definition: unocoll.hxx:59
SwXTextEmbeddedObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1344
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:241
#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME
Definition: unocoll.hxx:224
#define CSS_TEXT_TEXTFIELD_EXTENDED_USER
Definition: unocoll.hxx:201
TOXTypes
Definition: toxe.hxx:39
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:957
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1826
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1718
static css::uno::Reference< css::text::XTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
Definition: unotbl.cxx:1998
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1281
sal_Int32 nIndex
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:975
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1693
#define CSS_TEXT_FIELDMASTER_DDE
Definition: unocoll.hxx:238
bool m_bObjectValid
Definition: unocoll.hxx:47
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:931
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1339
bool IsGrfNode() const
Definition: node.hxx:658
#define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT
Definition: unocoll.hxx:215
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1045
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1831
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:970
#define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT
Definition: unocoll.hxx:194
#define CSS_TEXT_TEXTFIELD_CHAPTER
Definition: unocoll.hxx:192
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT
Definition: unocoll.hxx:218
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:811
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1305
#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME
Definition: unocoll.hxx:220
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual sal_Int32 getBookmarksCount() const =0
returns the number of IBookmarks.
virtual ~SwXNumberingRulesCollection() override
Definition: unocoll.cxx:1681
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1286
static css::uno::Reference< css::text::XTextContent > 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 SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:478
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1821
Reference< XInterface > SvUnoImageMapRectangleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
sal_Int64 n
Provides access to the marks of a document.
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: doc.hxx:188
Reference< XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:813
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1421
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
#define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION
Definition: unocoll.hxx:230
#define CSS_TEXT_TEXTFIELD_TABLE_COUNT
Definition: unocoll.hxx:216
virtual ~SwXBookmarks() override
Definition: unocoll.cxx:1547
#define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY
Definition: unocoll.hxx:241
#define CSS_TEXT_TEXTFIELD_WORD_COUNT
Definition: unocoll.hxx:214
#define CSS_TEXT_TEXTFIELD_TABLE_FORMULA
Definition: unocoll.hxx:211
std::unordered_map< OUString, OUString > StringHashMap
bool IsEndNote() const
Definition: fmtftn.hxx:71
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
static css::uno::Reference< css::text::XTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1219
virtual ~SwXFootnotes() override
Definition: unocoll.cxx:1747
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1479
css::uno::Reference< css::uno::XInterface > SvxXTextColumns_createInstance() noexcept
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1138
bool empty() const
Definition: docary.hxx:86
For old documents the Field-Which IDs must be preserved !!!
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1505
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
#define CSS_TEXT_TEXTFIELD_INPUT_USER
Definition: unocoll.hxx:235
#define CSS_TEXT_FIELDMASTER_SET_EXPRESSION
Definition: unocoll.hxx:239
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:886
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
static css::uno::Reference< css::text::XTextSection > CreateXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader=false)
Definition: unosect.cxx:196
virtual ~SwXTextFrames() override
Definition: unocoll.cxx:1301
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1853
Array of Undo-history.
Definition: docary.hxx:192
#define CSS_TEXT_TEXTFIELD_DATABASE_NAME
Definition: unocoll.hxx:210
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
#define CSS_TEXT_TEXTFIELD_DATE_TIME
Definition: unocoll.hxx:185
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:965
#define SAL_MAX_UINT16
bool IsValid() const
Definition: unocoll.hxx:57
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:911
const OUString & GetName() const
Definition: format.hxx:115
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1685
int nCount
#define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET
Definition: unocoll.hxx:206
#define CSS_TEXT_TEXTFIELD_USER
Definition: unocoll.hxx:186
#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME
Definition: unocoll.hxx:226
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1358
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1186
static css::uno::Reference< css::text::XTextContent > CreateXFieldmark(SwDoc &rDoc,::sw::mark::IMark *pMark, bool isReplacementObject=false)
Definition: unobkm.cxx:683
css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs(SfxObjectShell const *pShell, const char *_pAsciiName, const css::uno::Sequence< css::uno::Any > &aArgs)
#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR
Definition: unocoll.hxx:225
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
bool empty() const
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:154
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1894
SfxStyleFamily
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:115
SfxObjectCreateMode GetCreateMode() const
size_type size() const
#define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM
Definition: unocoll.hxx:231
virtual ~SwXFrames() override
Definition: unocoll.cxx:1153
Specific frame formats (frames, DrawObjects).
bool IsOLENode() const
Definition: node.hxx:654
#define CSS_TEXT_TEXTFIELD_FILE_NAME
Definition: unocoll.hxx:189
#define SAL_N_ELEMENTS(arr)
DocumentType eType
#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET
Definition: unocoll.hxx:202
static OUString GetProviderName(SwServiceType nObjectType)
Definition: unocoll.cxx:472
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1334
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:952
static css::uno::Reference< css::text::XTextContent > CreateXBookmark(SwDoc &rDoc,::sw::mark::IMark *pBookmark)
Definition: unobkm.cxx:160
#define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION
Definition: unocoll.hxx:222
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1602
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unocoll.cxx:1156
sal_uInt16 char * pName
virtual ~SwXTextTables() override
Definition: unocoll.cxx:841
const SwFlyFrameFormat * FindFlyByName(const OUString &rName, SwNodeType nNdTyp=SwNodeType::NONE) const
Definition: doclay.cxx:1394
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1538
#define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT
Definition: unocoll.hxx:213
Style of a layout element.
Definition: frmfmt.hxx:59
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1641
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1875
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1656
#define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS
Definition: unocoll.hxx:233
int i
const OUString & GetSectionName() const
Definition: section.hxx:168
#define CSS_TEXT_TEXTFIELD_DROP_DOWN
Definition: unocoll.hxx:234
FlyCntType
Definition: flyenum.hxx:23
virtual ~SwXReferenceMarks() override
Definition: unocoll.cxx:1841
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1713
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1620
#define CSS_TEXT_TEXTFIELD_DDE
Definition: unocoll.hxx:198
SwFieldIds
Definition: fldbas.hxx:45
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1919
size_t size() const
Definition: docary.hxx:88
unsigned char sal_Bool
static css::uno::Reference< css::text::XDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1614
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1726
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1329
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1089
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:401
bool IsNoTextNode() const
Definition: node.hxx:650
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1911
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1736
size
#define CSS_TEXT_TEXTFIELD_JUMP_EDIT
Definition: unocoll.hxx:204
virtual const_iterator_t findBookmark(const OUString &rMark) const =0
Finds a bookmark by name.
Marks a node in the document model.
Definition: ndindex.hxx:32
css::uno::Type const & get()
SwXNumberingRulesCollection(SwDoc *pDoc)
Definition: unocoll.cxx:1676
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:980
#define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER
Definition: unocoll.hxx:208
bool empty() const
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1133
static css::uno::Reference< css::text::XTextContent > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:129
#define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET
Definition: unocoll.hxx:207
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
Definition: doc.cxx:227
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1845
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1392
css::uno::Any SetGlobalUNOConstant(const OUString &rName, const css::uno::Any &_rValue)
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
virtual ~SwXTextSections() override
Definition: unocoll.cxx:1373
#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET
Definition: unocoll.hxx:203
static css::uno::Reference< css::style::XStyle > CreateStyle(SfxStyleFamily eFamily, SwDoc &rDoc)
Definition: unostyle.cxx:804
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1651
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1571
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1272
#define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME
Definition: unocoll.hxx:221
SwXTextGraphicObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1320
#define CSS_TEXT_TEXTFIELD_GET_REFERENCE
Definition: unocoll.hxx:193
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1447
SwXBookmarks(SwDoc *pDoc)
Definition: unocoll.cxx:1543
#define CSS_TEXT_TEXTFIELD_GET_EXPRESSION
Definition: unocoll.hxx:188
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1363
const FlyCntType m_eType
Definition: unocoll.hxx:301
#define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH
Definition: unocoll.hxx:199
SwXFrames(SwDoc *pDoc, FlyCntType eSet)
Definition: unocoll.cxx:1148
#define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY
Definition: unocoll.hxx:232
const SwNodes & GetNodes() const
Definition: ndindex.hxx:158
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1510
#define CSS_TEXT_TEXTFIELD_INPUT
Definition: unocoll.hxx:196
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1310
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1066
bool GetGlobalUNOConstant(const OUString &rName, css::uno::Any &aOut)
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1808
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
const css::uno::Reference< css::container::XNameContainer > & GetVBATemplateToProjectCache() const
Definition: doc.hxx:1623
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1528
#define SAL_INFO(area, stream)
const OUString & GetName() const
#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR
Definition: unocoll.hxx:219
static SwServiceType GetProviderType(const OUString &rServiceName)
Definition: unocoll.cxx:502
#define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT
Definition: unocoll.hxx:217
SwNodes & GetNodes()
Definition: doc.hxx:409
virtual void Invalidate()
Definition: unocoll.cxx:1932
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1177
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:68
SwDoc * m_pDoc
Definition: unocoll.hxx:46
#define CSS_TEXT_TEXTFIELD_AUTHOR
Definition: unocoll.hxx:191
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3196
#define CSS_TEXT_TEXTFIELD_SCRIPT
Definition: unocoll.hxx:205
#define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE
Definition: unocoll.hxx:229
QPRO_FUNC_TYPE nType
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1200
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
Definition: unocoll.cxx:513
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1803
Sequence< sal_Int8 > aSeq
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1223
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:771
#define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT
Definition: unocoll.hxx:236
#define CSS_TEXT_TEXTFIELD_SET_EXPRESSION
Definition: unocoll.hxx:187
static css::uno::Sequence< OUString > GetAllServiceNames()
Definition: unocoll.cxx:482
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1240
virtual ~SwXTextEmbeddedObjects() override
Definition: unocoll.cxx:1349
static css::uno::Reference< css::text::XFootnote > CreateXFootnote(SwDoc &rDoc, SwFormatFootnote *pFootnoteFormat, bool isEndnote=false)
Definition: unoftn.cxx:144
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:788
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1731
virtual ~SwXTextGraphicObjects() override
Definition: unocoll.cxx:1325
bool isAlienWordDoc(SfxObjectShell const &rDocShell)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1143
#define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT
Definition: unocoll.hxx:228
#define CSS_TEXT_TEXTFIELD_PAGE_COUNT
Definition: unocoll.hxx:212
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:634
SwXTextFrames(SwDoc *pDoc)
Definition: unocoll.cxx:1296
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1377
#define SAL_WARN(area, stream)
#define CSS_TEXT_TEXTFIELD_ANNOTATION
Definition: unocoll.hxx:195
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2327
size_t size() const
#define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME
Definition: unocoll.hxx:200
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1533
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3485
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1315
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3438
const EnumerationType m_eType
const bool m_bEndnote
Definition: unocoll.hxx:454
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1523
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1924
SwSection * GetSection() const
Definition: section.cxx:669
const ProvNamesId_Type aProvNamesId[]
Definition: unocoll.cxx:281
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:855
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1353
SwXTextSections(SwDoc *pDoc)
Definition: unocoll.cxx:1368
SwXFootnotes(bool bEnd, SwDoc *pDoc)
Definition: unocoll.cxx:1741
Reference< XInterface > SvUnoImageMapPolygonObject_createInstance(const SvEventDescription *pSupportedMacroItems)
#define CSS_TEXT_TEXTFIELD_MACRO
Definition: unocoll.hxx:197
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1256
SwSectionFormats & GetSections()
Definition: doc.hxx:1338
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1770
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1550
#define CSS_TEXT_FIELDMASTER_DATABASE
Definition: unocoll.hxx:240
const SvEventDescription * sw_GetSupportedMacroItems()
Definition: unocoll.cxx:460
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1291
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:846
SwXReferenceMarks(SwDoc *pDoc)
Definition: unocoll.cxx:1836
#define CSS_TEXT_TEXTFIELD_DATABASE
Definition: unocoll.hxx:209
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
BasicManager * GetBasicManager() const
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
SwXTextTables(SwDoc *pDoc)
Definition: unocoll.cxx:835
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1751
static css::uno::Reference< css::text::XFootnote > GetObject(SwDoc &rDoc, const SwFormatFootnote &rFormat)
Definition: unocoll.cxx:1816
#define CSS_TEXT_FIELDMASTER_USER
Definition: unocoll.hxx:237
void SetVBATemplateToProjectCache(css::uno::Reference< css::container::XNameContainer > const &xCache)
Definition: doc.hxx:1622
static css::uno::Reference< css::beans::XPropertySet > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:538
#define CSS_TEXT_TEXTFIELD_PAGE_NUMBER
Definition: unocoll.hxx:190
bool IsInNodesArr() const
Definition: section.cxx:911
#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR
Definition: unocoll.hxx:223
Base class of the Writer document model elements.
Definition: node.hxx:81
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)