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 <unotbl.hxx>
39 #include <unostyle.hxx>
40 #include <unofield.hxx>
41 #include <unoidx.hxx>
42 #include <unoframe.hxx>
43 #include <textboxhelper.hxx>
44 #include <unofootnote.hxx>
45 #include <vcl/svapp.hxx>
46 #include <fmtcntnt.hxx>
47 #include <authfld.hxx>
48 #include <SwXTextDefaults.hxx>
49 #include <unochart.hxx>
50 #include <comphelper/sequence.hxx>
52 #include <unosection.hxx>
53 #include <unoparagraph.hxx>
54 #include <unobookmark.hxx>
55 #include <unorefmark.hxx>
56 #include <unometa.hxx>
57 #include <docsh.hxx>
58 #include <hints.hxx>
59 #include <frameformats.hxx>
60 #include <com/sun/star/document/XCodeNameQuery.hpp>
61 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
62 #include <com/sun/star/form/XFormsSupplier.hpp>
63 #include <com/sun/star/script/ModuleInfo.hpp>
64 #include <com/sun/star/script/ModuleType.hpp>
65 #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
66 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
68 #include <basic/basmgr.hxx>
70 #include <cppuhelper/implbase.hxx>
71 #include <sfx2/event.hxx>
72 #include <sal/log.hxx>
73 
74 using namespace ::com::sun::star;
75 using namespace ::com::sun::star::document;
76 using namespace ::com::sun::star::uno;
77 using namespace ::com::sun::star::text;
78 using namespace ::com::sun::star::container;
79 using namespace ::com::sun::star::lang;
80 
81 #if HAVE_FEATURE_SCRIPTING
82 
83 namespace {
84 
85 class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery >
86 {
87  SwDocShell* mpDocShell;
88  OUString msThisDocumentCodeName;
89 public:
90  explicit SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
91  // XCodeNameQuery
92 
93  OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) override
94  {
95  // #FIXME not implemented...
96  return OUString();
97  }
98 
99  OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) override
100  {
101  // Initialise the code name
102  if ( msThisDocumentCodeName.isEmpty() )
103  {
104  try
105  {
106  uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
107  uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
108  OUString sProjectName( "Standard");
109  if ( !mpDocShell->GetBasicManager()->GetName().isEmpty() )
110  {
111  sProjectName = mpDocShell->GetBasicManager()->GetName();
112  }
113  uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
114  uno::Sequence< OUString > sModuleNames = xLib->getElementNames();
115  uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
116 
117  auto pModuleName = std::find_if(sModuleNames.begin(), sModuleNames.end(), [&xVBAModuleInfo](const OUString& rName) {
118  return xVBAModuleInfo->hasModuleInfo(rName)
119  && xVBAModuleInfo->getModuleInfo(rName).ModuleType == script::ModuleType::DOCUMENT; });
120  if (pModuleName != sModuleNames.end())
121  msThisDocumentCodeName = *pModuleName;
122  }
123  catch( uno::Exception& )
124  {
125  }
126  }
127  OUString sCodeName;
128  if ( mpDocShell )
129  {
130  // need to find the page ( and index ) for this control
131  uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
132  uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
133 
134  try
135  {
136  uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
137  uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
138  // get the www-standard container
139  uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
140  sal_Int32 nCntrls = xFormControls->getCount();
141  for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
142  {
143  uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
144  bool bMatched = ( xControl == xIf );
145  if ( bMatched )
146  {
147  sCodeName = msThisDocumentCodeName;
148  break;
149  }
150  }
151  }
152  catch( uno::Exception& )
153  {
154  }
155  }
156  // #TODO Probably should throw here ( if !bMatched )
157  return sCodeName;
158  }
159 };
160 
161 }
162 
163 typedef std::unordered_map< OUString, OUString > StringHashMap;
164 
165 namespace {
166 
167 class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer >
168 {
169  StringHashMap mTemplateToProject;
170 public:
171  SwVbaProjectNameProvider()
172  {
173  }
174  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
175  {
176  return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
177  }
178  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
179  {
180  if ( !hasByName( aName ) )
181  throw container::NoSuchElementException();
182  return uno::makeAny( mTemplateToProject.find( aName )->second );
183  }
184  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
185  {
186  return comphelper::mapKeysToSequence( mTemplateToProject );
187  }
188 
189  virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) override
190  {
191 
192  OUString sProjectName;
193  aElement >>= sProjectName;
194  SAL_INFO("sw.uno", "Template cache inserting template name " << aName
195  << " with project " << sProjectName);
196  mTemplateToProject[ aName ] = sProjectName;
197  }
198 
199  virtual void SAL_CALL removeByName( const OUString& Name ) override
200  {
201  if ( !hasByName( Name ) )
202  throw container::NoSuchElementException();
203  mTemplateToProject.erase( Name );
204  }
205  virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) override
206  {
207  if ( !hasByName( aName ) )
208  throw container::NoSuchElementException();
209  insertByName( aName, aElement ); // insert will overwrite
210  }
211  // XElemenAccess
212  virtual css::uno::Type SAL_CALL getElementType( ) override
213  {
215  }
216  virtual sal_Bool SAL_CALL hasElements( ) override
217  {
218 
219  return ( !mTemplateToProject.empty() );
220  }
221 
222 };
223 
224 class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess >
225 {
226  SwDocShell* mpDocShell;
227 public:
228  explicit SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
229  {
230  // #FIXME #TODO is the code name for ThisDocument read anywhere?
231  }
232 
233  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
234  {
235  // #FIXME #TODO we really need to be checking against the codename for
236  // ThisDocument
237  if ( aName == "ThisDocument" )
238  return true;
239  return false;
240  }
241 
242  css::uno::Any SAL_CALL getByName( const OUString& aName ) override
243  {
244  if ( !hasByName( aName ) )
245  throw container::NoSuchElementException();
246  uno::Sequence< uno::Any > aArgs( 2 );
247  aArgs[0] <<= uno::Reference< uno::XInterface >();
248  aArgs[1] <<= mpDocShell->GetModel();
249  uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
250  SAL_INFO("sw.uno",
251  "Creating Object ( ooo.vba.word.Document ) 0x" << xDocObj.get());
252  return uno::makeAny( xDocObj );
253  }
254  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
255  {
256  uno::Sequence< OUString > aNames;
257  return aNames;
258  }
259  // XElemenAccess
260  virtual css::uno::Type SAL_CALL getElementType( ) override { return uno::Type(); }
261  virtual sal_Bool SAL_CALL hasElements( ) override { return true; }
262 
263 };
264 
265 }
266 
267 #endif
268 
269 namespace {
270 
271 struct ProvNamesId_Type
272 {
273  const char * pName;
275 };
276 
277 }
278 
279 // note: this thing is indexed as an array, so do not insert/remove entries!
280 const ProvNamesId_Type aProvNamesId[] =
281 {
282  { "com.sun.star.text.TextTable", SwServiceType::TypeTextTable },
283  { "com.sun.star.text.TextFrame", SwServiceType::TypeTextFrame },
284  { "com.sun.star.text.GraphicObject", SwServiceType::TypeGraphic },
285  { "com.sun.star.text.TextEmbeddedObject", SwServiceType::TypeOLE },
286  { "com.sun.star.text.Bookmark", SwServiceType::TypeBookmark },
287  { "com.sun.star.text.Footnote", SwServiceType::TypeFootnote },
288  { "com.sun.star.text.Endnote", SwServiceType::TypeEndnote },
289  { "com.sun.star.text.DocumentIndexMark", SwServiceType::TypeIndexMark },
290  { "com.sun.star.text.DocumentIndex", SwServiceType::TypeIndex },
291  { "com.sun.star.text.ReferenceMark", SwServiceType::ReferenceMark },
292  { "com.sun.star.style.CharacterStyle", SwServiceType::StyleCharacter },
293  { "com.sun.star.style.ParagraphStyle", SwServiceType::StyleParagraph },
294  { "com.sun.star.style.FrameStyle", SwServiceType::StyleFrame },
295  { "com.sun.star.style.PageStyle", SwServiceType::StylePage },
296  { "com.sun.star.style.NumberingStyle", SwServiceType::StyleNumbering },
297  { "com.sun.star.text.ContentIndexMark", SwServiceType::ContentIndexMark },
298  { "com.sun.star.text.ContentIndex", SwServiceType::ContentIndex },
299  { "com.sun.star.text.UserIndexMark", SwServiceType::UserIndexMark },
300  { "com.sun.star.text.UserIndex", SwServiceType::UserIndex },
301  { "com.sun.star.text.TextSection", SwServiceType::TextSection },
302  { "com.sun.star.text.TextField.DateTime", SwServiceType::FieldTypeDateTime },
303  { "com.sun.star.text.TextField.User", SwServiceType::FieldTypeUser },
304  { "com.sun.star.text.TextField.SetExpression", SwServiceType::FieldTypeSetExp },
305  { "com.sun.star.text.TextField.GetExpression", SwServiceType::FieldTypeGetExp },
306  { "com.sun.star.text.TextField.FileName", SwServiceType::FieldTypeFileName },
307  { "com.sun.star.text.TextField.PageNumber", SwServiceType::FieldTypePageNum },
308  { "com.sun.star.text.TextField.Author", SwServiceType::FieldTypeAuthor },
309  { "com.sun.star.text.TextField.Chapter", SwServiceType::FieldTypeChapter },
311  { "com.sun.star.text.TextField.GetReference", SwServiceType::FieldTypeGetReference },
312  { "com.sun.star.text.TextField.ConditionalText", SwServiceType::FieldTypeConditionedText },
313  { "com.sun.star.text.TextField.Annotation", SwServiceType::FieldTypeAnnotation },
314  { "com.sun.star.text.TextField.Input", SwServiceType::FieldTypeInput },
315  { "com.sun.star.text.TextField.Macro", SwServiceType::FieldTypeMacro },
316  { "com.sun.star.text.TextField.DDE", SwServiceType::FieldTypeDDE },
317  { "com.sun.star.text.TextField.HiddenParagraph", SwServiceType::FieldTypeHiddenPara },
318  { "" /*com.sun.star.text.TextField.DocumentInfo"*/, SwServiceType::FieldTypeDocInfo },
319  { "com.sun.star.text.TextField.TemplateName", SwServiceType::FieldTypeTemplateName },
320  { "com.sun.star.text.TextField.ExtendedUser", SwServiceType::FieldTypeUserExt },
321  { "com.sun.star.text.TextField.ReferencePageSet", SwServiceType::FieldTypeRefPageSet },
322  { "com.sun.star.text.TextField.ReferencePageGet", SwServiceType::FieldTypeRefPageGet },
323  { "com.sun.star.text.TextField.JumpEdit", SwServiceType::FieldTypeJumpEdit },
324  { "com.sun.star.text.TextField.Script", SwServiceType::FieldTypeScript },
325  { "com.sun.star.text.TextField.DatabaseNextSet", SwServiceType::FieldTypeDatabaseNextSet },
326  { "com.sun.star.text.TextField.DatabaseNumberOfSet", SwServiceType::FieldTypeDatabaseNumSet },
327  { "com.sun.star.text.TextField.DatabaseSetNumber", SwServiceType::FieldTypeDatabaseSetNum },
328  { "com.sun.star.text.TextField.Database", SwServiceType::FieldTypeDatabase },
329  { "com.sun.star.text.TextField.DatabaseName", SwServiceType::FieldTypeDatabaseName },
330  { "com.sun.star.text.TextField.TableFormula", SwServiceType::FieldTypeTableFormula },
331  { "com.sun.star.text.TextField.PageCount", SwServiceType::FieldTypePageCount },
332  { "com.sun.star.text.TextField.ParagraphCount", SwServiceType::FieldTypeParagraphCount },
333  { "com.sun.star.text.TextField.WordCount", SwServiceType::FieldTypeWordCount },
334  { "com.sun.star.text.TextField.CharacterCount", SwServiceType::FieldTypeCharacterCount },
335  { "com.sun.star.text.TextField.TableCount", SwServiceType::FieldTypeTableCount },
336  { "com.sun.star.text.TextField.GraphicObjectCount", SwServiceType::FieldTypeGraphicObjectCount },
337  { "com.sun.star.text.TextField.EmbeddedObjectCount", SwServiceType::FieldTypeEmbeddedObjectCount },
338  { "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SwServiceType::FieldTypeDocInfoChangeAuthor },
339  { "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SwServiceType::FieldTypeDocInfoChangeDateTime },
340  { "com.sun.star.text.TextField.DocInfo.EditTime", SwServiceType::FieldTypeDocInfoEditTime },
341  { "com.sun.star.text.TextField.DocInfo.Description", SwServiceType::FieldTypeDocInfoDescription },
342  { "com.sun.star.text.TextField.DocInfo.CreateAuthor", SwServiceType::FieldTypeDocInfoCreateAuthor },
343  { "com.sun.star.text.TextField.DocInfo.CreateDateTime", SwServiceType::FieldTypeDocInfoCreateDateTime },
348  { "com.sun.star.text.TextField.DocInfo.Custom", SwServiceType::FieldTypeDocInfoCustom },
349  { "com.sun.star.text.TextField.DocInfo.PrintAuthor", SwServiceType::FieldTypeDocInfoPrintAuthor },
350  { "com.sun.star.text.TextField.DocInfo.PrintDateTime", SwServiceType::FieldTypeDocInfoPrintDateTime },
351  { "com.sun.star.text.TextField.DocInfo.KeyWords", SwServiceType::FieldTypeDocInfoKeywords },
352  { "com.sun.star.text.TextField.DocInfo.Subject", SwServiceType::FieldTypeDocInfoSubject },
353  { "com.sun.star.text.TextField.DocInfo.Title", SwServiceType::FieldTypeDocInfoTitle },
354  { "com.sun.star.text.TextField.DocInfo.Revision", SwServiceType::FieldTypeDocInfoRevision },
355  { "com.sun.star.text.TextField.Bibliography", SwServiceType::FieldTypeBibliography },
356  { "com.sun.star.text.TextField.CombinedCharacters", SwServiceType::FieldTypeCombinedCharacters },
357  { "com.sun.star.text.TextField.DropDown", SwServiceType::FieldTypeDropdown },
358  { "com.sun.star.text.textfield.MetadataField", SwServiceType::FieldTypeMetafield },
363  { "com.sun.star.text.FieldMaster.User", SwServiceType::FieldMasterUser },
364  { "com.sun.star.text.FieldMaster.DDE", SwServiceType::FieldMasterDDE },
365  { "com.sun.star.text.FieldMaster.SetExpression", SwServiceType::FieldMasterSetExp },
366  { "com.sun.star.text.FieldMaster.Database", SwServiceType::FieldMasterDatabase },
367  { "com.sun.star.text.FieldMaster.Bibliography", SwServiceType::FieldMasterBibliography },
372  { "com.sun.star.text.IllustrationsIndex", SwServiceType::IndexIllustrations },
373  { "com.sun.star.text.ObjectIndex", SwServiceType::IndexObjects },
374  { "com.sun.star.text.TableIndex", SwServiceType::IndexTables },
375  { "com.sun.star.text.Bibliography", SwServiceType::IndexBibliography },
376  { "com.sun.star.text.Paragraph", SwServiceType::Paragraph },
377  { "com.sun.star.text.TextField.InputUser", SwServiceType::FieldTypeInputUser },
378  { "com.sun.star.text.TextField.HiddenText", SwServiceType::FieldTypeHiddenText },
379  { "com.sun.star.style.ConditionalParagraphStyle", SwServiceType::StyleConditionalParagraph },
380  { "com.sun.star.text.NumberingRules", SwServiceType::NumberingRules },
381  { "com.sun.star.text.TextColumns", SwServiceType::TextColumns },
382  { "com.sun.star.text.IndexHeaderSection", SwServiceType::IndexHeaderSection },
383  { "com.sun.star.text.Defaults", SwServiceType::Defaults },
384  { "com.sun.star.image.ImageMapRectangleObject", SwServiceType::IMapRectangle },
385  { "com.sun.star.image.ImageMapCircleObject", SwServiceType::IMapCircle },
386  { "com.sun.star.image.ImageMapPolygonObject", SwServiceType::IMapPolygon },
387  { "com.sun.star.text.TextGraphicObject", SwServiceType::TypeTextGraphic },
388  { "com.sun.star.chart2.data.DataProvider", SwServiceType::Chart2DataProvider },
389  { "com.sun.star.text.Fieldmark", SwServiceType::TypeFieldMark },
390  { "com.sun.star.text.FormFieldmark", SwServiceType::TypeFormFieldMark },
391  { "com.sun.star.text.InContentMetadata", SwServiceType::TypeMeta },
392  { "ooo.vba.VBAObjectModuleObjectProvider", SwServiceType::VbaObjectProvider },
393  { "ooo.vba.VBACodeNameProvider", SwServiceType::VbaCodeNameProvider },
394  { "ooo.vba.VBAProjectNameProvider", SwServiceType::VbaProjectNameProvider },
395  { "ooo.vba.VBAGlobals", SwServiceType::VbaGlobals },
396 
397  // case-correct versions of the service names (see #i67811)
455  { "com.sun.star.style.TableStyle", SwServiceType::StyleTable },
456  { "com.sun.star.style.CellStyle", SwServiceType::StyleCell }
457 };
458 
460 {
461  static const SvEventDescription aMacroDescriptionsImpl[] =
462  {
463  { SvMacroItemId::OnMouseOver, "OnMouseOver" },
464  { SvMacroItemId::OnMouseOut, "OnMouseOut" },
465  { SvMacroItemId::NONE, nullptr }
466  };
467 
468  return aMacroDescriptionsImpl;
469 }
470 
472 {
473  SolarMutexGuard aGuard;
474  OUString sRet;
475  const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
476  if(static_cast<sal_uInt16>(nObjectType) < nEntries)
477  sRet = OUString::createFromAscii(aProvNamesId[static_cast<sal_uInt16>(nObjectType)].pName);
478  return sRet;
479 }
480 
481 uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
482 {
483  const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
484  uno::Sequence<OUString> aRet(nEntries);
485  OUString* pArray = aRet.getArray();
486  sal_uInt16 n = 0;
487  for(const ProvNamesId_Type & i : aProvNamesId)
488  {
489  OUString sProv(OUString::createFromAscii(i.pName));
490  if(!sProv.isEmpty())
491  {
492  pArray[n] = sProv;
493  n++;
494  }
495  }
496  aRet.realloc(n);
497  return aRet;
498 
499 }
500 
502 {
503  for(const ProvNamesId_Type & i : aProvNamesId)
504  {
505  if (rServiceName.equalsAscii(i.pName))
506  return i.nType;
507  }
508  return SwServiceType::Invalid;
509 }
510 
511 uno::Reference<uno::XInterface>
513 {
514  SolarMutexGuard aGuard;
515  uno::Reference< uno::XInterface > xRet;
516  switch(nObjectType)
517  {
519  {
520  xRet = SwXTextTable::CreateXTextTable(nullptr);
521  }
522  break;
524  {
525  xRet = SwXTextFrame::CreateXTextFrame(rDoc, nullptr);
526  }
527  break;
529  case SwServiceType::TypeTextGraphic /* #i47503# */ :
530  {
532 
533  }
534  break;
536  {
538  }
539  break;
541  {
542  xRet = SwXBookmark::CreateXBookmark(rDoc, nullptr);
543  }
544  break;
546  {
547  xRet = SwXFieldmark::CreateXFieldmark(rDoc, nullptr);
548  }
549  break;
551  {
552  xRet = SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true);
553  }
554  break;
556 #if HAVE_FEATURE_SCRIPTING
557  {
558  xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
559  }
560 #endif
561  break;
563 #if HAVE_FEATURE_SCRIPTING
564  {
565  if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
566  {
567  xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
568  }
569  }
570 #endif
571  break;
573 #if HAVE_FEATURE_SCRIPTING
574  {
575  uno::Reference< container::XNameContainer > xProjProv = rDoc.GetVBATemplateToProjectCache();
576  if (!xProjProv.is() && rDoc.GetDocShell()
578  {
579  xProjProv = new SwVbaProjectNameProvider;
580  rDoc.SetVBATemplateToProjectCache(xProjProv);
581  }
582  xRet = xProjProv;
583  }
584 #endif
585  break;
587 #if HAVE_FEATURE_SCRIPTING
588  {
589  uno::Any aGlobs;
590  BasicManager *pBasicMan = rDoc.GetDocShell()->GetBasicManager();
591  if (pBasicMan && !pBasicMan->GetGlobalUNOConstant("VBAGlobals", aGlobs))
592  {
593  uno::Sequence< uno::Any > aArgs(1);
594  aArgs[ 0 ] <<= rDoc.GetDocShell()->GetModel();
595  aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
596  pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
597  }
598  aGlobs >>= xRet;
599  }
600 #endif
601  break;
602 
604  xRet = SwXFootnote::CreateXFootnote(rDoc, nullptr);
605  break;
607  xRet = SwXFootnote::CreateXFootnote(rDoc, nullptr, true);
608  break;
612  {
614  if(SwServiceType::ContentIndexMark== nObjectType)
615  eType = TOX_CONTENT;
616  else if(SwServiceType::UserIndexMark == nObjectType)
617  eType = TOX_USER;
618  xRet = SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType);
619  }
620  break;
628  {
630  if(SwServiceType::ContentIndex == nObjectType)
631  eType = TOX_CONTENT;
632  else if(SwServiceType::UserIndex == nObjectType)
633  eType = TOX_USER;
634  else if(SwServiceType::IndexIllustrations == nObjectType)
635  {
636  eType = TOX_ILLUSTRATIONS;
637  }
638  else if(SwServiceType::IndexObjects == nObjectType)
639  {
640  eType = TOX_OBJECTS;
641  }
642  else if(SwServiceType::IndexBibliography == nObjectType)
643  {
644  eType = TOX_AUTHORITIES;
645  }
646  else if(SwServiceType::IndexTables == nObjectType)
647  {
648  eType = TOX_TABLES;
649  }
650  xRet = SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType);
651  }
652  break;
655  xRet = SwXTextSection::CreateXTextSection(nullptr,
656  (SwServiceType::IndexHeaderSection == nObjectType));
657 
658  break;
660  xRet = SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr);
661  break;
670  {
671  SfxStyleFamily eFamily = SfxStyleFamily::Char;
672  switch(nObjectType)
673  {
675  eFamily = SfxStyleFamily::Para;
676  break;
678  eFamily = SfxStyleFamily::Para;
680  break;
682  eFamily = SfxStyleFamily::Frame;
683  break;
685  eFamily = SfxStyleFamily::Page;
686  break;
688  eFamily = SfxStyleFamily::Pseudo;
689  break;
691  eFamily = SfxStyleFamily::Table;
692  break;
694  eFamily = SfxStyleFamily::Cell;
695  break;
696  default: break;
697  }
698  if(!xRet.is())
699  xRet = SwXStyleFamilies::CreateStyle(eFamily, rDoc);
700  }
701  break;
754  // NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0
755  xRet = SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType);
756  break;
758  xRet = SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType);
759  break;
764  {
766  switch(nObjectType)
767  {
768  case SwServiceType::FieldMasterUser: nResId = SwFieldIds::User; break;
769  case SwServiceType::FieldMasterDDE: nResId = SwFieldIds::Dde; break;
772  default: break;
773  }
774  xRet = SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId);
775  }
776  break;
778  {
780  if(!pType)
781  {
782  SwAuthorityFieldType aType(&rDoc);
783  pType = rDoc.getIDocumentFieldsAccess().InsertFieldType(aType);
784  }
785  xRet = SwXFieldMaster::CreateXFieldMaster(&rDoc, pType);
786  }
787  break;
789  xRet = SwXParagraph::CreateXParagraph(rDoc, nullptr);
790  break;
792  xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
793  break;
795  xRet = static_cast<cppu::OWeakObject*>(new SwXTextColumns);
796  break;
798  xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
799  break;
802  break;
805  break;
808  break;
810  // #i64497# If a chart is in a temporary document during clipboard
811  // paste, there should be no data provider, so that own data is used
812  // This should not happen during copy/paste, as this will unlink
813  // charts using table data.
814  if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED)
815  xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
816  else
817  SAL_WARN("sw.uno",
818  "not creating chart data provider for embedded object");
819 
820  break;
822  xRet = SwXMeta::CreateXMeta(rDoc, false);
823  break;
825  xRet = SwXMeta::CreateXMeta(rDoc, true);
826  break;
827  default:
828  throw uno::RuntimeException();
829  }
830  return xRet;
831 }
832 
833 //SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
835  SwUnoCollection(pDc)
836 {
837 
838 }
839 
841 {
842 
843 }
844 
846 {
847  SolarMutexGuard aGuard;
848  sal_Int32 nRet = 0;
849  if(IsValid())
850  nRet = static_cast<sal_Int32>(GetDoc()->GetTableFrameFormatCount(true));
851  return nRet;
852 }
853 
854 uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex)
855 {
856  SolarMutexGuard aGuard;
857  uno::Any aRet;
858  if (!IsValid())
859  throw uno::RuntimeException();
860 
861  if (nInputIndex < 0)
862  throw IndexOutOfBoundsException();
863 
864  SwAutoFormatGetDocNode aGetHt( &GetDoc()->GetNodes() );
865  size_t nIndex = static_cast<size_t>(nInputIndex);
866  size_t nCurrentIndex = 0;
867 
868  for (SwFrameFormat* const & pFormat : *GetDoc()->GetTableFrameFormats())
869  {
870  if (!pFormat->GetInfo(aGetHt))
871  {
872  if (nCurrentIndex == nIndex)
873  {
874  uno::Reference<XTextTable> xTable = SwXTextTables::GetObject(*pFormat);
875  aRet <<= xTable;
876  return aRet;
877  }
878  else
879  nCurrentIndex++;
880  }
881  }
882  throw IndexOutOfBoundsException();
883 }
884 
885 uno::Any SwXTextTables::getByName(const OUString& rItemName)
886 {
887  SolarMutexGuard aGuard;
888  uno::Any aRet;
889  if(!IsValid())
890  throw uno::RuntimeException();
891 
892  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
893  uno::Reference< XTextTable > xTable;
894  for( size_t i = 0; i < nCount; ++i)
895  {
896  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
897  if (rItemName == rFormat.GetName())
898  {
899  xTable = SwXTextTables::GetObject(rFormat);
900  aRet <<= xTable;
901  break;
902  }
903  }
904  if(!xTable.is())
905  throw NoSuchElementException();
906 
907  return aRet;
908 }
909 
910 uno::Sequence< OUString > SwXTextTables::getElementNames()
911 {
912  SolarMutexGuard aGuard;
913  if(!IsValid())
914  throw uno::RuntimeException();
915  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
916  uno::Sequence<OUString> aSeq(static_cast<sal_Int32>(nCount));
917  if(nCount)
918  {
919  OUString* pArray = aSeq.getArray();
920  for( size_t i = 0; i < nCount; ++i)
921  {
922  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
923 
924  pArray[i] = rFormat.GetName();
925  }
926  }
927  return aSeq;
928 }
929 
930 sal_Bool SwXTextTables::hasByName(const OUString& rName)
931 {
932  SolarMutexGuard aGuard;
933  bool bRet= false;
934  if(!IsValid())
935  throw uno::RuntimeException();
936 
937  const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
938  for( size_t i = 0; i < nCount; ++i)
939  {
940  SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
941  if (rName == rFormat.GetName())
942  {
943  bRet = true;
944  break;
945  }
946  }
947  return bRet;
948 }
949 
950 uno::Type SAL_CALL
952 {
954 }
955 
957 {
958  SolarMutexGuard aGuard;
959  if(!IsValid())
960  throw uno::RuntimeException();
961  return 0 != GetDoc()->GetTableFrameFormatCount(true);
962 }
963 
965 {
966  return "SwXTextTables";
967 }
968 
969 sal_Bool SwXTextTables::supportsService(const OUString& rServiceName)
970 {
971  return cppu::supportsService(this, rServiceName);
972 }
973 
974 uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames()
975 {
976  return { "com.sun.star.text.TextTables" };
977 }
978 
979 uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat)
980 {
981  return SwXTextTable::CreateXTextTable(& rFormat);
982 }
983 
984 namespace
985 {
986  template<FlyCntType T> struct UnoFrameWrap_traits {};
987 
988  template<>
989  struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
990  {
991  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
992  {
993  uno::Reference<text::XTextFrame> const xRet(
994  SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat));
995  return uno::makeAny(xRet);
996  }
997  static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); };
998  };
999 
1000  template<>
1001  struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
1002  {
1003  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1004  {
1005  uno::Reference<text::XTextContent> const xRet(
1006  SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1007  return uno::makeAny(xRet);
1008  }
1009  static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
1010  };
1011 
1012  template<>
1013  struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
1014  {
1015  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1016  {
1017  uno::Reference<text::XTextContent> const xRet(
1018  SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1019  return uno::makeAny(xRet);
1020  }
1021  static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
1022  };
1023 
1024  template<FlyCntType T>
1025  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat)
1026  {
1027  return UnoFrameWrap_traits<T>::wrapFrame(*pFormat);
1028  }
1029 
1030  // runtime adapter for lcl_UnoWrapFrame
1032  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat, FlyCntType eType)
1033  {
1034  switch(eType)
1035  {
1036  case FLYCNTTYPE_FRM:
1037  return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFormat);
1038  case FLYCNTTYPE_GRF:
1039  return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFormat);
1040  case FLYCNTTYPE_OLE:
1041  return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFormat);
1042  default:
1043  throw uno::RuntimeException();
1044  }
1045  }
1046 
1047  template<FlyCntType T>
1048  class SwXFrameEnumeration
1049  : public SwSimpleEnumeration_Base
1050  {
1051  private:
1052  std::vector< Any > m_aFrames;
1053  protected:
1054  virtual ~SwXFrameEnumeration() override {};
1055  public:
1056  SwXFrameEnumeration(const SwDoc& rDoc);
1057 
1058  //XEnumeration
1059  virtual sal_Bool SAL_CALL hasMoreElements() override;
1060  virtual Any SAL_CALL nextElement() override;
1061 
1062  //XServiceInfo
1063  virtual OUString SAL_CALL getImplementationName() override;
1064  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
1065  virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1066  };
1067 }
1068 
1069 template<FlyCntType T>
1070 SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc& rDoc)
1071  : m_aFrames()
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(static_cast<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:240
#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:956
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
const size_t count(pCandidateA->getBorderLines().size())
static css::uno::Reference< css::text::XTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
Definition: unotbl.cxx:2004
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:974
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:930
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1339
bool IsGrfNode() const
Definition: node.hxx:660
#define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT
Definition: unocoll.hxx:215
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1046
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:969
#define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT
Definition: unocoll.hxx:194
#define CSS_TEXT_TEXTFIELD_CHAPTER
Definition: unocoll.hxx:192
SwDocShell * GetDocShell()
Definition: doc.hxx:1353
#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT
Definition: unocoll.hxx:218
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:812
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.
Definition: doc.hxx:187
Reference< XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:810
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:1794
css::uno::Reference< css::frame::XModel > GetModel() const
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
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1138
bool empty() const
Definition: docary.hxx:82
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:743
#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:885
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
static css::uno::Reference< css::text::XTextSection > CreateXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader=false)
Definition: unosect.cxx:197
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:197
#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:964
#define SAL_MAX_UINT16
bool IsValid() const
Definition: unocoll.hxx:57
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:910
const OUString & GetName() const
Definition: format.hxx:115
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1685
int nCount
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
#define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET
Definition: unocoll.hxx:206
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
#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:688
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
bool empty() const
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:656
#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:471
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:951
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:840
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:58
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:44
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:84
unsigned char sal_Bool
static css::uno::Reference< css::text::XDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1623
::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:1090
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:399
bool IsNoTextNode() const
Definition: node.hxx:652
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:31
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:979
#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:801
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:156
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:1067
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:1621
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:501
#define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT
Definition: unocoll.hxx:217
SwNodes & GetNodes()
Definition: doc.hxx:408
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:3189
#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:512
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:758
#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:481
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:775
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:633
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:2329
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:3478
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:3431
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:674
const ProvNamesId_Type aProvNamesId[]
Definition: unocoll.cxx:280
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:854
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:1339
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:459
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1291
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:845
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:834
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:1620
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:916
#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR
Definition: unocoll.hxx:223
Base class of the Writer document model elements.
Definition: node.hxx:80
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)