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