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