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