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 <swtypes.hxx>
23 #include <cmdid.h>
24 #include <hintids.hxx>
25 #include <svx/svxids.hrc>
26 #include <doc.hxx>
29 #include <docary.hxx>
30 #include <fmtcol.hxx>
31 #include <poolfmt.hxx>
32 #include <unocoll.hxx>
33 #include <unosett.hxx>
34 #include <fmtanchr.hxx>
35 #include <ndtxt.hxx>
36 #include <section.hxx>
37 #include <IMark.hxx>
38 #include <ftnidx.hxx>
39 #include <fmtftn.hxx>
40 #include <txtftn.hxx>
41 #include <fmtpdsc.hxx>
42 #include <pagedesc.hxx>
43 #include <com/sun/star/text/XTextTableCursor.hpp>
44 #include <com/sun/star/text/XTextTablesSupplier.hpp>
45 #include <com/sun/star/text/TableColumnSeparator.hpp>
46 #include <com/sun/star/text/XTextTable.hpp>
47 #include <svl/PasswordHelper.hxx>
48 #include <svtools/unoimap.hxx>
49 #include <svtools/unoevent.hxx>
50 #include <unotbl.hxx>
51 #include <unostyle.hxx>
52 #include <unofield.hxx>
53 #include <unoidx.hxx>
54 #include <unoframe.hxx>
55 #include <textboxhelper.hxx>
56 #include <unofootnote.hxx>
57 #include <vcl/svapp.hxx>
58 #include <fmtcntnt.hxx>
59 #include <authfld.hxx>
60 #include <SwXTextDefaults.hxx>
61 #include <unochart.hxx>
62 #include <comphelper/sequence.hxx>
64 #include <iterator>
65 #include <unosection.hxx>
66 #include <unoparagraph.hxx>
67 #include <unobookmark.hxx>
68 #include <unorefmark.hxx>
69 #include <unometa.hxx>
70 #include <docsh.hxx>
71 #include <hints.hxx>
72 #include <com/sun/star/document/XCodeNameQuery.hpp>
73 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
74 #include <com/sun/star/form/XFormsSupplier.hpp>
75 #include <com/sun/star/script/ModuleInfo.hpp>
76 #include <com/sun/star/script/ModuleType.hpp>
77 #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
78 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
80 #include <basic/basmgr.hxx>
82 #include <cppuhelper/implbase.hxx>
83 #include <sfx2/event.hxx>
84 #include <sal/log.hxx>
85 
86 using namespace ::com::sun::star;
87 using namespace ::com::sun::star::document;
88 using namespace ::com::sun::star::uno;
89 using namespace ::com::sun::star::text;
90 using namespace ::com::sun::star::container;
91 using namespace ::com::sun::star::lang;
92 
93 #if HAVE_FEATURE_SCRIPTING
94 
95 class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery >
96 {
97  SwDocShell* const mpDocShell;
98  OUString msThisDocumentCodeName;
99 public:
100  explicit SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
101  // XCodeNameQuery
102 
103  OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) override
104  {
105  // #FIXME not implemented...
106  return OUString();
107  }
108 
109  OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) override
110  {
111  // Initialise the code name
112  if ( msThisDocumentCodeName.isEmpty() )
113  {
114  try
115  {
116  uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
117  uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
118  OUString sProjectName( "Standard");
119  if ( !mpDocShell->GetBasicManager()->GetName().isEmpty() )
120  {
121  sProjectName = mpDocShell->GetBasicManager()->GetName();
122  }
123  uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
124  uno::Sequence< OUString > sModuleNames = xLib->getElementNames();
125  uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
126 
127  auto pModuleName = std::find_if(sModuleNames.begin(), sModuleNames.end(), [&xVBAModuleInfo](const OUString& rName) {
128  return xVBAModuleInfo->hasModuleInfo(rName)
129  && xVBAModuleInfo->getModuleInfo(rName).ModuleType == script::ModuleType::DOCUMENT; });
130  if (pModuleName != sModuleNames.end())
131  msThisDocumentCodeName = *pModuleName;
132  }
133  catch( uno::Exception& )
134  {
135  }
136  }
137  OUString sCodeName;
138  if ( mpDocShell )
139  {
140  // need to find the page ( and index ) for this control
141  uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
142  uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
143 
144  try
145  {
146  uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
147  uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
148  // get the www-standard container
149  uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
150  sal_Int32 nCntrls = xFormControls->getCount();
151  for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
152  {
153  uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
154  bool bMatched = ( xControl == xIf );
155  if ( bMatched )
156  {
157  sCodeName = msThisDocumentCodeName;
158  break;
159  }
160  }
161  }
162  catch( uno::Exception& )
163  {
164  }
165  }
166  // #TODO Probably should throw here ( if !bMatched )
167  return sCodeName;
168  }
169 };
170 
171 typedef std::unordered_map< OUString, OUString > StringHashMap;
172 
173 class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer >
174 {
175  StringHashMap mTemplateToProject;
176 public:
177  SwVbaProjectNameProvider()
178  {
179  }
180  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
181  {
182  return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
183  }
184  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
185  {
186  if ( !hasByName( aName ) )
187  throw container::NoSuchElementException();
188  return uno::makeAny( mTemplateToProject.find( aName )->second );
189  }
190  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
191  {
192  return comphelper::mapKeysToSequence( mTemplateToProject );
193  }
194 
195  virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) override
196  {
197 
198  OUString sProjectName;
199  aElement >>= sProjectName;
200  SAL_INFO("sw.uno", "Template cache inserting template name " << aName
201  << " with project " << sProjectName);
202  mTemplateToProject[ aName ] = sProjectName;
203  }
204 
205  virtual void SAL_CALL removeByName( const OUString& Name ) override
206  {
207  if ( !hasByName( Name ) )
208  throw container::NoSuchElementException();
209  mTemplateToProject.erase( Name );
210  }
211  virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) override
212  {
213  if ( !hasByName( aName ) )
214  throw container::NoSuchElementException();
215  insertByName( aName, aElement ); // insert will overwrite
216  }
217  // XElemenAccess
218  virtual css::uno::Type SAL_CALL getElementType( ) override
219  {
221  }
222  virtual sal_Bool SAL_CALL hasElements( ) override
223  {
224 
225  return ( !mTemplateToProject.empty() );
226  }
227 
228 };
229 
230 class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess >
231 {
232  SwDocShell* const mpDocShell;
233 public:
234  explicit SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
235  {
236  // #FIXME #TODO is the code name for ThisDocument read anywhere?
237  }
238 
239  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
240  {
241  // #FIXME #TODO we really need to be checking against the codename for
242  // ThisDocument
243  if ( aName == "ThisDocument" )
244  return true;
245  return false;
246  }
247 
248  css::uno::Any SAL_CALL getByName( const OUString& aName ) override
249  {
250  if ( !hasByName( aName ) )
251  throw container::NoSuchElementException();
252  uno::Sequence< uno::Any > aArgs( 2 );
253  aArgs[0] <<= uno::Reference< uno::XInterface >();
254  aArgs[1] <<= mpDocShell->GetModel();
255  uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
256  SAL_INFO("sw.uno",
257  "Creating Object ( ooo.vba.word.Document ) 0x" << xDocObj.get());
258  return uno::makeAny( xDocObj );
259  }
260  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override
261  {
262  uno::Sequence< OUString > aNames;
263  return aNames;
264  }
265  // XElemenAccess
266  virtual css::uno::Type SAL_CALL getElementType( ) override { return uno::Type(); }
267  virtual sal_Bool SAL_CALL hasElements( ) override { return true; }
268 
269 };
270 
271 #endif
272 
274 {
275  const char * pName;
277 };
278 
279 // note: this thing is indexed as an array, so do not insert/remove entries!
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 clipoard
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  uno::Sequence< OUString > aRet { "com.sun.star.text.TextTables" };
980  return aRet;
981 }
982 
983 uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat)
984 {
985  return SwXTextTable::CreateXTextTable(& rFormat);
986 }
987 
988 namespace
989 {
990  template<FlyCntType T> struct UnoFrameWrap_traits {};
991 
992  template<>
993  struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
994  {
995  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
996  {
997  uno::Reference<text::XTextFrame> const xRet(
998  SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat));
999  return uno::makeAny(xRet);
1000  }
1001  static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); };
1002  };
1003 
1004  template<>
1005  struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
1006  {
1007  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1008  {
1009  uno::Reference<text::XTextContent> const xRet(
1010  SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1011  return uno::makeAny(xRet);
1012  }
1013  static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
1014  };
1015 
1016  template<>
1017  struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
1018  {
1019  static uno::Any wrapFrame(SwFrameFormat & rFrameFormat)
1020  {
1021  uno::Reference<text::XTextContent> const xRet(
1022  SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat));
1023  return uno::makeAny(xRet);
1024  }
1025  static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
1026  };
1027 
1028  template<FlyCntType T>
1029  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat)
1030  {
1031  return UnoFrameWrap_traits<T>::wrapFrame(*pFormat);
1032  }
1033 
1034  // runtime adapter for lcl_UnoWrapFrame
1036  uno::Any lcl_UnoWrapFrame(SwFrameFormat* pFormat, FlyCntType eType)
1037  {
1038  switch(eType)
1039  {
1040  case FLYCNTTYPE_FRM:
1041  return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFormat);
1042  case FLYCNTTYPE_GRF:
1043  return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFormat);
1044  case FLYCNTTYPE_OLE:
1045  return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFormat);
1046  default:
1047  throw uno::RuntimeException();
1048  }
1049  }
1050 
1051  template<FlyCntType T>
1052  class SwXFrameEnumeration
1053  : public SwSimpleEnumeration_Base
1054  {
1055  private:
1056  std::vector< Any > m_aFrames;
1057  protected:
1058  virtual ~SwXFrameEnumeration() override {};
1059  public:
1060  SwXFrameEnumeration(const SwDoc* const pDoc);
1061 
1062  //XEnumeration
1063  virtual sal_Bool SAL_CALL hasMoreElements() override;
1064  virtual Any SAL_CALL nextElement() override;
1065 
1066  //XServiceInfo
1067  virtual OUString SAL_CALL getImplementationName() override;
1068  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
1069  virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1070  };
1071 }
1072 
1073 template<FlyCntType T>
1074 SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
1075  : m_aFrames()
1076 {
1077  SolarMutexGuard aGuard;
1078  const SwFrameFormats* const pFormats = pDoc->GetSpzFrameFormats();
1079  if(pFormats->empty())
1080  return;
1081  // #i104937#
1082  const size_t nSize = pFormats->size();
1083  // #i104937#
1084  SwFrameFormat* pFormat( nullptr );
1085  for( size_t i = 0; i < nSize; ++i )
1086  {
1087  // #i104937#
1088  pFormat = (*pFormats)[i];
1089  if(pFormat->Which() != RES_FLYFRMFMT || SwTextBoxHelper::isTextBox(pFormat, RES_FLYFRMFMT))
1090  continue;
1091  const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
1092  if(!pIdx || !pIdx->GetNodes().IsDocNodes())
1093  continue;
1094  const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
1095  if(UnoFrameWrap_traits<T>::filter(pNd))
1096  m_aFrames.push_back(lcl_UnoWrapFrame<T>(pFormat));
1097  }
1098 }
1099 
1100 template<FlyCntType T>
1101 sal_Bool SwXFrameEnumeration<T>::hasMoreElements()
1102 {
1103  SolarMutexGuard aGuard;
1104  return !m_aFrames.empty();
1105 }
1106 
1107 template<FlyCntType T>
1108 Any SwXFrameEnumeration<T>::nextElement()
1109 {
1110  SolarMutexGuard aGuard;
1111  if(m_aFrames.empty())
1112  throw NoSuchElementException();
1113 
1114  Any aResult = m_aFrames.back();
1115  m_aFrames.pop_back();
1116  return aResult;
1117 }
1118 
1119 template<FlyCntType T>
1120 OUString SwXFrameEnumeration<T>::getImplementationName()
1121 {
1122  return "SwXFrameEnumeration";
1123 }
1124 
1125 template<FlyCntType T>
1126 sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName)
1127 {
1128  return cppu::supportsService(this, ServiceName);
1129 }
1130 
1131 template<FlyCntType T>
1132 Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames()
1133 {
1134  return { OUString("com.sun.star.container.XEnumeration") };
1135 }
1136 
1138 {
1139  return "SwXFrames";
1140 }
1141 
1142 sal_Bool SwXFrames::supportsService(const OUString& rServiceName)
1143 {
1144  return cppu::supportsService(this, rServiceName);
1145 }
1146 
1148 {
1149  return { OUString("com.sun.star.text.TextFrames") };
1150 }
1151 
1153  SwUnoCollection(_pDoc),
1154  m_eType(eSet)
1155 {}
1156 
1158 {}
1159 
1160 uno::Reference<container::XEnumeration> SwXFrames::createEnumeration()
1161 {
1162  SolarMutexGuard aGuard;
1163  if(!IsValid())
1164  throw uno::RuntimeException();
1165  switch(m_eType)
1166  {
1167  case FLYCNTTYPE_FRM:
1168  return uno::Reference< container::XEnumeration >(
1169  new SwXFrameEnumeration<FLYCNTTYPE_FRM>(GetDoc()));
1170  case FLYCNTTYPE_GRF:
1171  return uno::Reference< container::XEnumeration >(
1172  new SwXFrameEnumeration<FLYCNTTYPE_GRF>(GetDoc()));
1173  case FLYCNTTYPE_OLE:
1174  return uno::Reference< container::XEnumeration >(
1175  new SwXFrameEnumeration<FLYCNTTYPE_OLE>(GetDoc()));
1176  default:
1177  throw uno::RuntimeException();
1178  }
1179 }
1180 
1182 {
1183  SolarMutexGuard aGuard;
1184  if(!IsValid())
1185  throw uno::RuntimeException();
1186  // Ignore TextBoxes for TextFrames.
1187  return static_cast<sal_Int32>(GetDoc()->GetFlyCount(m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM));
1188 }
1189 
1191 {
1192  SolarMutexGuard aGuard;
1193  if(!IsValid())
1194  throw uno::RuntimeException();
1195  if(nIndex < 0)
1196  throw IndexOutOfBoundsException();
1197  // Ignore TextBoxes for TextFrames.
1198  SwFrameFormat* pFormat = GetDoc()->GetFlyNum(static_cast<size_t>(nIndex), m_eType, /*bIgnoreTextBoxes=*/m_eType == FLYCNTTYPE_FRM);
1199  if(!pFormat)
1200  throw IndexOutOfBoundsException();
1201  return lcl_UnoWrapFrame(pFormat, m_eType);
1202 }
1203 
1204 uno::Any SwXFrames::getByName(const OUString& rName)
1205 {
1206  SolarMutexGuard aGuard;
1207  if(!IsValid())
1208  throw uno::RuntimeException();
1209  const SwFrameFormat* pFormat;
1210  switch(m_eType)
1211  {
1212  case FLYCNTTYPE_GRF:
1213  pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Grf);
1214  break;
1215  case FLYCNTTYPE_OLE:
1216  pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Ole);
1217  break;
1218  default:
1219  pFormat = GetDoc()->FindFlyByName(rName, SwNodeType::Text);
1220  break;
1221  }
1222  if(!pFormat)
1223  throw NoSuchElementException();
1224  return lcl_UnoWrapFrame(const_cast<SwFrameFormat*>(pFormat), m_eType);
1225 }
1226 
1227 uno::Sequence<OUString> SwXFrames::getElementNames()
1228 {
1229  SolarMutexGuard aGuard;
1230  if(!IsValid())
1231  throw uno::RuntimeException();
1232  const Reference<XEnumeration> xEnum = createEnumeration();
1233  std::vector<OUString> vNames;
1234  while(xEnum->hasMoreElements())
1235  {
1236  Reference<container::XNamed> xNamed;
1237  xEnum->nextElement() >>= xNamed;
1238  if(xNamed.is())
1239  vNames.push_back(xNamed->getName());
1240  }
1241  return ::comphelper::containerToSequence(vNames);
1242 }
1243 
1244 sal_Bool SwXFrames::hasByName(const OUString& rName)
1245 {
1246  SolarMutexGuard aGuard;
1247  if(!IsValid())
1248  throw uno::RuntimeException();
1249  switch(m_eType)
1250  {
1251  case FLYCNTTYPE_GRF:
1252  return GetDoc()->FindFlyByName(rName, SwNodeType::Grf) != nullptr;
1253  case FLYCNTTYPE_OLE:
1254  return GetDoc()->FindFlyByName(rName, SwNodeType::Ole) != nullptr;
1255  default:
1256  return GetDoc()->FindFlyByName(rName, SwNodeType::Text) != nullptr;
1257  }
1258 }
1259 
1261 {
1262  SolarMutexGuard aGuard;
1263  switch(m_eType)
1264  {
1265  case FLYCNTTYPE_FRM:
1267  case FLYCNTTYPE_GRF:
1269  case FLYCNTTYPE_OLE:
1271  default:
1272  return uno::Type();
1273  }
1274 }
1275 
1277 {
1278  SolarMutexGuard aGuard;
1279  if(!IsValid())
1280  throw uno::RuntimeException();
1281  return GetDoc()->GetFlyCount(m_eType) > 0;
1282 }
1283 
1284 
1286 {
1287  return "SwXTextFrames";
1288 }
1289 
1290 sal_Bool SwXTextFrames::supportsService(const OUString& rServiceName)
1291 {
1292  return cppu::supportsService(this, rServiceName);
1293 }
1294 
1296 {
1297  Sequence<OUString> aRet { "com.sun.star.text.TextFrames" };
1298  return aRet;
1299 }
1300 
1302  SwXFrames(_pDoc, FLYCNTTYPE_FRM)
1303 {
1304 }
1305 
1307 {
1308 }
1309 
1311 {
1312  return "SwXTextGraphicObjects";
1313 }
1314 
1316 {
1317  return cppu::supportsService(this, rServiceName);
1318 }
1319 
1321 {
1322  Sequence<OUString> aRet { "com.sun.star.text.TextGraphicObjects" };
1323  return aRet;
1324 }
1325 
1327  SwXFrames(_pDoc, FLYCNTTYPE_GRF)
1328 {
1329 }
1330 
1332 {
1333 }
1334 
1336 {
1337  return "SwXTextEmbeddedObjects";
1338 }
1339 
1341 {
1342  return cppu::supportsService(this, rServiceName);
1343 }
1344 
1346 {
1347  Sequence<OUString> aRet { "com.sun.star.text.TextEmbeddedObjects" };
1348  return aRet;
1349 }
1350 
1352  SwXFrames(_pDoc, FLYCNTTYPE_OLE)
1353 {
1354 }
1355 
1357 {
1358 }
1359 
1361 {
1362  return "SwXTextSections";
1363 }
1364 
1365 sal_Bool SwXTextSections::supportsService(const OUString& rServiceName)
1366 {
1367  return cppu::supportsService(this, rServiceName);
1368 }
1369 
1371 {
1372  Sequence<OUString> aRet { "com.sun.star.text.TextSections" };
1373  return aRet;
1374 }
1375 
1377  SwUnoCollection(_pDoc)
1378 {
1379 }
1380 
1382 {
1383 }
1384 
1386 {
1387  SolarMutexGuard aGuard;
1388  if(!IsValid())
1389  throw uno::RuntimeException();
1390  const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1391  size_t nCount = rSectFormats.size();
1392  for(size_t i = nCount; i; --i)
1393  {
1394  if( !rSectFormats[i - 1]->IsInNodesArr())
1395  nCount--;
1396  }
1397  return nCount;
1398 }
1399 
1401 {
1402  SolarMutexGuard aGuard;
1403  uno::Reference< XTextSection > xRet;
1404  if(!IsValid())
1405  throw uno::RuntimeException();
1406 
1407  SwSectionFormats& rFormats = GetDoc()->GetSections();
1408 
1409  const SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1410  const size_t nCount = rSectFormats.size();
1411  for(size_t i = 0; i < nCount; ++i)
1412  {
1413  if( !rSectFormats[i]->IsInNodesArr())
1414  nIndex ++;
1415  else if(static_cast<size_t>(nIndex) == i)
1416  break;
1417  if(static_cast<size_t>(nIndex) == i)
1418  break;
1419  }
1420  if(!(nIndex >= 0 && static_cast<size_t>(nIndex) < rFormats.size()))
1421  throw IndexOutOfBoundsException();
1422 
1423  SwSectionFormat* pFormat = rFormats[nIndex];
1424  xRet = GetObject(*pFormat);
1425 
1426  return makeAny(xRet);
1427 }
1428 
1429 uno::Any SwXTextSections::getByName(const OUString& rName)
1430 {
1431  SolarMutexGuard aGuard;
1432  uno::Any aRet;
1433  if(!IsValid())
1434  throw uno::RuntimeException();
1435 
1436  SwSectionFormats& rFormats = GetDoc()->GetSections();
1437  uno::Reference< XTextSection > xSect;
1438  for(size_t i = 0; i < rFormats.size(); ++i)
1439  {
1440  SwSectionFormat* pFormat = rFormats[i];
1441  if (pFormat->IsInNodesArr()
1442  && (rName == pFormat->GetSection()->GetSectionName()))
1443  {
1444  xSect = GetObject(*pFormat);
1445  aRet <<= xSect;
1446  break;
1447  }
1448  }
1449  if(!xSect.is())
1450  throw NoSuchElementException();
1451 
1452  return aRet;
1453 }
1454 
1455 uno::Sequence< OUString > SwXTextSections::getElementNames()
1456 {
1457  SolarMutexGuard aGuard;
1458  if(!IsValid())
1459  throw uno::RuntimeException();
1460  size_t nCount = GetDoc()->GetSections().size();
1461  SwSectionFormats& rSectFormats = GetDoc()->GetSections();
1462  for(size_t i = nCount; i; --i)
1463  {
1464  if( !rSectFormats[i - 1]->IsInNodesArr())
1465  nCount--;
1466  }
1467 
1468  uno::Sequence<OUString> aSeq(nCount);
1469  if(nCount)
1470  {
1471  SwSectionFormats& rFormats = GetDoc()->GetSections();
1472  OUString* pArray = aSeq.getArray();
1473  size_t nIndex = 0;
1474  for( size_t i = 0; i < nCount; ++i, ++nIndex)
1475  {
1476  const SwSectionFormat* pFormat = rFormats[nIndex];
1477  while(!pFormat->IsInNodesArr())
1478  {
1479  pFormat = rFormats[++nIndex];
1480  }
1481  pArray[i] = pFormat->GetSection()->GetSectionName();
1482  }
1483  }
1484  return aSeq;
1485 }
1486 
1487 sal_Bool SwXTextSections::hasByName(const OUString& rName)
1488 {
1489  SolarMutexGuard aGuard;
1490  bool bRet = false;
1491  if(IsValid())
1492  {
1493  SwSectionFormats& rFormats = GetDoc()->GetSections();
1494  for(size_t i = 0; i < rFormats.size(); ++i)
1495  {
1496  const SwSectionFormat* pFormat = rFormats[i];
1497  if (rName == pFormat->GetSection()->GetSectionName())
1498  {
1499  bRet = true;
1500  break;
1501  }
1502  }
1503  }
1504  else
1505  {
1506  // special handling for dbg_ methods
1507  if( !rName.startsWith("dbg_"))
1508  throw uno::RuntimeException();
1509  }
1510  return bRet;
1511 }
1512 
1514 {
1516 }
1517 
1519 {
1520  SolarMutexGuard aGuard;
1521  size_t nCount = 0;
1522  if(!IsValid())
1523  throw uno::RuntimeException();
1524 
1525  SwSectionFormats& rFormats = GetDoc()->GetSections();
1526  nCount = rFormats.size();
1527 
1528  return nCount > 0;
1529 }
1530 
1531 uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFormat& rFormat )
1532 {
1533  return SwXTextSection::CreateXTextSection(&rFormat);
1534 }
1535 
1537 {
1538  return "SwXBookmarks";
1539 }
1540 
1541 sal_Bool SwXBookmarks::supportsService(const OUString& rServiceName)
1542 {
1543  return cppu::supportsService(this, rServiceName);
1544 }
1545 
1547 {
1548  Sequence< OUString > aRet { "com.sun.star.text.Bookmarks" };
1549  return aRet;
1550 }
1551 
1553  SwUnoCollection(_pDoc)
1554 { }
1555 
1557 { }
1558 
1560 {
1561  SolarMutexGuard aGuard;
1562  if(!IsValid())
1563  throw uno::RuntimeException();
1564 
1565  sal_Int32 count(0);
1566  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1568  pMarkAccess->getBookmarksBegin();
1569  ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1570  {
1572  IDocumentMarkAccess::GetType(**ppMark))
1573  {
1574  ++count; // only count real bookmarks
1575  }
1576  }
1577  return count;
1578 }
1579 
1581 {
1582  SolarMutexGuard aGuard;
1583  if(!IsValid())
1584  throw uno::RuntimeException();
1585  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1586  if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
1587  throw IndexOutOfBoundsException();
1588 
1589  sal_Int32 count(0);
1591  pMarkAccess->getBookmarksBegin();
1592  ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1593  {
1595  IDocumentMarkAccess::GetType(**ppMark))
1596  {
1597  if (count == nIndex)
1598  {
1599  uno::Any aRet;
1600  const uno::Reference< text::XTextContent > xRef =
1601  SwXBookmark::CreateXBookmark(*GetDoc(), *ppMark);
1602  aRet <<= xRef;
1603  return aRet;
1604  }
1605  ++count; // only count real bookmarks
1606  }
1607  }
1608  throw IndexOutOfBoundsException();
1609 }
1610 
1611 uno::Any SwXBookmarks::getByName(const OUString& rName)
1612 {
1613  SolarMutexGuard aGuard;
1614  if(!IsValid())
1615  throw uno::RuntimeException();
1616 
1617  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1618  IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
1619  if(ppBkmk == pMarkAccess->getBookmarksEnd())
1620  throw NoSuchElementException();
1621 
1622  uno::Any aRet;
1623  const uno::Reference< text::XTextContent > xRef =
1624  SwXBookmark::CreateXBookmark(*GetDoc(), *ppBkmk);
1625  aRet <<= xRef;
1626  return aRet;
1627 }
1628 
1629 uno::Sequence< OUString > SwXBookmarks::getElementNames()
1630 {
1631  SolarMutexGuard aGuard;
1632  if(!IsValid())
1633  throw uno::RuntimeException();
1634 
1635  std::vector< OUString > ret;
1636  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1638  pMarkAccess->getBookmarksBegin();
1639  ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1640  {
1642  IDocumentMarkAccess::GetType(**ppMark))
1643  {
1644  ret.push_back((*ppMark)->GetName()); // only add real bookmarks
1645  }
1646  }
1647  return comphelper::containerToSequence(ret);
1648 }
1649 
1650 sal_Bool SwXBookmarks::hasByName(const OUString& rName)
1651 {
1652  SolarMutexGuard aGuard;
1653  if(!IsValid())
1654  throw uno::RuntimeException();
1655 
1656  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1657  return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
1658 }
1659 
1661 {
1663 }
1664 
1666 {
1667  SolarMutexGuard aGuard;
1668  if(!IsValid())
1669  throw uno::RuntimeException();
1670 
1671  IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
1673  pMarkAccess->getBookmarksBegin();
1674  ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
1675  {
1677  IDocumentMarkAccess::GetType(**ppMark))
1678  {
1679  return true;
1680  }
1681  }
1682  return false;
1683 }
1684 
1686  SwUnoCollection(_pDoc)
1687 {
1688 }
1689 
1691 {
1692 }
1693 
1695 {
1696  SolarMutexGuard aGuard;
1697  if(!IsValid())
1698  throw uno::RuntimeException();
1699  return GetDoc()->GetNumRuleTable().size();
1700 }
1701 
1703 {
1704  SolarMutexGuard aGuard;
1705  uno::Any aRet;
1706  if(!IsValid())
1707  throw uno::RuntimeException();
1708 
1709  uno::Reference< XIndexReplace > xRef;
1710  if ( static_cast<size_t>(nIndex) < GetDoc()->GetNumRuleTable().size() )
1711  {
1712  xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTable()[ nIndex ], GetDoc());
1713  aRet <<= xRef;
1714  }
1715 
1716  if(!xRef.is())
1717  throw IndexOutOfBoundsException();
1718 
1719  return aRet;
1720 }
1721 
1723 {
1725 }
1726 
1728 {
1729  SolarMutexGuard aGuard;
1730  if(!IsValid())
1731  throw uno::RuntimeException();
1732  return !GetDoc()->GetNumRuleTable().empty();
1733 }
1734 
1736 {
1737  return "SwXFootnotes";
1738 }
1739 
1740 sal_Bool SwXFootnotes::supportsService(const OUString& rServiceName)
1741 {
1742  return cppu::supportsService(this, rServiceName);
1743 }
1744 
1746 {
1747  Sequence<OUString> aRet { "com.sun.star.text.Footnotes" };
1748  return aRet;
1749 }
1750 
1752  : SwUnoCollection(_pDoc)
1753  , m_bEndnote(bEnd)
1754 {
1755 }
1756 
1758 {
1759 }
1760 
1762 {
1763  SolarMutexGuard aGuard;
1764  if(!IsValid())
1765  throw uno::RuntimeException();
1766  sal_Int32 nCount = 0;
1767  const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1768  SwTextFootnote* pTextFootnote;
1769  for( size_t n = 0; n < nFootnoteCnt; ++n )
1770  {
1771  pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1772  const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1773  if ( rFootnote.IsEndNote() != m_bEndnote )
1774  continue;
1775  nCount++;
1776  }
1777  return nCount;
1778 }
1779 
1781 {
1782  SolarMutexGuard aGuard;
1783  uno::Any aRet;
1784  sal_Int32 nCount = 0;
1785  if(!IsValid())
1786  throw uno::RuntimeException();
1787 
1788  const size_t nFootnoteCnt = GetDoc()->GetFootnoteIdxs().size();
1789  SwTextFootnote* pTextFootnote;
1790  uno::Reference< XFootnote > xRef;
1791  for( size_t n = 0; n < nFootnoteCnt; ++n )
1792  {
1793  pTextFootnote = GetDoc()->GetFootnoteIdxs()[ n ];
1794  const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
1795  if ( rFootnote.IsEndNote() != m_bEndnote )
1796  continue;
1797 
1798  if(nCount == nIndex)
1799  {
1801  &const_cast<SwFormatFootnote&>(rFootnote));
1802  aRet <<= xRef;
1803  break;
1804  }
1805  nCount++;
1806  }
1807  if(!xRef.is())
1808  throw IndexOutOfBoundsException();
1809 
1810  return aRet;
1811 }
1812 
1814 {
1816 }
1817 
1819 {
1820  SolarMutexGuard aGuard;
1821  if(!IsValid())
1822  throw uno::RuntimeException();
1823  return !GetDoc()->GetFootnoteIdxs().empty();
1824 }
1825 
1826 Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFormatFootnote& rFormat )
1827 {
1828  return SwXFootnote::CreateXFootnote(rDoc, &const_cast<SwFormatFootnote&>(rFormat));
1829 }
1830 
1832 {
1833  return "SwXReferenceMarks";
1834 }
1835 
1836 sal_Bool SwXReferenceMarks::supportsService(const OUString& rServiceName)
1837 {
1838  return cppu::supportsService(this, rServiceName);
1839 }
1840 
1842 {
1843  Sequence<OUString> aRet { "com.sun.star.text.ReferenceMarks" };
1844  return aRet;
1845 }
1846 
1848  SwUnoCollection(_pDoc)
1849 {
1850 }
1851 
1853 {
1854 }
1855 
1857 {
1858  SolarMutexGuard aGuard;
1859  if(!IsValid())
1860  throw uno::RuntimeException();
1861  return GetDoc()->GetRefMarks();
1862 }
1863 
1865 {
1866  SolarMutexGuard aGuard;
1867  uno::Any aRet;
1868  if(!IsValid())
1869  throw uno::RuntimeException();
1870  uno::Reference< XTextContent > xRef;
1871  if(0 <= nIndex && nIndex < SAL_MAX_UINT16)
1872  {
1873  SwFormatRefMark *const pMark = const_cast<SwFormatRefMark*>(
1874  GetDoc()->GetRefMark(static_cast<sal_uInt16>(nIndex)));
1875  if(pMark)
1876  {
1878  aRet <<= xRef;
1879  }
1880  }
1881  if(!xRef.is())
1882  throw IndexOutOfBoundsException();
1883  return aRet;
1884 }
1885 
1887 {
1888  SolarMutexGuard aGuard;
1889  uno::Any aRet;
1890  if(!IsValid())
1891  throw uno::RuntimeException();
1892 
1893  SwFormatRefMark *const pMark =
1894  const_cast<SwFormatRefMark*>(GetDoc()->GetRefMark(rName));
1895  if(!pMark)
1896  throw NoSuchElementException();
1897 
1898  uno::Reference<XTextContent> const xRef =
1900  aRet <<= xRef;
1901 
1902  return aRet;
1903 }
1904 
1905 uno::Sequence< OUString > SwXReferenceMarks::getElementNames()
1906 {
1907  SolarMutexGuard aGuard;
1908  uno::Sequence<OUString> aRet;
1909  if(!IsValid())
1910  throw uno::RuntimeException();
1911 
1912  std::vector<OUString> aStrings;
1913  const sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
1914  aRet.realloc(nCount);
1915  OUString* pNames = aRet.getArray();
1916  for(sal_uInt16 i = 0; i < nCount; i++)
1917  pNames[i] = aStrings[i];
1918 
1919  return aRet;
1920 }
1921 
1923 {
1924  SolarMutexGuard aGuard;
1925  if(!IsValid())
1926  throw uno::RuntimeException();
1927  return nullptr != GetDoc()->GetRefMark( rName);
1928 }
1929 
1931 {
1933 }
1934 
1936 {
1937  SolarMutexGuard aGuard;
1938  if(!IsValid())
1939  throw uno::RuntimeException();
1940  return 0 != GetDoc()->GetRefMarks();
1941 }
1942 
1944 {
1945  m_bObjectValid = false;
1946  m_pDoc = nullptr;
1947 }
1948 
1949 /* 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:1351
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
#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:1836
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1727
const size_t count(pCandidateA->getBorderLines().size())
static css::uno::Reference< css::text::XTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
Definition: unotbl.cxx:2050
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1285
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:1702
css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs(SfxObjectShell const *pShell, const sal_Char *_pAsciiName, const css::uno::Sequence< css::uno::Any > &aArgs)
#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:1345
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:1841
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:1342
#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT
Definition: unocoll.hxx:218
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:807
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1310
#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:1690
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:1290
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:1831
Reference< XInterface > SvUnoImageMapRectangleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
Provides access to the marks of a document.
Definition: doc.hxx:185
Reference< XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:785
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1429
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:1556
#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:1602
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:1255
virtual ~SwXFootnotes() override
Definition: unocoll.cxx:1757
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1487
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1142
bool empty() const
Definition: docary.hxx:89
For old documents the Field-Which IDs must be preserved !!!
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1513
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
#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:194
virtual ~SwXTextFrames() override
Definition: unocoll.cxx:1306
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1864
Array of Undo-history.
Definition: docary.hxx:299
#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:1694
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:1365
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:1190
static css::uno::Reference< css::text::XTextContent > CreateXFieldmark(SwDoc &rDoc,::sw::mark::IMark *pMark, bool isReplacementObject=false)
Definition: unobkm.cxx:652
#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR
Definition: unocoll.hxx:225
bool empty() const
Definition: docary.hxx:224
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1905
SfxStyleFamily
SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false)
Definition: docfly.cxx:114
SfxObjectCreateMode GetCreateMode() const
size_type size() const
#define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM
Definition: unocoll.hxx:231
virtual ~SwXFrames() override
Definition: unocoll.cxx:1157
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
bool IsOLENode() const
Definition: node.hxx:652
#define CSS_TEXT_TEXTFIELD_FILE_NAME
Definition: unocoll.hxx:189
#define SAL_N_ELEMENTS(arr)
#define RES_FLYFRMFMT
Definition: hintids.hxx:276
#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:1340
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:158
#define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION
Definition: unocoll.hxx:222
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1611
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unocoll.cxx:1160
virtual ~SwXTextTables() override
Definition: unocoll.cxx:843
const SwFlyFrameFormat * FindFlyByName(const OUString &rName, SwNodeType nNdTyp=SwNodeType::NONE) const
Definition: doclay.cxx:1384
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1546
#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:1650
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1886
css::uno::Sequence< OUString > getSupportedServiceNames()
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1665
#define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS
Definition: unocoll.hxx:233
const OUString & GetSectionName() const
Definition: section.hxx:169
#define CSS_TEXT_TEXTFIELD_DROP_DOWN
Definition: unocoll.hxx:234
FlyCntType
Definition: flyenum.hxx:23
virtual ~SwXReferenceMarks() override
Definition: unocoll.cxx:1852
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1722
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:1629
#define CSS_TEXT_TEXTFIELD_DDE
Definition: unocoll.hxx:198
const SwFormatRefMark * GetRefMark(const OUString &rName) const
Definition: doc.cxx:1060
int i
SwFieldIds
Definition: fldbas.hxx:38
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1930
size_t size() const
Definition: docary.hxx:91
unsigned char sal_Bool
static css::uno::Reference< css::text::XDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1629
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1735
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1335
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1105
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:401
bool IsNoTextNode() const
Definition: node.hxx:648
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unocoll.cxx:1922
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1745
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
SwServiceType const nType
Definition: unocoll.cxx:276
css::uno::Type const & get()
sal_uInt16 sal_Char * pName
SwXNumberingRulesCollection(SwDoc *pDoc)
Definition: unocoll.cxx:1685
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:983
#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:1137
DocumentType const eType
static css::uno::Reference< css::text::XTextContent > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:131
#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:1856
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1400
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:1381
#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:776
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocoll.cxx:1660
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1580
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1276
#define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME
Definition: unocoll.hxx:221
SwXTextGraphicObjects(SwDoc *pDoc)
Definition: unocoll.cxx:1326
#define CSS_TEXT_TEXTFIELD_GET_REFERENCE
Definition: unocoll.hxx:193
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1455
SwXBookmarks(SwDoc *pDoc)
Definition: unocoll.cxx:1552
#define CSS_TEXT_TEXTFIELD_GET_EXPRESSION
Definition: unocoll.hxx:188
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1370
const FlyCntType m_eType
Definition: unocoll.hxx:301
#define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH
Definition: unocoll.hxx:199
const char * pName
Definition: unocoll.cxx:275
SwXFrames(SwDoc *pDoc, FlyCntType eSet)
Definition: unocoll.cxx:1152
#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:1518
#define CSS_TEXT_TEXTFIELD_INPUT
Definition: unocoll.hxx:196
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1315
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1057
bool GetGlobalUNOConstant(const OUString &rName, css::uno::Any &aOut)
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1818
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:1609
virtual OUString SAL_CALL getImplementationName() override
Definition: unocoll.cxx:1536
#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:402
virtual void Invalidate()
Definition: unocoll.cxx:1943
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1181
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Access to frames.
Definition: docfly.cxx:67
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:3166
#define CSS_TEXT_TEXTFIELD_SCRIPT
Definition: unocoll.hxx:205
#define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE
Definition: unocoll.hxx:229
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unocoll.cxx:1204
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:1813
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocoll.cxx:1227
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:750
#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:1244
virtual ~SwXTextEmbeddedObjects() override
Definition: unocoll.cxx:1356
static css::uno::Reference< css::text::XFootnote > CreateXFootnote(SwDoc &rDoc, SwFormatFootnote *pFootnoteFormat, bool isEndnote=false)
Definition: unoftn.cxx:148
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:767
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1740
virtual ~SwXTextGraphicObjects() override
Definition: unocoll.cxx:1331
bool isAlienWordDoc(SfxObjectShell const &rDocShell)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1147
#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:627
SwXTextFrames(SwDoc *pDoc)
Definition: unocoll.cxx:1301
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1385
#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:2334
size_t size() const
Definition: docary.hxx:225
#define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME
Definition: unocoll.hxx:200
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocoll.cxx:1541
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3458
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocoll.cxx:1320
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3411
const bool m_bEndnote
Definition: unocoll.hxx:454
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1531
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocoll.cxx:1935
SwSection * GetSection() const
Definition: section.cxx:668
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:1360
SwXTextSections(SwDoc *pDoc)
Definition: unocoll.cxx:1376
SwXFootnotes(bool bEnd, SwDoc *pDoc)
Definition: unocoll.cxx:1751
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:1260
SwSectionFormats & GetSections()
Definition: doc.hxx:1328
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unocoll.cxx:1780
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:1559
#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:1295
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocoll.cxx:848
SwXReferenceMarks(SwDoc *pDoc)
Definition: unocoll.cxx:1847
#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:1761
static css::uno::Reference< css::text::XFootnote > GetObject(SwDoc &rDoc, const SwFormatFootnote &rFormat)
Definition: unocoll.cxx:1826
#define CSS_TEXT_FIELDMASTER_USER
Definition: unocoll.hxx:237
void SetVBATemplateToProjectCache(css::uno::Reference< css::container::XNameContainer > const &xCache)
Definition: doc.hxx:1608
static css::uno::Reference< css::beans::XPropertySet > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:552
#define CSS_TEXT_TEXTFIELD_PAGE_NUMBER
Definition: unocoll.hxx:190
bool IsInNodesArr() const
Definition: section.cxx:912
#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)