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