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