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(), UNO_QUERY);
653  uno::Reference< XNameAccess > xLib;
654  Sequence<OUString> aNames = xLibCont->getElementNames();
655  const OUString* pNames = aNames.getConstArray();
656  for(sal_Int32 nLib = 0; nLib < aNames.getLength(); nLib++)
657  {
658  Any aLib = xLibCont->getByName(pNames[nLib]);
659  aLib >>= xLib;
660  if(xLib.is())
661  {
662  Sequence<OUString> aModNames = xLib->getElementNames();
663  if(aModNames.hasElements())
664  {
666  break;
667  }
668  }
669  }
670  }
671 #endif
672  }
673 
674  // #i76360# Update document statistics
675  if ( !rMedium.IsSkipImages() )
676  m_xDoc->getIDocumentStatistics().UpdateDocStat( false, true );
677 
678  CalcLayoutForOLEObjects(); // format for OLE objects
679  // #i62875#
680  // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
681  if (m_pWrtShell &&
682  m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
684  {
685  m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
686  }
687 
688  if( xWriter->IsStgWriter() &&
689  ( pFlt->GetUserData() == FILTER_XML ||
690  pFlt->GetUserData() == FILTER_XMLV ||
691  pFlt->GetUserData() == FILTER_XMLVW ) )
692  {
693  // determine the own Type
694  sal_uInt8 nMyType = 0;
695  if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
696  nMyType = 1;
697  else if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr )
698  nMyType = 2;
699 
700  // determine the desired Type
701  sal_uInt8 nSaveType = 0;
702  SotClipboardFormatId nSaveClipId = pFlt->GetFormat();
703  if( SotClipboardFormatId::STARWRITERWEB_8 == nSaveClipId ||
704  SotClipboardFormatId::STARWRITERWEB_60 == nSaveClipId ||
705  SotClipboardFormatId::STARWRITERWEB_50 == nSaveClipId ||
706  SotClipboardFormatId::STARWRITERWEB_40 == nSaveClipId )
707  nSaveType = 1;
708  else if( SotClipboardFormatId::STARWRITERGLOB_8 == nSaveClipId ||
709  SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE == nSaveClipId ||
710  SotClipboardFormatId::STARWRITERGLOB_60 == nSaveClipId ||
711  SotClipboardFormatId::STARWRITERGLOB_50 == nSaveClipId ||
712  SotClipboardFormatId::STARWRITERGLOB_40 == nSaveClipId )
713  nSaveType = 2;
714 
715  // Change Flags of the Document accordingly
719  if( nMyType != nSaveType )
720  {
723  if( 2 != nSaveType )
725  }
726 
727  // if the target format is storage based, then the output storage must be already created
728  if ( rMedium.IsStorage() )
729  {
730  // set MediaType on target storage
731  // (MediaType will be queried during SaveAs)
732  try
733  {
734  // TODO/MBA: testing
735  uno::Reference < beans::XPropertySet > xSet( rMedium.GetStorage(), uno::UNO_QUERY );
736  if ( xSet.is() )
737  xSet->setPropertyValue("MediaType", uno::makeAny( SotExchange::GetFormatMimeType( nSaveClipId ) ) );
738  }
739  catch (const uno::Exception&)
740  {
741  }
742  }
743 
744  // Now normally save the Document
745  bool bRet = SaveAs( rMedium );
746 
747  if( nMyType != nSaveType )
748  {
752  }
753 
754  return bRet;
755  }
756 
757  if( pFlt->GetUserData() == FILTER_TEXT_DLG &&
758  (m_pWrtShell || !::lcl_GetSourceView(this)))
759  {
760  SwAsciiOptions aOpt;
761  OUString sItemOpt;
762  const SfxItemSet* pSet;
763  const SfxPoolItem* pItem;
764  if( nullptr != ( pSet = rMedium.GetItemSet() ) )
765  {
766  if( SfxItemState::SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS,
767  true, &pItem ) )
768  sItemOpt = static_cast<const SfxStringItem*>(pItem)->GetValue();
769  }
770  if(!sItemOpt.isEmpty())
771  aOpt.ReadUserData( sItemOpt );
772 
773  xWriter->SetAsciiOptions( aOpt );
774  }
775 
776  // Suppress SfxProgress when we are Embedded
777  SW_MOD()->SetEmbeddedLoadSave(
778  SfxObjectCreateMode::EMBEDDED == GetCreateMode());
779 
780  // Span Context in order to suppress the Selection's View
781  ErrCode nErrno;
782  const OUString aFileName( rMedium.GetName() );
783 
784  // No View, so the whole Document!
786  {
787  SwWait aWait( *this, true );
788  // #i106906#
789  const bool bFormerLockView = m_pWrtShell->IsViewLocked();
790  m_pWrtShell->LockView( true );
792  m_pWrtShell->Push();
793  SwWriter aWrt( rMedium, *m_pWrtShell, true );
794  nErrno = aWrt.Write( xWriter, &aFileName );
795  //JP 16.05.97: In case the SFX revokes the View while saving
796  if (m_pWrtShell)
797  {
800  // #i106906#
801  m_pWrtShell->LockView( bFormerLockView );
802  }
803  }
804  else
805  {
806  // are we in SourceView?
807  SwSrcView* pSrcView = ::lcl_GetSourceView( this );
808  if( pSrcView )
809  {
810  pSrcView->SaveContentTo(rMedium);
811  nErrno = ERRCODE_NONE;
812  }
813  else
814  {
815  SwWriter aWrt( rMedium, *m_xDoc );
816  nErrno = aWrt.Write( xWriter, &aFileName );
817  }
818  }
819 
820  SW_MOD()->SetEmbeddedLoadSave( false );
821  SetError(nErrno ? nErrno : nVBWarning);
822  if( !rMedium.IsStorage() )
823  rMedium.CloseOutStream();
824 
825  return ! nErrno.IsError();
826 }
827 
828 // Hands off
829 // do not yet activate, must deliver TRUE
830 bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
831 {
832  bool bRet = SfxObjectShell::SaveCompleted( xStor );
833  if( bRet )
834  {
835  // Do not decide until here, whether Saving was successful or not
836  if( IsModified() )
837  m_xDoc->getIDocumentState().SetModified();
838  else
839  m_xDoc->getIDocumentState().ResetModified();
840  }
841 
842  if (m_pOLEChildList)
843  {
844  bool bResetModified = IsEnableSetModified();
845  if( bResetModified )
846  EnableSetModified( false );
847 
848  uno::Sequence < OUString > aNames = m_pOLEChildList->GetObjectNames();
849  for( sal_Int32 n = aNames.getLength(); n; n-- )
850  {
851  if (!m_pOLEChildList->MoveEmbeddedObject(aNames[n-1], GetEmbeddedObjectContainer()))
852  {
853  OSL_FAIL("Copying of objects didn't work!" );
854  }
855  }
856 
857  m_pOLEChildList.reset();
858  if( bResetModified )
860  }
861  return bRet;
862 }
863 
864 // Draw()-Override for OLE2 (Sfx)
865 void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
866  sal_uInt16 nAspect )
867 {
868  //fix #25341# Draw should not affect the Modified
869  bool bResetModified = IsEnableSetModified();
870  if ( bResetModified )
871  EnableSetModified( false );
872 
873  // When there is a JobSetup connected to the Document, we copy it to
874  // reconnect it after PrtOle2. We don't use an empty JobSetup because
875  // that would only lead to questionable results after expensive
876  // reformatting (Preview!)
877  std::unique_ptr<JobSetup> pOrig;
878  if ( !rSetup.GetPrinterName().isEmpty() && ASPECT_THUMBNAIL != nAspect )
879  {
880  const JobSetup* pCurrentJobSetup = m_xDoc->getIDocumentDeviceAccess().getJobsetup();
881  if( pCurrentJobSetup ) // then we copy that
882  pOrig.reset(new JobSetup( *pCurrentJobSetup ));
883  m_xDoc->getIDocumentDeviceAccess().setJobsetup( rSetup );
884  }
885 
886  tools::Rectangle aRect( nAspect == ASPECT_THUMBNAIL ?
887  GetVisArea( nAspect ) : GetVisArea( ASPECT_CONTENT ) );
888 
889  pDev->Push();
890  pDev->SetFillColor();
891  pDev->SetLineColor();
892  pDev->SetBackground();
893  const bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr;
894  SwPrintData aOpts;
895  SwViewShell::PrtOle2(m_xDoc.get(), SW_MOD()->GetUsrPref(bWeb), aOpts, *pDev, aRect);
896  pDev->Pop();
897 
898  if( pOrig )
899  {
900  m_xDoc->getIDocumentDeviceAccess().setJobsetup( *pOrig );
901  }
902  if ( bResetModified )
904 }
905 
907 {
908  tools::Rectangle aRect( rRect );
909  if (m_pView)
910  {
911  Size aSz( m_pView->GetDocSz() );
912  aSz.AdjustWidth(DOCUMENTBORDER ); aSz.AdjustHeight(DOCUMENTBORDER );
913  long nMoveX = 0, nMoveY = 0;
914  if ( aRect.Right() > aSz.Width() )
915  nMoveX = aSz.Width() - aRect.Right();
916  if ( aRect.Bottom() > aSz.Height() )
917  nMoveY = aSz.Height() - aRect.Bottom();
918  aRect.Move( nMoveX, nMoveY );
919  nMoveX = aRect.Left() < 0 ? -aRect.Left() : 0;
920  nMoveY = aRect.Top() < 0 ? -aRect.Top() : 0;
921  aRect.Move( nMoveX, nMoveY );
922 
923  // Calls SfxInPlaceObject::SetVisArea()!
924  m_pView->SetVisArea( aRect );
925  }
926  else
928 }
929 
930 tools::Rectangle SwDocShell::GetVisArea( sal_uInt16 nAspect ) const
931 {
932  if ( nAspect == ASPECT_THUMBNAIL )
933  {
934  // Preview: set VisArea to the first page.
935  SwNodeIndex aIdx( m_xDoc->GetNodes().GetEndOfExtras(), 1 );
936  SwContentNode* pNd = m_xDoc->GetNodes().GoNext( &aIdx );
937 
938  const SwRect aPageRect = pNd->FindPageFrameRect();
939  if (aPageRect.IsEmpty())
940  return tools::Rectangle();
941  tools::Rectangle aRect(aPageRect.SVRect());
942 
943  // tdf#81219 sanitize - nobody is interested in a thumbnail where's
944  // nothing visible
945  if (aRect.GetHeight() > 2*aRect.GetWidth())
946  aRect.SetSize(Size(aRect.GetWidth(), 2*aRect.GetWidth()));
947  else if (aRect.GetWidth() > 2*aRect.GetHeight())
948  aRect.SetSize(Size(2*aRect.GetHeight(), aRect.GetHeight()));
949 
950  return aRect;
951  }
952  return SfxObjectShell::GetVisArea( nAspect );
953 }
954 
956 {
957  return m_xDoc->getIDocumentDeviceAccess().getPrinter( false );
958 }
959 
961 {
962  return m_xDoc->getIDocumentDeviceAccess().getReferenceDevice( false );
963 }
964 
966 {
967  if ( pNewPrinter )
969  else
970  GetDoc()->getIDocumentDeviceAccess().setPrinter( nullptr, true, true );
971 }
972 
973 // #i20883# Digital Signatures and Encryption
975 {
976  // get global state like HiddenInformation::DOCUMENTVERSIONS
978 
979  if ( nStates & HiddenInformation::RECORDEDCHANGES )
980  {
981  if ( !GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty() )
982  nState |= HiddenInformation::RECORDEDCHANGES;
983  }
984  if ( nStates & HiddenInformation::NOTES )
985  {
986  OSL_ENSURE( GetWrtShell(), "No SwWrtShell, no information" );
987  if ( GetWrtShell() )
988  {
989  SwFieldType* pType = GetWrtShell()->GetFieldType(SwFieldIds::Postit, OUString());
991  SwFormatField* pFirst = aIter.First();
992  while( pFirst )
993  {
994  if( pFirst->GetTextField() && pFirst->IsFieldInDoc() )
995  {
996  nState |= HiddenInformation::NOTES;
997  break;
998  }
999  pFirst = aIter.Next();
1000  }
1001  }
1002  }
1003 
1004  return nState;
1005 }
1006 
1008 {
1009  SfxWhichIter aIter(rSet);
1010  sal_uInt16 nWhich = aIter.FirstWhich();
1011 
1012  while (nWhich)
1013  {
1014  switch (nWhich)
1015  {
1016  case SID_PRINTPREVIEW:
1017  {
1018  bool bDisable = IsInPlaceActive();
1019  // Disable "multiple layout"
1020  if ( !bDisable )
1021  {
1022  SfxViewFrame *pTmpFrame = SfxViewFrame::GetFirst(this);
1023  while (pTmpFrame) // Look for Preview
1024  {
1025  if ( dynamic_cast<SwView*>( pTmpFrame->GetViewShell() ) &&
1026  static_cast<SwView*>(pTmpFrame->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() )
1027  {
1028  bDisable = true;
1029  break;
1030  }
1031  pTmpFrame = SfxViewFrame::GetNext(*pTmpFrame, this);
1032  }
1033  }
1034  // End of disabled "multiple layout"
1035  if ( bDisable )
1036  rSet.DisableItem( SID_PRINTPREVIEW );
1037  else
1038  {
1039  SfxBoolItem aBool( SID_PRINTPREVIEW, false );
1040  if( dynamic_cast<SwPagePreview*>( SfxViewShell::Current()) )
1041  aBool.SetValue( true );
1042  rSet.Put( aBool );
1043  }
1044  }
1045  break;
1046  case SID_SOURCEVIEW:
1047  {
1048  SfxViewShell* pCurrView = GetView() ? static_cast<SfxViewShell*>(GetView())
1050  bool bSourceView = dynamic_cast<SwSrcView*>( pCurrView ) != nullptr;
1051  rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
1052  }
1053  break;
1054  case SID_HTML_MODE:
1055  rSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
1056  break;
1057 
1059  case FN_OUTLINE_TO_IMPRESS:
1060  {
1061  SvtModuleOptions aMOpt;
1062  if ( !aMOpt.IsImpress() )
1063  rSet.DisableItem( nWhich );
1064  }
1065  [[fallthrough]];
1066  case FN_ABSTRACT_NEWDOC:
1068  {
1069  if ( GetDoc()->GetNodes().GetOutLineNds().empty() )
1070  rSet.DisableItem( nWhich );
1071  }
1072  break;
1073  case SID_BROWSER_MODE:
1074  case FN_PRINT_LAYOUT:
1075  {
1077  if(FN_PRINT_LAYOUT == nWhich)
1078  bState = !bState;
1079  rSet.Put( SfxBoolItem( nWhich, bState));
1080  }
1081  break;
1082 
1083  case FN_NEW_GLOBAL_DOC:
1084  if ( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr )
1085  rSet.DisableItem( nWhich );
1086  break;
1087 
1088  case FN_NEW_HTML_DOC:
1089  if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
1090  rSet.DisableItem( nWhich );
1091  break;
1092 
1093  case FN_OPEN_FILE:
1094  if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr )
1095  rSet.DisableItem( nWhich );
1096  break;
1097 
1098  case SID_ATTR_YEAR2000:
1099  {
1100  const SvNumberFormatter* pFormatr = m_xDoc->GetNumberFormatter(false);
1101  rSet.Put( SfxUInt16Item( nWhich,
1102  static_cast< sal_uInt16 >(
1103  pFormatr ? pFormatr->GetYear2000()
1104  : ::utl::MiscCfg().GetYear2000() )));
1105  }
1106  break;
1107  case SID_ATTR_CHAR_FONTLIST:
1108  {
1109  rSet.Put( SvxFontListItem(m_pFontList.get(), SID_ATTR_CHAR_FONTLIST) );
1110  }
1111  break;
1112  case SID_MAIL_PREPAREEXPORT:
1113  {
1114  //check if linked content or possibly hidden content is available
1115  //m_xDoc->UpdateFields( NULL, false );
1116  sfx2::LinkManager& rLnkMgr = m_xDoc->getIDocumentLinksAdministration().GetLinkManager();
1117  const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
1118  bool bRet = false;
1119  if( !rLnks.empty() )
1120  bRet = true;
1121  else
1122  {
1123  //sections with hidden flag, hidden character attribute, hidden paragraph/text or conditional text fields
1124  bRet = m_xDoc->HasInvisibleContent();
1125  }
1126  rSet.Put( SfxBoolItem( nWhich, bRet ) );
1127  }
1128  break;
1129  case SID_NOTEBOOKBAR:
1130  {
1131  SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
1132  bool bVisible = sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame()->GetBindings(),
1133  "modules/swriter/ui/");
1134  rSet.Put( SfxBoolItem( SID_NOTEBOOKBAR, bVisible ) );
1135  }
1136  break;
1137  case FN_REDLINE_ACCEPT_ALL:
1138  case FN_REDLINE_REJECT_ALL:
1139  {
1140  if (GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty())
1141  rSet.DisableItem(nWhich);
1142  }
1143  break;
1144 
1145  default: OSL_ENSURE(false,"You cannot get here!");
1146 
1147  }
1148  nWhich = aIter.NextWhich();
1149  }
1150 }
1151 
1152 // OLE-Hdls
1153 IMPL_LINK( SwDocShell, Ole2ModifiedHdl, bool, bNewStatus, void )
1154 {
1155  if( IsEnableSetModified() )
1156  SetModified( bNewStatus );
1157 }
1158 
1159 // return Pool here, because virtual
1161 {
1162  return m_xBasePool.get();
1163 }
1164 
1166 {
1167  return m_pStyleManager.get();
1168 }
1169 
1171 {
1172  SetViewShell_Impl(pVw);
1173  m_pView = pVw;
1174  if (m_pView)
1175  {
1177 
1178  // Set view-specific redline author.
1179  const OUString& rRedlineAuthor = m_pView->GetRedlineAuthor();
1180  if (!rRedlineAuthor.isEmpty())
1181  SW_MOD()->SetRedlineAuthor(m_pView->GetRedlineAuthor());
1182  }
1183  else
1184  m_pWrtShell = nullptr;
1185 }
1186 
1187 // #i59688#
1188 // linked graphics are now loaded on demand.
1189 // Thus, loading of linked graphics no longer needed and necessary for
1190 // the load of document being finished.
1192 {
1193  // #i38810#
1194  // Original fix fails after integration of cws xmlsec11:
1195  // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
1196  // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
1197  // enables the document modification again.
1198  // Thus, manual modify the document, if it's modified and its links are updated
1199  // before <FinishedLoading(..)> is called.
1200  const bool bHasDocToStayModified( m_xDoc->getIDocumentState().IsModified() && m_xDoc->getIDocumentLinksAdministration().LinksUpdated() );
1201 
1202  FinishedLoading();
1203  SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
1204  if(pVFrame)
1205  {
1206  SfxViewShell* pShell = pVFrame->GetViewShell();
1207  if(auto pSrcView = dynamic_cast<SwSrcView*>( pShell) )
1208  pSrcView->Load(this);
1209  }
1210 
1211  // #i38810#
1212  if ( bHasDocToStayModified && !m_xDoc->getIDocumentState().IsModified() )
1213  {
1214  m_xDoc->getIDocumentState().SetModified();
1215  }
1216 }
1217 
1218 void SwDocShell::SetFormatSpecificCompatibilityOptions( const OUString& rFilterTypeName )
1219 {
1220  //Enable MS Word-compatibility trailing blanks option for MS Word files
1221  if ( rFilterTypeName == "writer_MS_Word_95" ||
1222  rFilterTypeName == "writer_MS_Word_97" ||
1223  rFilterTypeName == "writer_MS_Word_2003_XML" ||
1224  rFilterTypeName == "writer_MS_Word_2007" ||
1225  rFilterTypeName == "writer_MS_Word_2007_Template" ||
1226  rFilterTypeName == "writer_Rich_Text_Format" )
1227  {
1229  }
1230 }
1231 
1232 // a Transfer is cancelled (is called from SFX)
1234 {
1235  // Cancel all links from LinkManager
1236  m_xDoc->getIDocumentLinksAdministration().GetLinkManager().CancelTransfers();
1238 }
1239 
1241 {
1242  return m_pWrtShell;
1243 }
1244 
1246 {
1247  return m_pWrtShell;
1248 }
1249 
1251 {
1252  SwIterator<SwContentNode,SwFormatColl> aIter( *m_xDoc->GetDfltGrfFormatColl() );
1253  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
1254  {
1255  SwOLENode* pOLENd = pNd->GetOLENode();
1256  if( pOLENd && ( pOLENd->IsOLEObjectDeleted() ||
1257  pOLENd->IsInGlobalDocSection() ) )
1258  {
1259  if (!m_pOLEChildList)
1261 
1262  OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
1264  }
1265  }
1266 }
1267 
1268 // When a document is loaded, SwDoc::PrtOLENotify is called to update
1269 // the sizes of math objects. However, for objects that do not have a
1270 // SwFrame at this time, only a flag is set (bIsOLESizeInvalid) and the
1271 // size change takes place later, while calculating the layout in the
1272 // idle handler. If this document is saved now, it is saved with invalid
1273 // sizes. For this reason, the layout has to be calculated before a document is
1274 // saved, but of course only id there are OLE objects with bOLESizeInvalid set.
1276 {
1277  if (!m_pWrtShell)
1278  return;
1279 
1280  SwIterator<SwContentNode,SwFormatColl> aIter( *m_xDoc->GetDfltGrfFormatColl() );
1281  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
1282  {
1283  SwOLENode* pOLENd = pNd->GetOLENode();
1284  if( pOLENd && pOLENd->IsOLESizeInvalid() )
1285  {
1287  break;
1288  }
1289  }
1290 }
1291 
1292 // #i42634# Overwrites SfxObjectShell::UpdateLinks
1293 // This new function is necessary to trigger update of links in docs
1294 // read by the binary filter:
1296 {
1298  // #i50703# Update footnote numbers
1300  SwNodeIndex aTmp( GetDoc()->GetNodes() );
1301  GetDoc()->GetFootnoteIdxs().UpdateFootnote( aTmp );
1302 }
1303 
1304 uno::Reference< frame::XController >
1306 {
1307  css::uno::Reference< css::frame::XController > aRet;
1308  // #i82346# No view in page preview
1309  if ( GetView() )
1310  aRet = GetView()->GetController();
1311  return aRet;
1312 }
1313 
1314 static const char* s_EventNames[] =
1315 {
1316  "OnPageCountChange",
1317  "OnMailMerge",
1318  "OnMailMergeFinished",
1319  "OnFieldMerge",
1320  "OnFieldMergeFinished",
1321  "OnLayoutFinished"
1322 };
1323 static sal_Int32 const s_nEvents(SAL_N_ELEMENTS(s_EventNames));
1324 
1326 {
1328  sal_Int32 nLen = aRet.getLength();
1329  aRet.realloc(nLen + 6);
1330  OUString* pNames = aRet.getArray();
1331  pNames[nLen++] = GetEventName(0);
1332  pNames[nLen++] = GetEventName(1);
1333  pNames[nLen++] = GetEventName(2);
1334  pNames[nLen++] = GetEventName(3);
1335  pNames[nLen++] = GetEventName(4);
1336  pNames[nLen] = GetEventName(5);
1337 
1338  return aRet;
1339 }
1340 
1341 OUString SwDocShell::GetEventName( sal_Int32 nIndex )
1342 {
1343  if (nIndex < s_nEvents)
1344  {
1345  return OUString::createFromAscii(s_EventNames[nIndex]);
1346  }
1347  return OUString();
1348 }
1349 
1350 const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
1351 {
1352  return m_xDoc ? &m_xDoc->GetXmlIdRegistry() : nullptr;
1353 }
1354 
1356 {
1357  if (!m_pWrtShell)
1358  return false;
1359  return bool(m_pWrtShell->GetRedlineFlags() & RedlineFlags::On);
1360 }
1361 
1363 {
1364  if (!m_pWrtShell)
1365  return false;
1366  return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
1367 }
1368 
1369 void SwDocShell::SetChangeRecording( bool bActivate )
1370 {
1371  RedlineFlags nOn = bActivate ? RedlineFlags::On : RedlineFlags::NONE;
1374 }
1375 
1376 void SwDocShell::SetProtectionPassword( const OUString &rNewPassword )
1377 {
1378  const SfxAllItemSet aSet( GetPool() );
1379  const SfxPoolItem* pItem = nullptr;
1380 
1382  Sequence< sal_Int8 > aPasswd = rIDRA.GetRedlinePassword();
1383  if (SfxItemState::SET == aSet.GetItemState(FN_REDLINE_PROTECT, false, &pItem)
1384  && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements())
1385  return;
1386 
1387  if (!rNewPassword.isEmpty())
1388  {
1389  // when password protection is applied change tracking must always be active
1390  SetChangeRecording( true );
1391 
1392  Sequence< sal_Int8 > aNewPasswd;
1393  SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword );
1394  rIDRA.SetRedlinePassword( aNewPasswd );
1395  }
1396  else
1397  {
1399  }
1400 }
1401 
1402 bool SwDocShell::GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash )
1403 {
1404  bool bRes = false;
1405 
1406  const SfxAllItemSet aSet( GetPool() );
1407  const SfxPoolItem* pItem = nullptr;
1408 
1410  const Sequence< sal_Int8 >& aPasswdHash( rIDRA.GetRedlinePassword() );
1411  if (SfxItemState::SET == aSet.GetItemState(FN_REDLINE_PROTECT, false, &pItem)
1412  && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswdHash.hasElements())
1413  return false;
1414  rPasswordHash = aPasswdHash;
1415  bRes = true;
1416 
1417  return bRes;
1418 }
1419 
1420 void SwDocShell::RegisterAutomationDocumentEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller)
1421 {
1423 }
1424 
1425 void SwDocShell::CallAutomationDocumentEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments)
1426 {
1428  mxAutomationDocumentEventsCaller->CallSinks(Method, Arguments);
1429 }
1430 
1431 void SwDocShell::RegisterAutomationDocumentObject(css::uno::Reference< ooo::vba::word::XDocument > const& xDocument)
1432 {
1433  mxAutomationDocumentObject = xDocument;
1434 }
1435 
1436 /* 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
bool IsSkipImages()
void GetXMLWriter(const OUString &, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:570
#define FN_ABSTRACT_NEWDOC
Definition: cmdid.h:417
#define FN_API_CALL
Definition: cmdid.h:529
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:965
bool IsStarBasic() const
virtual void SetModified(bool=true) override
Definition: docsh2.cxx:1406
#define FN_REDLINE_REJECT_ALL
Definition: cmdid.h:144
#define FN_NEW_GLOBAL_DOC
Definition: cmdid.h:60
static const char * s_EventNames[]
Definition: docsh.cxx:1314
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:185
virtual void SetChangeRecording(bool bActivate) override
Definition: docsh.cxx:1369
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:157
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
long AdjustWidth(long n)
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:110
void SetState(const SfxItemSet &rSet)
#define ERR_SWG_WRITE_ERROR
Definition: swerror.h:30
std::string GetValue
static bool StateMethod(SfxBindings &rBindings, const OUString &rUIFile)
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:734
void UpdateFontList()
Definition: docshini.cxx:432
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:5812
sal_Int32 GetYear2000() const
bool IsStarBasicWarning() const
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1690
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:418
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:1325
SwEditWin & GetEditWin()
Definition: view.hxx:403
virtual void SetFormatSpecificCompatibilityOptions(const OUString &rFilterTypeName) override
Definition: docsh.cxx:1218
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:2947
void SetViewShell_Impl(SfxViewShell *pView)
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
Definition: shellio.cxx:743
virtual const ::sfx2::IXmlIdRegistry * GetXmlIdRegistry() const override
Definition: docsh.cxx:1350
SwEditShell * GetEditShell()
Definition: docsh.cxx:1240
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:1191
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:974
virtual OutputDevice * GetDocumentRefDev() override
Definition: docsh.cxx:960
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:1295
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:1425
const SwView & GetView() const
Definition: wrtsh.hxx:424
virtual void CancelTransfers()
const OUString & GetRedlineAuthor()
Definition: viewprt.cxx:296
virtual bool Save()
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:89
bool getBrowseMode() const
Definition: viewopt.hxx:426
Reader * GetReader(const OUString &rFltName)
Return reader based on the name.
Definition: fltini.cxx:187
SW_DLLPUBLIC void UpdateDataOnActiveSidebarWin()
Definition: PostItMgr.cxx:2304
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:2596
virtual sfx2::StyleManager * GetStyleManager() override
Definition: docsh.cxx:1165
bool IsEmpty() const
Definition: swrect.hxx:294
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:1031
const OUString & GetCurrentPersistName() const
Definition: ndole.hxx:69
SfxItemPool & GetPool() const
virtual void SetProtectionPassword(const OUString &rPassword) override
Definition: docsh.cxx:1376
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
Definition: docsh.hxx:44
static SvxHtmlOptions & Get()
#define SAL_N_ELEMENTS(arr)
virtual void CancelTransfers() override
Cancel transfer (called from SFX).
Definition: docsh.cxx:1233
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:202
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:1170
virtual SAL_DLLPRIVATE void Draw(OutputDevice *, const JobSetup &, sal_uInt16 nAspect) override
OLE-stuff.
Definition: docsh.cxx:865
static SvtFilterOptions & Get()
#define SW_MOD()
Definition: swmodule.hxx:255
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:919
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:2143
SAL_DLLPRIVATE void RemoveLink()
Definition: docshini.cxx:447
virtual Printer * GetDocumentPrinter() override
Definition: docsh.cxx:955
void SetSize(const Size &rSize)
SfxBindings & GetBindings()
TElementType * First()
Definition: calbck.hxx:345
std::vector< SwViewShell * > m_aViewWasUnLocked
Definition: docsh.hxx:326
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:339
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:1160
long Bottom() const
OUString GetBaseURL(bool bForSaving=false)
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:223
bool HasBasic() const
SfxItemSet * GetItemSet() const
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:1431
virtual void setJobsetup(const JobSetup &rJobSetup)=0
Sets the Jobsetup.
css::uno::Reference< css::frame::XController > GetController()
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:1275
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:488
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2285
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
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:1420
#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:1305
#define FN_OUTLINE_TO_CLIPBOARD
Definition: cmdid.h:64
#define FILTER_XML
XML filter.
Definition: iodetect.hxx:35
virtual bool HasChangeRecordProtection() const override
Definition: docsh.cxx:1362
#define FN_PRINT_LAYOUT
Definition: cmdid.h:166
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:208
SwNodes & GetNodes()
Definition: doc.hxx:403
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:621
const INetURLObject & GetURLObject() const
void setSotStorageRef(const tools::SvRef< SotStorage > &pStgRef)
Definition: shellio.hxx:270
virtual bool IsChangeRecording() const override
passwword protection for Writer (derived from SfxObjectShell) see also: FN_REDLINE_ON, FN_REDLINE_ON
Definition: docsh.cxx:1355
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::embed::XStorage > GetOutputStorage()
virtual void SetVisArea(const tools::Rectangle &rRect) override
OLE-stuff.
Definition: docsh.cxx:906
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:1341
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
Definition: docsh.cxx:1245
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:129
bool IsInPlaceActive()
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:628
virtual bool GetProtectionHash(css::uno::Sequence< sal_Int8 > &rPasswordHash) override
Definition: docsh.cxx:1402
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:219
SAL_DLLPRIVATE void AddLink()
Methods for access to doc.
Definition: docshini.cxx:413
void EnableSetModified(bool bEnable=true)
virtual SAL_DLLPRIVATE bool SaveCompleted(const css::uno::Reference< css::embed::XStorage > &xStorage) override
Definition: docsh.cxx:830
const tools::SvRef< SotStorage > & getSotStorageRef()
Definition: shellio.hxx:269
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
SAL_DLLPRIVATE void RemoveOLEObjects()
Definition: docsh.cxx:1250
#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:1153
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< ooo::vba::word::XDocument > mxAutomationDocumentObject
Definition: docsh.hxx:95
void GetState(SfxItemSet &)
Definition: docsh.cxx:1007
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3267
bool IsInGlobalDocSection() const
Definition: ndole.cxx:454
SfxMedium * GetMedium() const