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