LibreOffice Module sw (master)  1
docsh.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 <officecfg/Office/Common.hxx>
23 #include <vcl/weld.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/syswin.hxx>
26 #include <vcl/jobset.hxx>
27 #include <svl/numformat.hxx>
28 #include <svl/whiter.hxx>
29 #include <svl/eitem.hxx>
30 #include <svl/stritem.hxx>
31 #include <svl/PasswordHelper.hxx>
33 #include <sfx2/bindings.hxx>
34 #include <sfx2/docfile.hxx>
35 #include <sfx2/docfilt.hxx>
37 #include <sfx2/printer.hxx>
38 #include <sfx2/linkmgr.hxx>
39 #include <editeng/flstitem.hxx>
40 #include <comphelper/lok.hxx>
41 #include <comphelper/classids.hxx>
42 #include <basic/sbmod.hxx>
43 #include <osl/diagnose.h>
44 #include <node.hxx>
45 #include <swwait.hxx>
46 #include <printdata.hxx>
47 #include <view.hxx>
48 #include <edtwin.hxx>
49 #include <PostItMgr.hxx>
50 #include <wrtsh.hxx>
51 #include <docsh.hxx>
52 #include <viewopt.hxx>
53 #include <wdocsh.hxx>
54 #include <swmodule.hxx>
55 #include <globdoc.hxx>
56 #include <usrpref.hxx>
57 #include <shellio.hxx>
58 #include <docstyle.hxx>
59 #include <doc.hxx>
60 #include <docfunc.hxx>
61 #include <IDocumentUndoRedo.hxx>
67 #include <IDocumentStatistics.hxx>
68 #include <IDocumentState.hxx>
69 #include <pview.hxx>
70 #include <srcview.hxx>
71 #include <ndindex.hxx>
72 #include <ndole.hxx>
73 #include <txtftn.hxx>
74 #include <ftnidx.hxx>
75 #include <fldbas.hxx>
76 #include <docary.hxx>
77 #include <swerror.h>
78 #include <cmdid.h>
79 #include <strings.hrc>
80 
81 #include <unotools/fltrcfg.hxx>
82 #include <sfx2/viewfrm.hxx>
83 #include <sfx2/objface.hxx>
84 
85 #define ShellClass_SwDocShell
86 #include <sfx2/msg.hxx>
87 #include <swslots.hxx>
88 #include <com/sun/star/document/UpdateDocMode.hpp>
89 
90 #include <com/sun/star/script/XLibraryContainer.hpp>
91 #include <com/sun/star/document/XDocumentProperties.hpp>
92 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
93 #include <com/sun/star/sdb/DatabaseContext.hpp>
94 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
95 #include <com/sun/star/uri/UriReferenceFactory.hpp>
96 #include <com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp>
97 #include <com/sun/star/frame/XStorable.hpp>
98 #include <ooo/vba/XSinkCaller.hpp>
99 
100 #include <unotextrange.hxx>
101 
102 #include <dbmgr.hxx>
103 #include <iodetect.hxx>
104 
106 
107 using namespace ::com::sun::star;
108 using namespace ::com::sun::star::uno;
109 using namespace ::com::sun::star::script;
110 using namespace ::com::sun::star::container;
111 
113 
114 void SwDocShell::InitInterface_Impl()
115 {
116 }
117 
118 
119 SFX_IMPL_OBJECTFACTORY(SwDocShell, SvGlobalName(SO3_SW_CLASSID), "swriter" )
120 
121 bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium,
122  uno::Reference<text::XTextRange> const& xInsertPosition)
123 {
124  SwUnoInternalPaM aPam(*GetDoc()); // must have doc since called from SwView
125  if (!::sw::XTextRangeToSwPaM(aPam, xInsertPosition))
126  return false;
127  // similar to SwView::InsertMedium
128  SwReaderPtr pReader;
129  Reader *const pRead = StartConvertFrom(rMedium, pReader, nullptr, &aPam);
130  if (!pRead)
131  return false;
132  ErrCode const nError = pReader->Read(*pRead);
133  return ERRCODE_NONE == nError;
134 }
135 
136 // Prepare loading
138  SwCursorShell const *pCursorShell,
139  SwPaM* pPaM )
140 {
141  bool bAPICall = false;
142  const SfxBoolItem* pApiItem;
143  const SfxItemSet* pMedSet = rMedium.GetItemSet();
144  if( pMedSet &&
145  (pApiItem = pMedSet->GetItemIfSet( FN_API_CALL )) )
146  bAPICall = pApiItem->GetValue();
147 
148  std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter();
149  if( !pFlt )
150  {
151  if(!bAPICall)
152  {
153  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
154  VclMessageType::Info, VclButtonsType::Ok,
155  SwResId(STR_CANTOPEN)));
156  xInfoBox->run();
157  }
158  return nullptr;
159  }
160  OUString aFileName( rMedium.GetName() );
161  Reader* pRead = SwReaderWriter::GetReader( pFlt->GetUserData() );
162  if( !pRead )
163  return nullptr;
164 
165  if( rMedium.IsStorage()
166  ? SwReaderType::Storage & pRead->GetReaderType()
167  : SwReaderType::Stream & pRead->GetReaderType() )
168  {
169  if (pPaM)
170  rpRdr.reset(new SwReader( rMedium, aFileName, *pPaM ));
171  else if (pCursorShell)
172  rpRdr.reset(new SwReader( rMedium, aFileName, *pCursorShell->GetCursor() ));
173  else
174  rpRdr.reset(new SwReader( rMedium, aFileName, m_xDoc.get() ));
175  }
176  else
177  return nullptr;
178 
179  // #i30171# set the UpdateDocMode at the SwDocShell
180  const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.GetItemSet(), SID_UPDATEDOCMODE, false);
181  m_nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE;
182 
183  if (!pFlt->GetDefaultTemplate().isEmpty())
184  pRead->SetTemplateName( pFlt->GetDefaultTemplate() );
185 
186  if( pRead == ReadAscii && nullptr != rMedium.GetInStream() &&
187  pFlt->GetUserData() == FILTER_TEXT_DLG )
188  {
189  SwAsciiOptions aOpt;
190  const SfxItemSet* pSet = rMedium.GetItemSet();
191  const SfxStringItem* pItem;
192  if( pSet &&
193  (pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
194  aOpt.ReadUserData( pItem->GetValue() );
195 
196  pRead->GetReaderOpt().SetASCIIOpts( aOpt );
197  }
198 
199  return pRead;
200 }
201 
202 // Loading
204 {
205  SwReaderPtr pRdr;
206  Reader* pRead = StartConvertFrom(rMedium, pRdr);
207  if (!pRead)
208  return false; // #129881# return if no reader is found
209  tools::SvRef<SotStorage> pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls
210 
211  m_xDoc->setDocAccTitle(OUString());
212  if (const auto pFrame1 = SfxViewFrame::GetFirst(this))
213  {
214  if (auto pSysWin = pFrame1->GetWindow().GetSystemWindow())
215  {
216  pSysWin->SetAccessibleName(OUString());
217  }
218  }
219  SwWait aWait( *this, true );
220 
221  // Suppress SfxProgress, when we are Embedded
222  SW_MOD()->SetEmbeddedLoadSave(
223  SfxObjectCreateMode::EMBEDDED == GetCreateMode() );
224 
225  pRdr->GetDoc().getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, dynamic_cast< const SwWebDocShell *>( this ) != nullptr);
226 
227  // Restore the pool default if reading a saved document.
228  m_xDoc->RemoveAllFormatLanguageDependencies();
229 
230  ErrCode nErr = pRdr->Read( *pRead );
231 
232  // Maybe put away one old Doc
233  if (m_xDoc.get() != &pRdr->GetDoc())
234  {
235  RemoveLink();
236  m_xDoc = &pRdr->GetDoc();
237 
238  AddLink();
239 
240  if (!m_xBasePool.is())
241  m_xBasePool = new SwDocStyleSheetPool( *m_xDoc, SfxObjectCreateMode::ORGANIZER == GetCreateMode() );
242  }
243 
244  UpdateFontList();
245  InitDrawModelAndDocShell(this, m_xDoc ? m_xDoc->getIDocumentDrawModelAccess().GetDrawModel() : nullptr);
246 
247  pRdr.reset();
248 
249  SW_MOD()->SetEmbeddedLoadSave( false );
250 
251  SetError(nErr);
252  bool bOk = !nErr.IsError();
253 
254  if (bOk && !m_xDoc->IsInLoadAsynchron())
255  {
256  LoadingFinished();
257  }
258 
259  pRead->setSotStorageRef(pStg); // #i45333# save sot storage ref in case of recursive calls
260 
261  return bOk;
262 }
263 
264 // Saving the Default-Format, Stg present
266 {
267  //#i3370# remove quick help to prevent saving of autocorrection suggestions
268  if (m_pView)
270  SwWait aWait( *this, true );
271 
272  CalcLayoutForOLEObjects(); // format for OLE objects
273  // #i62875#
274  // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
275  if (m_pWrtShell && m_xDoc &&
276  m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
278  {
279  m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
280  }
281 
282  ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
283  if( SfxObjectShell::Save() )
284  {
285  switch( GetCreateMode() )
286  {
287  case SfxObjectCreateMode::INTERNAL:
288  nErr = ERRCODE_NONE;
289  break;
290 
291  case SfxObjectCreateMode::ORGANIZER:
292  {
293  WriterRef xWrt;
294  ::GetXMLWriter(std::u16string_view(), GetMedium()->GetBaseURL(true), xWrt);
295  xWrt->SetOrganizerMode( true );
296  SwWriter aWrt( *GetMedium(), *m_xDoc );
297  nErr = aWrt.Write( xWrt );
298  xWrt->SetOrganizerMode( false );
299  }
300  break;
301 
302  case SfxObjectCreateMode::EMBEDDED:
303  // Suppress SfxProgress, if we are Embedded
304  SW_MOD()->SetEmbeddedLoadSave( true );
305  [[fallthrough]];
306 
307  case SfxObjectCreateMode::STANDARD:
308  default:
309  {
310  if (m_xDoc->ContainsMSVBasic())
311  {
313  nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) );
314  m_xDoc->SetContainsMSVBasic( false );
315  }
316 
317  // End TableBox Edit!
318  if (m_pWrtShell)
320 
321  WriterRef xWrt;
322  ::GetXMLWriter(std::u16string_view(), GetMedium()->GetBaseURL(true), xWrt);
323 
324  bool bLockedView(false);
325  if (m_pWrtShell)
326  {
327  bLockedView = m_pWrtShell->IsViewLocked();
328  m_pWrtShell->LockView( true ); //lock visible section
329  }
330 
331  SwWriter aWrt( *GetMedium(), *m_xDoc );
332  nErr = aWrt.Write( xWrt );
333 
334  if (m_pWrtShell)
335  m_pWrtShell->LockView( bLockedView );
336  }
337  break;
338  }
339  SW_MOD()->SetEmbeddedLoadSave( false );
340  }
341  SetError(nErr ? nErr : nVBWarning);
342 
343  SfxViewFrame *const pFrame =
344  m_pWrtShell ? m_pWrtShell->GetView().GetViewFrame() : nullptr;
345  if( pFrame )
346  {
347  pFrame->GetBindings().SetState(SfxBoolItem(SID_DOC_MODIFIED, false));
348  }
349  return !nErr.IsError();
350 }
351 
353 {
354  if (!pViewShell)
355  return;
356  for (SwViewShell& rShell : pViewShell->GetRingContainer())
357  {
358  if (!rShell.IsViewLocked())
359  {
360  m_aViewWasUnLocked.push_back(&rShell);
361  rShell.LockView(true);
362  }
363  }
364 }
365 
367 {
368  for (SwViewShell* pShell : m_aViewWasUnLocked)
369  pShell->LockView(false);
370 }
371 
372 std::unique_ptr<SfxObjectShell::LockAllViewsGuard> SwDocShell::LockAllViews()
373 {
374  return std::make_unique<LockAllViewsGuard_Impl>(GetEditShell());
375 }
376 
377 // Save using the Defaultformat
379 {
380  SwWait aWait( *this, true );
381  //#i3370# remove quick help to prevent saving of autocorrection suggestions
382  if (m_pView)
384 
385  //#i91811# mod if we have an active margin window, write back the text
386  if (m_pView &&
387  m_pView->GetPostItMgr() &&
389  {
391  }
392 
393  if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) &&
394  !m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS))
396 
397  if (GetMedium())
398  {
399  // Task 75666 - is the Document imported by our Microsoft-Filters?
400  std::shared_ptr<const SfxFilter> pOldFilter = GetMedium()->GetFilter();
401  if( pOldFilter &&
402  ( pOldFilter->GetUserData() == FILTER_WW8 ||
403  pOldFilter->GetUserData() == "CWW6" ||
404  pOldFilter->GetUserData() == "WW6" ) )
405  {
406  // when saving it in our own fileformat, then remove the template
407  // name from the docinfo.
408  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
409  GetModel(), uno::UNO_QUERY_THROW);
410  uno::Reference<document::XDocumentProperties> xDocProps
411  = xDPS->getDocumentProperties();
412  xDocProps->setTemplateName(OUString());
413  xDocProps->setTemplateURL(OUString());
414  xDocProps->setTemplateDate(::util::DateTime());
415  }
416  }
417 
418  CalcLayoutForOLEObjects(); // format for OLE objects
419 
420  const bool bURLChanged = GetMedium() && GetMedium()->GetURLObject() != rMedium.GetURLObject();
421  const SwDBManager* const pMgr = m_xDoc->GetDBManager();
422  const bool bHasEmbedded = pMgr && !pMgr->getEmbeddedName().isEmpty();
423  bool bSaveDS = bHasEmbedded && bURLChanged;
424  if (bSaveDS)
425  {
426  // Don't save data source in case a temporary is being saved for preview in MM wizard
427  if (const SfxBoolItem* pNoEmbDS
428  = SfxItemSet::GetItem(rMedium.GetItemSet(), SID_NO_EMBEDDED_DS, false))
429  bSaveDS = !pNoEmbDS->GetValue();
430  }
431  if (bSaveDS)
432  {
433  // We have an embedded data source definition, need to re-store it,
434  // otherwise relative references will break when the new file is in a
435  // different directory.
436 
437  OUString aURL(GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE));
438  if (aURL.isEmpty())
439  {
440  // No old URL - is this a new document created from a template with embedded DS?
441  // Try to get the template URL to reconstruct the embedded data source URL
442  const css::beans::PropertyValues& rArgs = GetMedium()->GetArgs();
443  const auto aURLIter = std::find_if(rArgs.begin(), rArgs.end(),
444  [](const auto& v) { return v.Name == "URL"; });
445  if (aURLIter != rArgs.end())
446  aURLIter->Value >>= aURL;
447  }
448 
449  if (!aURL.isEmpty())
450  {
452  auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(aURL);
453  assert(xUri.is());
454  xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)
455  ->createVndSunStarPkgUrlReference(xUri);
456  assert(xUri.is());
457  aURL = xUri->getUriReference() + "/"
460 
461  bool bCopyTo = GetCreateMode() == SfxObjectCreateMode::EMBEDDED;
462  if (!bCopyTo)
463  {
464  if (const SfxBoolItem* pSaveToItem
465  = SfxItemSet::GetItem(rMedium.GetItemSet(), SID_SAVETO, false))
466  bCopyTo = pSaveToItem->GetValue();
467  }
468 
469  auto xDatabaseContext = sdb::DatabaseContext::create(xContext);
470  uno::Reference<sdb::XDocumentDataSource> xDataSource(xDatabaseContext->getByName(aURL),
471  uno::UNO_QUERY);
472  if (xDataSource)
473  {
474  uno::Reference<frame::XStorable> xStorable(xDataSource->getDatabaseDocument(),
475  uno::UNO_QUERY);
477  pMgr->getEmbeddedName(), rMedium.GetName(),
478  bCopyTo);
479  }
480  }
481  }
482 
483  // #i62875#
484  // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
485  if (m_pWrtShell &&
486  m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
488  {
489  m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
490  }
491 
492  ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
493  uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage();
494  if( SfxObjectShell::SaveAs( rMedium ) )
495  {
496  if( GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) && dynamic_cast< const SwGlobalDocShell *>( this ) == nullptr )
497  {
498  // The document is closed explicitly, but using SfxObjectShellLock is still more correct here
499  SfxObjectShellLock xDocSh =
500  new SwGlobalDocShell( SfxObjectCreateMode::INTERNAL );
501  // the global document can not be a template
502  xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), false );
503  xDocSh->DoClose();
504  }
505 
506  if (m_xDoc->ContainsMSVBasic())
507  {
509  nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) );
510  m_xDoc->SetContainsMSVBasic( false );
511  }
512 
513  if (m_pWrtShell)
514  {
515  // End TableBox Edit!
517 
518  // Remove invalid signatures.
520 
522  }
523 
524  // Remember and preserve Modified-Flag without calling the Link
525  // (for OLE; after Statement from MM)
526  const bool bIsModified = m_xDoc->getIDocumentState().IsModified();
527  m_xDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition();
528  Link<bool,void> aOldOLELnk( m_xDoc->GetOle2Link() );
529  m_xDoc->SetOle2Link( Link<bool,void>() );
530 
531  // Suppress SfxProgress when we are Embedded
532  SW_MOD()->SetEmbeddedLoadSave(
533  SfxObjectCreateMode::EMBEDDED == GetCreateMode() );
534 
535  WriterRef xWrt;
536  ::GetXMLWriter(std::u16string_view(), rMedium.GetBaseURL(true), xWrt);
537 
538  bool bLockedView(false);
539  if (m_pWrtShell)
540  {
541  bLockedView = m_pWrtShell->IsViewLocked();
542  m_pWrtShell->LockView( true ); //lock visible section
543  }
544 
545  SwWriter aWrt( rMedium, *m_xDoc );
546  nErr = aWrt.Write( xWrt );
547 
548  if (m_pWrtShell)
549  m_pWrtShell->LockView( bLockedView );
550 
551  if( bIsModified )
552  {
553  m_xDoc->getIDocumentState().SetModified();
554  m_xDoc->GetIDocumentUndoRedo().UnLockUndoNoModifiedPosition();
555  }
556  m_xDoc->SetOle2Link( aOldOLELnk );
557 
558  SW_MOD()->SetEmbeddedLoadSave( false );
559 
560  // Increase RSID
561  m_xDoc->setRsid( m_xDoc->getRsid() );
562 
563  m_xDoc->cleanupUnoCursorTable();
564  }
565  SetError(nErr ? nErr : nVBWarning);
566 
567  return !nErr.IsError();
568 }
569 
570 // Save all Formats
571 static SwSrcView* lcl_GetSourceView( SwDocShell const * pSh )
572 {
573  // are we in SourceView?
574  SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( pSh );
575  SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : nullptr;
576  return dynamic_cast<SwSrcView*>( pViewShell );
577 }
578 
580 {
581  std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter();
582  if( !pFlt )
583  return false;
584 
585  WriterRef xWriter;
586  SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter );
587  if( !xWriter.is() )
588  { // Filter not available
589  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
590  VclMessageType::Info, VclButtonsType::Ok,
591  SwResId(STR_DLLNOTFOUND)));
592  xInfoBox->run();
593  return false;
594  }
595 
596  //#i3370# remove quick help to prevent saving of autocorrection suggestions
597  if (m_pView)
599 
600  //#i91811# mod if we have an active margin window, write back the text
601  if (m_pView &&
602  m_pView->GetPostItMgr() &&
604  {
606  }
607 
608  ErrCode nVBWarning = ERRCODE_NONE;
609 
610  if (m_xDoc->ContainsMSVBasic())
611  {
612  bool bSave = pFlt->GetUserData() == "CWW8"
614 
615  if ( bSave )
616  {
617  tools::SvRef<SotStorage> xStg = new SotStorage( rMedium.GetOutStream(), false );
618  OSL_ENSURE( !xStg->GetError(), "No storage available for storing VBA macros!" );
619  if ( !xStg->GetError() )
620  {
621  nVBWarning = SaveOrDelMSVBAStorage( static_cast<SfxObjectShell&>(*this), *xStg, bSave, "Macros" );
622  xStg->Commit();
623  m_xDoc->SetContainsMSVBasic( true );
624  }
625  }
626  }
627 
628  // End TableBox Edit!
629  if (m_pWrtShell)
631 
632  if( pFlt->GetUserData() == "HTML" )
633  {
634 #if HAVE_FEATURE_SCRIPTING
637  && HasBasic() )
638  {
639  uno::Reference< XLibraryContainer > xLibCont = GetBasicContainer();
640  uno::Reference< XNameAccess > xLib;
641  const Sequence<OUString> aNames = xLibCont->getElementNames();
642  for(const OUString& rName : aNames)
643  {
644  Any aLib = xLibCont->getByName(rName);
645  aLib >>= xLib;
646  if(xLib.is())
647  {
648  Sequence<OUString> aModNames = xLib->getElementNames();
649  if(aModNames.hasElements())
650  {
652  break;
653  }
654  }
655  }
656  }
657 #endif
658  }
659 
660  // #i76360# Update document statistics
661  if ( !rMedium.IsSkipImages() )
662  m_xDoc->getIDocumentStatistics().UpdateDocStat( false, true );
663 
664  CalcLayoutForOLEObjects(); // format for OLE objects
665  // #i62875#
666  // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
667  if (m_pWrtShell &&
668  m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
670  {
671  m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
672  }
673 
674  if( xWriter->IsStgWriter() &&
675  ( pFlt->GetUserData() == FILTER_XML ||
676  pFlt->GetUserData() == FILTER_XMLV ||
677  pFlt->GetUserData() == FILTER_XMLVW ) )
678  {
679  // determine the own Type
680  sal_uInt8 nMyType = 0;
681  if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
682  nMyType = 1;
683  else if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr )
684  nMyType = 2;
685 
686  // determine the desired Type
687  sal_uInt8 nSaveType = 0;
688  SotClipboardFormatId nSaveClipId = pFlt->GetFormat();
689  if( SotClipboardFormatId::STARWRITERWEB_8 == nSaveClipId ||
690  SotClipboardFormatId::STARWRITERWEB_60 == nSaveClipId ||
691  SotClipboardFormatId::STARWRITERWEB_50 == nSaveClipId ||
692  SotClipboardFormatId::STARWRITERWEB_40 == nSaveClipId )
693  nSaveType = 1;
694  else if( SotClipboardFormatId::STARWRITERGLOB_8 == nSaveClipId ||
695  SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE == nSaveClipId ||
696  SotClipboardFormatId::STARWRITERGLOB_60 == nSaveClipId ||
697  SotClipboardFormatId::STARWRITERGLOB_50 == nSaveClipId ||
698  SotClipboardFormatId::STARWRITERGLOB_40 == nSaveClipId )
699  nSaveType = 2;
700 
701  // Change Flags of the Document accordingly
705  if( nMyType != nSaveType )
706  {
709  if( 2 != nSaveType )
711  }
712 
713  // if the target format is storage based, then the output storage must be already created
714  if ( rMedium.IsStorage() )
715  {
716  // set MediaType on target storage
717  // (MediaType will be queried during SaveAs)
718  try
719  {
720  // TODO/MBA: testing
721  uno::Reference < beans::XPropertySet > xSet( rMedium.GetStorage(), uno::UNO_QUERY );
722  if ( xSet.is() )
723  xSet->setPropertyValue("MediaType", uno::Any( SotExchange::GetFormatMimeType( nSaveClipId ) ) );
724  }
725  catch (const uno::Exception&)
726  {
727  }
728  }
729 
730  // Now normally save the Document
731  bool bRet = SaveAs( rMedium );
732 
733  if( nMyType != nSaveType )
734  {
738  }
739 
740  return bRet;
741  }
742 
743  if( pFlt->GetUserData() == FILTER_TEXT_DLG &&
744  (m_pWrtShell || !::lcl_GetSourceView(this)))
745  {
746  SwAsciiOptions aOpt;
747  OUString sItemOpt;
748  const SfxItemSet* pSet = rMedium.GetItemSet();
749  if( nullptr != pSet )
750  {
751  if( const SfxStringItem* pItem = pSet->GetItemIfSet( SID_FILE_FILTEROPTIONS ) )
752  sItemOpt = pItem->GetValue();
753  }
754  if(!sItemOpt.isEmpty())
755  aOpt.ReadUserData( sItemOpt );
756 
757  xWriter->SetAsciiOptions( aOpt );
758  }
759 
760  // Suppress SfxProgress when we are Embedded
761  SW_MOD()->SetEmbeddedLoadSave(
762  SfxObjectCreateMode::EMBEDDED == GetCreateMode());
763 
764  // Span Context in order to suppress the Selection's View
765  ErrCode nErrno;
766  const OUString aFileName( rMedium.GetName() );
767 
768  // No View, so the whole Document!
770  {
771  SwWait aWait( *this, true );
772  // #i106906#
773  const bool bFormerLockView = m_pWrtShell->IsViewLocked();
774  m_pWrtShell->LockView( true );
776  m_pWrtShell->Push();
777  SwWriter aWrt( rMedium, *m_pWrtShell, true );
778  nErrno = aWrt.Write( xWriter, &aFileName );
779  //JP 16.05.97: In case the SFX revokes the View while saving
780  if (m_pWrtShell)
781  {
784  // #i106906#
785  m_pWrtShell->LockView( bFormerLockView );
786  }
787  }
788  else
789  {
790  // are we in SourceView?
791  SwSrcView* pSrcView = ::lcl_GetSourceView( this );
792  if( pSrcView )
793  {
794  pSrcView->SaveContentTo(rMedium);
795  nErrno = ERRCODE_NONE;
796  }
797  else
798  {
799  SwWriter aWrt( rMedium, *m_xDoc );
800  nErrno = aWrt.Write( xWriter, &aFileName );
801  }
802  }
803 
804  SW_MOD()->SetEmbeddedLoadSave( false );
805  SetError(nErrno ? nErrno : nVBWarning);
806  if( !rMedium.IsStorage() )
807  rMedium.CloseOutStream();
808 
809  return ! nErrno.IsError();
810 }
811 
812 // Hands off
813 // do not yet activate, must deliver TRUE
814 bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
815 {
816  bool bRet = SfxObjectShell::SaveCompleted( xStor );
817  if( bRet )
818  {
819  // Do not decide until here, whether Saving was successful or not
820  if( IsModified() )
821  m_xDoc->getIDocumentState().SetModified();
822  else
823  m_xDoc->getIDocumentState().ResetModified();
824  }
825 
826  if (m_pOLEChildList)
827  {
828  bool bResetModified = IsEnableSetModified();
829  if( bResetModified )
830  EnableSetModified( false );
831 
832  uno::Sequence < OUString > aNames = m_pOLEChildList->GetObjectNames();
833  for( sal_Int32 n = aNames.getLength(); n; n-- )
834  {
835  if (!m_pOLEChildList->MoveEmbeddedObject(aNames[n-1], GetEmbeddedObjectContainer()))
836  {
837  OSL_FAIL("Copying of objects didn't work!" );
838  }
839  }
840 
841  m_pOLEChildList.reset();
842  if( bResetModified )
844  }
845  return bRet;
846 }
847 
848 // Draw()-Override for OLE2 (Sfx)
849 void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
850  sal_uInt16 nAspect )
851 {
852  //fix #25341# Draw should not affect the Modified
853  bool bResetModified = IsEnableSetModified();
854  if ( bResetModified )
855  EnableSetModified( false );
856 
857  // When there is a JobSetup connected to the Document, we copy it to
858  // reconnect it after PrtOle2. We don't use an empty JobSetup because
859  // that would only lead to questionable results after expensive
860  // reformatting (Preview!)
861  std::unique_ptr<JobSetup> pOrig;
862  if ( !rSetup.GetPrinterName().isEmpty() && ASPECT_THUMBNAIL != nAspect )
863  {
864  const JobSetup* pCurrentJobSetup = m_xDoc->getIDocumentDeviceAccess().getJobsetup();
865  if( pCurrentJobSetup ) // then we copy that
866  pOrig.reset(new JobSetup( *pCurrentJobSetup ));
867  m_xDoc->getIDocumentDeviceAccess().setJobsetup( rSetup );
868  }
869 
870  tools::Rectangle aRect( nAspect == ASPECT_THUMBNAIL ?
871  GetVisArea( nAspect ) : GetVisArea( ASPECT_CONTENT ) );
872 
873  pDev->Push();
874  pDev->SetFillColor();
875  pDev->SetLineColor();
876  pDev->SetBackground();
877  const bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr;
878  SwPrintData aOpts;
879  SwViewShell::PrtOle2(m_xDoc.get(), SW_MOD()->GetUsrPref(bWeb), aOpts, *pDev, aRect);
880  pDev->Pop();
881 
882  if( pOrig )
883  {
884  m_xDoc->getIDocumentDeviceAccess().setJobsetup( *pOrig );
885  }
886  if ( bResetModified )
888 }
889 
891 {
892  tools::Rectangle aRect( rRect );
893  if (m_pView)
894  {
895  Size aSz( m_pView->GetDocSz() );
896  aSz.AdjustWidth(DOCUMENTBORDER ); aSz.AdjustHeight(DOCUMENTBORDER );
897  tools::Long nMoveX = 0, nMoveY = 0;
898  if ( aRect.Right() > aSz.Width() )
899  nMoveX = aSz.Width() - aRect.Right();
900  if ( aRect.Bottom() > aSz.Height() )
901  nMoveY = aSz.Height() - aRect.Bottom();
902  aRect.Move( nMoveX, nMoveY );
903  nMoveX = aRect.Left() < 0 ? -aRect.Left() : 0;
904  nMoveY = aRect.Top() < 0 ? -aRect.Top() : 0;
905  aRect.Move( nMoveX, nMoveY );
906 
907  // Calls SfxInPlaceObject::SetVisArea()!
908  m_pView->SetVisArea( aRect );
909  }
910  else
912 }
913 
914 tools::Rectangle SwDocShell::GetVisArea( sal_uInt16 nAspect ) const
915 {
916  if ( nAspect == ASPECT_THUMBNAIL )
917  {
918  // Preview: set VisArea to the first page.
919  SwNodeIndex aIdx( m_xDoc->GetNodes().GetEndOfExtras(), 1 );
920  SwContentNode* pNd = m_xDoc->GetNodes().GoNext( &aIdx );
921 
922  const SwRect aPageRect = pNd->FindPageFrameRect();
923  if (aPageRect.IsEmpty())
924  return tools::Rectangle();
925  tools::Rectangle aRect(aPageRect.SVRect());
926 
927  // tdf#81219 sanitize - nobody is interested in a thumbnail where's
928  // nothing visible
929  if (aRect.GetHeight() > 2*aRect.GetWidth())
930  aRect.SetSize(Size(aRect.GetWidth(), 2*aRect.GetWidth()));
931  else if (aRect.GetWidth() > 2*aRect.GetHeight())
932  aRect.SetSize(Size(2*aRect.GetHeight(), aRect.GetHeight()));
933 
934  return aRect;
935  }
936  return SfxObjectShell::GetVisArea( nAspect );
937 }
938 
940 {
941  return m_xDoc->getIDocumentDeviceAccess().getPrinter( false );
942 }
943 
945 {
946  return m_xDoc->getIDocumentDeviceAccess().getReferenceDevice( false );
947 }
948 
950 {
951  if ( pNewPrinter )
953  else
954  GetDoc()->getIDocumentDeviceAccess().setPrinter( nullptr, true, true );
955 }
956 
957 // #i20883# Digital Signatures and Encryption
959 {
960  // get global state like HiddenInformation::DOCUMENTVERSIONS
962 
963  if ( nStates & HiddenInformation::RECORDEDCHANGES )
964  {
965  if ( !GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty() )
966  nState |= HiddenInformation::RECORDEDCHANGES;
967  }
968  if ( nStates & HiddenInformation::NOTES )
969  {
970  OSL_ENSURE( GetWrtShell(), "No SwWrtShell, no information" );
971  if(GetWrtShell() && GetWrtShell()->GetFieldType(SwFieldIds::Postit, OUString())->HasHiddenInformationNotes())
972  nState |= HiddenInformation::NOTES;
973  }
974 
975  return nState;
976 }
977 
979 {
980  SfxWhichIter aIter(rSet);
981  sal_uInt16 nWhich = aIter.FirstWhich();
982 
983  while (nWhich)
984  {
985  switch (nWhich)
986  {
987  case SID_PRINTPREVIEW:
988  {
989  bool bDisable = IsInPlaceActive();
990  // Disable "multiple layout"
991  if ( !bDisable )
992  {
993  SfxViewFrame *pTmpFrame = SfxViewFrame::GetFirst(this);
994  while (pTmpFrame) // Look for Preview
995  {
996  if ( auto pSwView = dynamic_cast<SwView*>( pTmpFrame->GetViewShell() ) )
997  if (pSwView->GetWrtShell().GetViewOptions()->getBrowseMode())
998  {
999  bDisable = true;
1000  break;
1001  }
1002  pTmpFrame = SfxViewFrame::GetNext(*pTmpFrame, this);
1003  }
1004  }
1005  // End of disabled "multiple layout"
1006  if ( bDisable )
1007  rSet.DisableItem( SID_PRINTPREVIEW );
1008  else
1009  {
1010  SfxBoolItem aBool( SID_PRINTPREVIEW, false );
1011  if( dynamic_cast<SwPagePreview*>( SfxViewShell::Current()) )
1012  aBool.SetValue( true );
1013  rSet.Put( aBool );
1014  }
1015  }
1016  break;
1017  case SID_AUTO_CORRECT_DLG:
1019  rSet.DisableItem( SID_AUTO_CORRECT_DLG );
1020  break;
1021  case SID_SOURCEVIEW:
1022  {
1023  SfxViewShell* pCurrView = GetView() ? static_cast<SfxViewShell*>(GetView())
1025  bool bSourceView = dynamic_cast<SwSrcView*>( pCurrView ) != nullptr;
1026  rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
1027  }
1028  break;
1029  case SID_HTML_MODE:
1030  rSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
1031  break;
1032 
1034  case FN_OUTLINE_TO_IMPRESS:
1035  {
1036  SvtModuleOptions aMOpt;
1037  if (!aMOpt.IsImpress() || GetObjectShell()->isExportLocked())
1038  rSet.DisableItem( nWhich );
1039  }
1040  [[fallthrough]];
1041  case FN_ABSTRACT_NEWDOC:
1043  {
1044  if ( GetDoc()->GetNodes().GetOutLineNds().empty() )
1045  rSet.DisableItem( nWhich );
1046  }
1047  break;
1048  case SID_BROWSER_MODE:
1049  case FN_PRINT_LAYOUT:
1050  {
1052  if(FN_PRINT_LAYOUT == nWhich)
1053  bState = !bState;
1054  rSet.Put( SfxBoolItem( nWhich, bState));
1055  }
1056  break;
1057 
1058  case FN_NEW_GLOBAL_DOC:
1059  if (dynamic_cast<const SwGlobalDocShell*>(this) != nullptr
1061  rSet.DisableItem( nWhich );
1062  break;
1063 
1064  case FN_NEW_HTML_DOC:
1065  if (dynamic_cast<const SwWebDocShell*>(this) != nullptr
1067  rSet.DisableItem( nWhich );
1068  break;
1069 
1070  case FN_OPEN_FILE:
1071  if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
1072  rSet.DisableItem( nWhich );
1073  break;
1074 
1075  case SID_ATTR_YEAR2000:
1076  {
1077  const SvNumberFormatter* pFormatr = m_xDoc->GetNumberFormatter(false);
1078  rSet.Put( SfxUInt16Item( nWhich,
1079  static_cast< sal_uInt16 >(
1080  pFormatr ? pFormatr->GetYear2000()
1082  }
1083  break;
1084  case SID_ATTR_CHAR_FONTLIST:
1085  {
1086  rSet.Put( SvxFontListItem(m_pFontList.get(), SID_ATTR_CHAR_FONTLIST) );
1087  }
1088  break;
1089  case SID_MAIL_PREPAREEXPORT:
1090  {
1091  //check if linked content or possibly hidden content is available
1092  //m_xDoc->UpdateFields( NULL, false );
1093  sfx2::LinkManager& rLnkMgr = m_xDoc->getIDocumentLinksAdministration().GetLinkManager();
1094  const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
1095  bool bRet = false;
1096  if( !rLnks.empty() )
1097  bRet = true;
1098  else
1099  {
1100  //sections with hidden flag, hidden character attribute, hidden paragraph/text or conditional text fields
1101  bRet = m_xDoc->HasInvisibleContent();
1102  }
1103  rSet.Put( SfxBoolItem( nWhich, bRet ) );
1104  }
1105  break;
1106  case SID_NOTEBOOKBAR:
1107  {
1108  SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
1110  u"modules/swriter/ui/");
1111  rSet.Put( SfxBoolItem( SID_NOTEBOOKBAR, bVisible ) );
1112  }
1113  break;
1114  case FN_REDLINE_ACCEPT_ALL:
1115  case FN_REDLINE_REJECT_ALL:
1116  {
1117  if (GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty() ||
1118  HasChangeRecordProtection()) // tdf#128229 Disable Accept / Reject all if redlines are password protected
1119  rSet.DisableItem(nWhich);
1120  }
1121  break;
1122 
1123  default: OSL_ENSURE(false,"You cannot get here!");
1124 
1125  }
1126  nWhich = aIter.NextWhich();
1127  }
1128 }
1129 
1130 // OLE-Hdls
1131 IMPL_LINK( SwDocShell, Ole2ModifiedHdl, bool, bNewStatus, void )
1132 {
1133  if (m_pWrtShell)
1134  {
1135  SwOLENode* pOLENode = nullptr;
1136  if (!m_pWrtShell->IsTableMode())
1137  {
1138  pOLENode = m_pWrtShell->GetCursor()->GetNode().GetOLENode();
1139  }
1140  if (pOLENode)
1141  {
1142  if (pOLENode->GetOLEObj().IsProtected())
1143  {
1144  return;
1145  }
1146  }
1147  }
1148 
1149  if( IsEnableSetModified() )
1150  SetModified( bNewStatus );
1151 }
1152 
1153 // return Pool here, because virtual
1155 {
1156  return m_xBasePool.get();
1157 }
1158 
1160 {
1161  return m_pStyleManager.get();
1162 }
1163 
1165 {
1166  SetViewShell_Impl(pVw);
1167  m_pView = pVw;
1168  if (m_pView)
1169  {
1171 
1172  // Set view-specific redline author.
1173  const OUString& rRedlineAuthor = m_pView->GetRedlineAuthor();
1174  if (!rRedlineAuthor.isEmpty())
1175  SW_MOD()->SetRedlineAuthor(m_pView->GetRedlineAuthor());
1176  }
1177  else
1178  m_pWrtShell = nullptr;
1179 }
1180 
1181 // #i59688#
1182 // linked graphics are now loaded on demand.
1183 // Thus, loading of linked graphics no longer needed and necessary for
1184 // the load of document being finished.
1186 {
1187  // #i38810#
1188  // Original fix fails after integration of cws xmlsec11:
1189  // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
1190  // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
1191  // enables the document modification again.
1192  // Thus, manual modify the document, if it's modified and its links are updated
1193  // before <FinishedLoading(..)> is called.
1194  const bool bHasDocToStayModified( m_xDoc->getIDocumentState().IsModified() && m_xDoc->getIDocumentLinksAdministration().LinksUpdated() );
1195 
1196  FinishedLoading();
1197  SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
1198  if(pVFrame)
1199  {
1200  SfxViewShell* pShell = pVFrame->GetViewShell();
1201  if(auto pSrcView = dynamic_cast<SwSrcView*>( pShell) )
1202  pSrcView->Load(this);
1203  }
1204 
1205  // #i38810#
1206  if ( bHasDocToStayModified && !m_xDoc->getIDocumentState().IsModified() )
1207  {
1208  m_xDoc->getIDocumentState().SetModified();
1209  }
1210 }
1211 
1212 // a Transfer is cancelled (is called from SFX)
1214 {
1215  // Cancel all links from LinkManager
1216  m_xDoc->getIDocumentLinksAdministration().GetLinkManager().CancelTransfers();
1218 }
1219 
1221 {
1222  return m_pWrtShell;
1223 }
1224 
1226 {
1227  return m_pWrtShell;
1228 }
1229 
1231 {
1232  SwIterator<SwContentNode,SwFormatColl> aIter( *m_xDoc->GetDfltGrfFormatColl() );
1233  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
1234  {
1235  SwOLENode* pOLENd = pNd->GetOLENode();
1236  if( pOLENd && ( pOLENd->IsOLEObjectDeleted() ||
1237  pOLENd->IsInGlobalDocSection() ) )
1238  {
1239  if (!m_pOLEChildList)
1241 
1242  OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
1244  }
1245  }
1246 }
1247 
1248 // When a document is loaded, SwDoc::PrtOLENotify is called to update
1249 // the sizes of math objects. However, for objects that do not have a
1250 // SwFrame at this time, only a flag is set (bIsOLESizeInvalid) and the
1251 // size change takes place later, while calculating the layout in the
1252 // idle handler. If this document is saved now, it is saved with invalid
1253 // sizes. For this reason, the layout has to be calculated before a document is
1254 // saved, but of course only id there are OLE objects with bOLESizeInvalid set.
1256 {
1257  if (!m_pWrtShell)
1258  return;
1259 
1260  if (m_pView && m_pView->GetIPClient())
1261  {
1262  // We have an active OLE edit: allow link updates, so an up to date replacement graphic can
1263  // be created.
1265  rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
1266  }
1267 
1268  SwIterator<SwContentNode,SwFormatColl> aIter( *m_xDoc->GetDfltGrfFormatColl() );
1269  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
1270  {
1271  SwOLENode* pOLENd = pNd->GetOLENode();
1272  if( pOLENd && pOLENd->IsOLESizeInvalid() )
1273  {
1275  break;
1276  }
1277  }
1278 }
1279 
1280 // #i42634# Overwrites SfxObjectShell::UpdateLinks
1281 // This new function is necessary to trigger update of links in docs
1282 // read by the binary filter:
1284 {
1286  // #i50703# Update footnote numbers
1288  SwNodeIndex aTmp( GetDoc()->GetNodes() );
1289  GetDoc()->GetFootnoteIdxs().UpdateFootnote( aTmp );
1290 }
1291 
1292 uno::Reference< frame::XController >
1294 {
1295  css::uno::Reference< css::frame::XController > aRet;
1296  // #i82346# No view in page preview
1297  if ( GetView() )
1298  aRet = GetView()->GetController();
1299  return aRet;
1300 }
1301 
1302 static const char* s_EventNames[] =
1303 {
1304  "OnPageCountChange",
1305  "OnMailMerge",
1306  "OnMailMergeFinished",
1307  "OnFieldMerge",
1308  "OnFieldMergeFinished",
1309  "OnLayoutFinished"
1310 };
1311 sal_Int32 const s_nEvents(SAL_N_ELEMENTS(s_EventNames));
1312 
1314 {
1316  sal_Int32 nLen = aRet.getLength();
1317  aRet.realloc(nLen + 6);
1318  OUString* pNames = aRet.getArray();
1319  pNames[nLen++] = GetEventName(0);
1320  pNames[nLen++] = GetEventName(1);
1321  pNames[nLen++] = GetEventName(2);
1322  pNames[nLen++] = GetEventName(3);
1323  pNames[nLen++] = GetEventName(4);
1324  pNames[nLen] = GetEventName(5);
1325 
1326  return aRet;
1327 }
1328 
1329 OUString SwDocShell::GetEventName( sal_Int32 nIndex )
1330 {
1331  if (nIndex < s_nEvents)
1332  {
1333  return OUString::createFromAscii(s_EventNames[nIndex]);
1334  }
1335  return OUString();
1336 }
1337 
1338 const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
1339 {
1340  return m_xDoc ? &m_xDoc->GetXmlIdRegistry() : nullptr;
1341 }
1342 
1344 {
1345  if (!m_pWrtShell)
1346  return false;
1347  return bool(m_pWrtShell->GetRedlineFlags() & RedlineFlags::On);
1348 }
1349 
1351 {
1352  if (!m_pWrtShell)
1353  return false;
1354  return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
1355 }
1356 
1357 void SwDocShell::SetChangeRecording( bool bActivate, bool bLockAllViews )
1358 {
1359  RedlineFlags nOn = bActivate ? RedlineFlags::On : RedlineFlags::NONE;
1361  if (bLockAllViews)
1362  {
1363  // tdf#107870: prevent jumping to cursor
1364  auto aViewGuard(LockAllViews());
1366  }
1367  else
1368  {
1370  }
1371 }
1372 
1373 void SwDocShell::SetProtectionPassword( const OUString &rNewPassword )
1374 {
1375  const SfxAllItemSet aSet( GetPool() );
1376 
1378  Sequence< sal_Int8 > aPasswd = rIDRA.GetRedlinePassword();
1379  const SfxBoolItem* pRedlineProtectItem = aSet.GetItemIfSet(FN_REDLINE_PROTECT, false);
1380  if (pRedlineProtectItem
1381  && pRedlineProtectItem->GetValue() == aPasswd.hasElements())
1382  return;
1383 
1384  if (!rNewPassword.isEmpty())
1385  {
1386  // when password protection is applied change tracking must always be active
1387  SetChangeRecording( true );
1388 
1389  Sequence< sal_Int8 > aNewPasswd;
1390  SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword );
1391  rIDRA.SetRedlinePassword( aNewPasswd );
1392  }
1393  else
1394  {
1395  rIDRA.SetRedlinePassword( Sequence< sal_Int8 >() );
1396  }
1397 }
1398 
1399 bool SwDocShell::GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash )
1400 {
1401  bool bRes = false;
1402 
1403  const SfxAllItemSet aSet( GetPool() );
1404 
1406  const Sequence< sal_Int8 >& aPasswdHash( rIDRA.GetRedlinePassword() );
1407  const SfxBoolItem* pRedlineProtectItem = aSet.GetItemIfSet(FN_REDLINE_PROTECT, false);
1408  if (pRedlineProtectItem
1409  && pRedlineProtectItem->GetValue() == aPasswdHash.hasElements())
1410  return false;
1411  rPasswordHash = aPasswdHash;
1412  bRes = true;
1413 
1414  return bRes;
1415 }
1416 
1417 void SwDocShell::RegisterAutomationDocumentEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller)
1418 {
1420 }
1421 
1422 void SwDocShell::CallAutomationDocumentEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments)
1423 {
1425  mxAutomationDocumentEventsCaller->CallSinks(Method, Arguments);
1426 }
1427 
1428 void SwDocShell::RegisterAutomationDocumentObject(css::uno::Reference< ooo::vba::word::XDocument > const& xDocument)
1429 {
1430  mxAutomationDocumentObject = xDocument;
1431 }
1432 
1433 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SfxViewFrame * GetViewFrame() const
SFX_IMPL_SUPERCLASS_INTERFACE(DrawDocShell, SfxObjectShell)
bool GetValue() const
bool is() const
#define FN_ABSTRACT_NEWDOC
Definition: cmdid.h:448
#define FN_API_CALL
Definition: cmdid.h:563
const tools::SvRef< SotStorage > & getSotStorageRef() const
Definition: shellio.hxx:277
bool IsSkipImages() const
virtual void SetVisArea(const tools::Rectangle &rVisArea)
#define FN_REDLINE_ACCEPT_ALL
Definition: cmdid.h:150
virtual void OnDocumentPrinterChanged(Printer *pNewPrinter) override
Definition: docsh.cxx:949
URL aURL
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
virtual void SetModified(bool=true) override
Definition: docsh2.cxx:1419
#define FN_REDLINE_REJECT_ALL
Definition: cmdid.h:151
#define FN_NEW_GLOBAL_DOC
Definition: cmdid.h:68
bool bVisible
static const char * s_EventNames[]
Definition: docsh.cxx:1302
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
std::vector< SwViewShell * > m_aViewWasUnLocked
Definition: docsh.hxx:330
constexpr OUStringLiteral FILTER_TEXT_DLG
text filter with encoding dialog
Definition: iodetect.hxx:36
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false) override
Definition: docsh.cxx:1357
void SetState(const SfxItemSet &rSet)
#define ERR_SWG_WRITE_ERROR
Definition: swerror.h:30
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:715
void UpdateFontList()
Definition: docshini.cxx:414
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
virtual SAL_DLLPRIVATE bool ConvertTo(SfxMedium &rMedium) override
Definition: docsh.cxx:579
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
constexpr tools::Long Left() const
void GetXMLWriter([[maybe_unused]] std::u16string_view, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:581
sal_Int32 GetVersion() const
bool IsTableMode() const
Definition: crsrsh.hxx:648
std::unique_ptr< comphelper::EmbeddedObjectContainer > m_pOLEChildList
Definition: docsh.hxx:86
ErrCode GetError() const
const OUString & GetName() const
long Long
LockAllViewsGuard_Impl(SwViewShell *pViewShell)
Definition: docsh.cxx:352
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void StopQuickHelp()
Definition: edtwin.cxx:6024
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1949
sal_Int64 n
css::uno::Reference< css::frame::XModel3 > GetModel() const
css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationDocumentEventsCaller
Definition: docsh.hxx:94
const JobSetup & GetJobSetup() const
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
sal_uInt16 GetValue() const
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
static void PrtOle2(SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData &rOptions, vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: vprint.cxx:572
#define FN_ABSTRACT_STARIMPRESS
Definition: cmdid.h:449
sal_uInt16 FirstWhich()
virtual bool SaveCompleted(const css::uno::Reference< css::embed::XStorage > &xStorage)
virtual bool SaveAs(SfxMedium &rMedium)
virtual css::uno::Sequence< OUString > GetEventNames() override
Definition: docsh.cxx:1313
virtual std::unique_ptr< LockAllViewsGuard > LockAllViews() override
Definition: docsh.cxx:372
SwEditWin & GetEditWin()
Definition: view.hxx:416
const OUString & GetRedlineAuthor() const
Definition: viewprt.cxx:282
static void StoreEmbeddedDataSource(const css::uno::Reference< css::frame::XStorable > &xStorable, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &rStreamRelPath, const OUString &rOwnURL, bool bCopyTo=false)
Definition: dbmgr.cxx:2837
void SetViewShell_Impl(SfxViewShell *pView)
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
Definition: shellio.cxx:731
virtual const ::sfx2::IXmlIdRegistry * GetXmlIdRegistry() const override
Definition: docsh.cxx:1338
SwEditShell * GetEditShell()
Definition: docsh.cxx:1220
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void SetRedlineFlagsAndCheckInsMode(RedlineFlags eMode)
Definition: select.cxx:681
void LoadingFinished()
linked graphics are now loaded on demand.
Definition: docsh.cxx:1185
std::unique_ptr< sfx2::StyleManager > m_pStyleManager
Definition: docsh.hxx:76
void EndAllAction()
Definition: edws.cxx:97
virtual HiddenInformation GetHiddenInformationState(HiddenInformation nStates) override
#i20883# Digital Signatures and Encryption
Definition: docsh.cxx:958
virtual OutputDevice * GetDocumentRefDev() override
Definition: docsh.cxx:944
bool Commit()
sal_uInt16 NextWhich()
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
Definition: viewport.cxx:198
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
virtual void UpdateLinks() override
#i42634# Overwrites SfxObjectShell::UpdateLinks This new function is necessary to trigger update of l...
Definition: docsh.cxx:1283
RedlineFlags GetRedlineFlags() const
For Redlining.
Definition: edredln.cxx:27
void FinishedLoading(SfxLoadedFlags nWhich=SfxLoadedFlags::ALL)
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
void ReadUserData(std::u16string_view)
Definition: fltini.cxx:547
bool IsStorage()
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
void SetBackground()
void CallAutomationDocumentEventSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments)
Definition: docsh.cxx:1422
const SwView & GetView() const
Definition: wrtsh.hxx:437
virtual void CancelTransfers()
virtual bool Save()
Reader * GetReader(const OUString &rFltName)
Return reader based on the name.
Definition: fltini.cxx:169
SW_DLLPUBLIC void UpdateDataOnActiveSidebarWin()
Definition: PostItMgr.cxx:2385
virtual SAL_DLLPRIVATE bool SaveAs(SfxMedium &rMedium) override
Definition: docsh.cxx:378
void GetWriter(std::u16string_view rFltName, const OUString &rBaseURL, WriterRef &xRet)
Return writer based on the name.
Definition: fltini.cxx:159
constexpr OUStringLiteral FILTER_WW8
WinWord 97 filter.
Definition: iodetect.hxx:35
static SfxViewShell * Current()
SvStream * GetOutStream()
#define FILTER_XMLVW
XML filter.
Definition: iodetect.hxx:39
SotClipboardFormatId
RedlineFlags on.
SfxObjectCreateMode GetCreateMode() const
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2785
virtual sfx2::StyleManager * GetStyleManager() override
Definition: docsh.cxx:1159
bool IsEmpty() const
Definition: swrect.hxx:304
const OUString & GetCurrentPersistName() const
Definition: ndole.hxx:71
SfxItemPool & GetPool() const
virtual void SetProtectionPassword(const OUString &rPassword) override
Definition: docsh.cxx:1373
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
Definition: docsh.hxx:44
#define SAL_N_ELEMENTS(arr)
bool IsModified() const
virtual void CancelTransfers() override
Cancel transfer (called from SFX).
Definition: docsh.cxx:1213
virtual void UpdateLinks()=0
#i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks() to new SwDoc::UpdateLink...
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:727
void SetLineColor()
void SetView(SwView *pVw)
Set View for actions via Shell.
Definition: docsh.cxx:1164
virtual SAL_DLLPRIVATE void Draw(OutputDevice *, const JobSetup &, sal_uInt16 nAspect) override
OLE-stuff.
Definition: docsh.cxx:849
bool IsProtected() const
Definition: ndole.cxx:911
static SvtFilterOptions & Get()
#define SW_MOD()
Definition: swmodule.hxx:255
void CloseOutStream()
const SvBaseLinks & GetLinks() const
virtual css::uno::Sequence< OUString > GetEventNames()
bool EndAllTableBoxEdit()
Definition: trvltbl.cxx:916
void InitDrawModelAndDocShell(SwDocShell *pSwDocShell, SwDrawModel *pSwDrawDocument)
Definition: docshdrw.cxx:32
virtual SfxObjectShell * GetObjectShell() override
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2248
SAL_DLLPRIVATE void RemoveLink()
Definition: docshini.cxx:429
virtual Printer * GetDocumentPrinter() override
Definition: docsh.cxx:939
void SetSize(const Size &rSize)
SfxBindings & GetBindings()
const OUString & GetValue() const
sal_Int32 const s_nEvents(SAL_N_ELEMENTS(s_EventNames))
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
constexpr tools::Long Right() const
void SetFillColor()
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1154
float u
OUString GetBaseURL(bool bForSaving=false)
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
bool HasBasic() const
constexpr tools::Long Top() const
SfxItemSet * GetItemSet() const
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
Marks a node in the document model.
Definition: ndindex.hxx:30
void RegisterAutomationDocumentObject(css::uno::Reference< ooo::vba::word::XDocument > const &xDocument)
Definition: docsh.cxx:1428
virtual void setJobsetup(const JobSetup &rJobSetup)=0
Sets the Jobsetup.
rtl::Reference< SwDoc > m_xDoc
Document.
Definition: docsh.hxx:71
ring_container GetRingContainer()
Definition: ring.hxx:240
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:137
std::unique_ptr< FontList > m_pFontList
Current Fontlist.
Definition: docsh.hxx:73
const tools::Rectangle & GetVisArea() const
virtual HiddenInformation GetHiddenInformationState(HiddenInformation nStates)
const css::uno::Sequence< css::beans::PropertyValue > & GetArgs() const
static OUString GetFormatMimeType(SotClipboardFormatId nFormat)
#define ASPECT_CONTENT
SAL_DLLPRIVATE void CalcLayoutForOLEObjects()
Definition: docsh.cxx:1255
const std::shared_ptr< const SfxFilter > & GetFilter() const
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
SfxViewShell * GetViewShell() const
void SetValue(bool const bTheValue)
Reader * ReadAscii
Definition: fltini.cxx:46
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
static SwSrcView * lcl_GetSourceView(SwDocShell const *pSh)
Definition: docsh.cxx:571
#define FN_OPEN_FILE
Definition: cmdid.h:69
bool IsOLEObjectDeleted() const
Definition: ndole.cxx:504
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2366
constexpr tools::Long Bottom() const
sal_uInt16 GetYear2000() const
rtl::Reference< SfxStyleSheetBasePool > m_xBasePool
Passing through for formats.
Definition: docsh.hxx:72
bool isExportLocked() const
static bool StateMethod(SfxBindings &rBindings, std::u16string_view rUIFile, bool bReloadNotebookbar=false)
bool IsError() const
bool IsImpress() const
float v
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
static void SetUniqueSeqRefNo(SwDoc &rDoc)
Set a unique sequential reference number for every footnote in the document.
Definition: atrftn.cxx:559
const Size & GetDocSz() const
Definition: view.hxx:453
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool AllDrawObjsOnPage(SwDoc &p_rDoc)
method to check, if given Writer document contains only drawing objects, which are completely on its ...
Definition: docdraw.cxx:637
SvStream * GetInStream()
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
SfxInPlaceClient * GetIPClient() const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
void SaveContentTo(SfxMedium &rMed)
Definition: srcview.cxx:219
OUString const & GetPrinterName() const
SFX_IMPL_OBJECTFACTORY(DrawDocShell, SvGlobalName(SO3_SIMPRESS_CLASSID),"simpress") void DrawDocShell
void DisableItem(sal_uInt16 nWhich)
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
static bool IsHeadlessModeEnabled()
SwView * m_pView
For "historical reasons" nothing can be done without the WrtShell.
Definition: docsh.hxx:83
void RegisterAutomationDocumentEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const &xCaller)
Definition: docsh.cxx:1417
#define ERRCODE_NONE
unsigned char sal_uInt8
void LockView(bool b)
Definition: viewsh.hxx:467
css::uno::Reference< css::frame::XController > GetController()
Definition: docsh.cxx:1293
#define FN_OUTLINE_TO_CLIPBOARD
Definition: cmdid.h:72
bool IsInPlaceActive() const
virtual bool HasChangeRecordProtection() const override
Definition: docsh.cxx:1350
#define FN_PRINT_LAYOUT
Definition: cmdid.h:173
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
SwNodes & GetNodes()
Definition: doc.hxx:408
tools::Long AdjustWidth(tools::Long n)
SwWrtShell * m_pWrtShell
Definition: docsh.hxx:84
void ValidateAllParagraphSignatures(bool updateDontRemove)
Validate all paragraph signatures.
Definition: edfcol.cxx:1853
#define WARN_SWG_HTML_NO_MACROS
Definition: swerror.h:41
bool IsLoadWordBasicStorage() const
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:639
const INetURLObject & GetURLObject() const
void setSotStorageRef(const tools::SvRef< SotStorage > &pStgRef)
Definition: shellio.hxx:278
virtual bool IsChangeRecording() const override
passwword protection for Writer (derived from SfxObjectShell) see also: FN_REDLINE_ON, FN_REDLINE_ON
Definition: docsh.cxx:1343
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::embed::XStorage > GetOutputStorage()
virtual void SetVisArea(const tools::Rectangle &rRect) override
OLE-stuff.
Definition: docsh.cxx:890
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual SAL_DLLPRIVATE bool ConvertFrom(SfxMedium &rMedium) override
Definition: docsh.cxx:203
static OUString GetEventName(sal_Int32 nId)
Definition: docsh.cxx:1329
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
Definition: docsh.cxx:1225
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
bool IsEnableSetModified() const
bool IsOLESizeInvalid() const
Definition: ndole.hxx:136
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
virtual bool GetProtectionHash(css::uno::Sequence< sal_Int8 > &rPasswordHash) override
Definition: docsh.cxx:1399
void SetupStorage(const css::uno::Reference< css::embed::XStorage > &xStorage, sal_Int32 nVersion, bool bTemplate) const
sal_Int16 m_nUpdateDocMode
contains the css::document::UpdateDocMode
Definition: docsh.hxx:87
const SwView * GetView() const
Definition: docsh.hxx:221
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
Definition: docshini.cxx:395
void EnableSetModified(bool bEnable=true)
virtual SAL_DLLPRIVATE bool SaveCompleted(const css::uno::Reference< css::embed::XStorage > &xStorage) override
Definition: docsh.cxx:814
constexpr OUStringLiteral FILTER_XML
XML filter.
Definition: iodetect.hxx:37
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
SAL_DLLPRIVATE void RemoveOLEObjects()
Definition: docsh.cxx:1230
#define FILTER_XMLV
XML filter.
Definition: iodetect.hxx:38
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
HiddenInformation
IMPL_LINK(SwDocShell, Ole2ModifiedHdl, bool, bNewStatus, void)
Definition: docsh.cxx:1131
void ClassifyDocPerHighestParagraphClass()
Ensure that the classification of the doc is never lower than the paragraph with the highest classifi...
Definition: edfcol.cxx:2134
sal_Int32 nState
bool MoveEmbeddedObject(const OUString &rName, EmbeddedObjectContainer &)
#define ASPECT_THUMBNAIL
void SetError(ErrCode rErr)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
virtual bool Save() override
global IO.
Definition: docsh.cxx:265
bool IsViewLocked() const
Definition: viewsh.hxx:466
no RedlineFlags
#define FN_NEW_HTML_DOC
Definition: cmdid.h:74
Definition: view.hxx:144
#define FN_OUTLINE_TO_IMPRESS
Definition: cmdid.h:71
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
css::uno::Reference< css::frame::XController > GetController() const
css::uno::Reference< ooo::vba::word::XDocument > mxAutomationDocumentObject
Definition: docsh.hxx:95
void GetState(SfxItemSet &)
Definition: docsh.cxx:978
bool m_bDetectedRangeSegmentation false
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3158
bool IsInGlobalDocSection() const
Definition: ndole.cxx:470
SfxMedium * GetMedium() const
static OUString encode(std::u16string_view rText, Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)