LibreOffice Module sw (master)  1
ndole.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 <com/sun/star/container/XChild.hpp>
21 #include <com/sun/star/embed/XEmbeddedObject.hpp>
22 #include <com/sun/star/embed/XEmbedPersist.hpp>
23 #include <com/sun/star/embed/XLinkageSupport.hpp>
24 #include <com/sun/star/embed/EmbedMisc.hpp>
25 #include <com/sun/star/embed/EmbedStates.hpp>
26 #include <com/sun/star/util/XModifiable.hpp>
27 #include <com/sun/star/chart2/XChartDocument.hpp>
28 #include <cppuhelper/implbase.hxx>
29 
30 #include <sot/exchange.hxx>
31 #include <tools/globname.hxx>
32 #include <hintids.hxx>
33 #include <sfx2/docfile.hxx>
34 #include <sfx2/app.hxx>
35 #include <sfx2/linkmgr.hxx>
36 #include <unotools/configitem.hxx>
37 #include <vcl/outdev.hxx>
38 #include <fmtanchr.hxx>
39 #include <frmfmt.hxx>
40 #include <doc.hxx>
41 #include <docsh.hxx>
42 #include <pam.hxx>
43 #include <section.hxx>
44 #include <cntfrm.hxx>
45 #include <frmatr.hxx>
46 #include <ndole.hxx>
47 #include <viewsh.hxx>
51 #include <comphelper/classids.hxx>
52 #include <vcl/graph.hxx>
53 #include <sot/formats.hxx>
54 #include <vcl/svapp.hxx>
55 #include <vcl/graphicfilter.hxx>
56 #include <strings.hrc>
57 #include <svx/charthelper.hxx>
59 #include <atomic>
60 #include <deque>
61 #include <libxml/xmlwriter.h>
62 
63 using namespace utl;
64 using namespace com::sun::star::uno;
65 using namespace com::sun::star;
66 
68  : private utl::ConfigItem
69 {
70 private:
71  typedef std::deque<SwOLEObj *> OleObjects_t;
72  OleObjects_t m_OleObjects;
73  sal_Int32 m_nLRU_InitSize;
74  static uno::Sequence< OUString > GetPropertyNames();
75 
76  virtual void ImplCommit() override;
77 
78 public:
79  SwOLELRUCache();
80 
81  virtual void Notify( const uno::Sequence<
82  OUString>& aPropertyNames ) override;
83  void Load();
84 
85  void InsertObj( SwOLEObj& rObj );
86  void RemoveObj( SwOLEObj& rObj );
87 };
88 
89 static std::shared_ptr<SwOLELRUCache> g_pOLELRU_Cache;
90 
91 class SwOLEListener_Impl : public ::cppu::WeakImplHelper< embed::XStateChangeListener >
92 {
94 public:
95  explicit SwOLEListener_Impl( SwOLEObj* pObj );
96  void dispose();
97  virtual void SAL_CALL changingState( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) override;
98  virtual void SAL_CALL stateChanged( const lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) override;
99  virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) override;
100 };
101 
103 : mpObj( pObj )
104 {
105  if ( mpObj->IsOleRef() && mpObj->GetOleRef()->getCurrentState() == embed::EmbedStates::RUNNING )
106  {
107  g_pOLELRU_Cache->InsertObj( *mpObj );
108  }
109 }
110 
111 void SAL_CALL SwOLEListener_Impl::changingState( const lang::EventObject&, ::sal_Int32 , ::sal_Int32 )
112 {
113 }
114 
115 void SAL_CALL SwOLEListener_Impl::stateChanged( const lang::EventObject&, ::sal_Int32 nOldState, ::sal_Int32 nNewState )
116 {
117  if ( mpObj && nOldState == embed::EmbedStates::LOADED && nNewState == embed::EmbedStates::RUNNING )
118  {
119  if (!g_pOLELRU_Cache)
120  g_pOLELRU_Cache.reset(new SwOLELRUCache);
121  g_pOLELRU_Cache->InsertObj( *mpObj );
122  }
123  else if ( mpObj && nNewState == embed::EmbedStates::LOADED && nOldState == embed::EmbedStates::RUNNING )
124  {
125  if (g_pOLELRU_Cache)
126  g_pOLELRU_Cache->RemoveObj( *mpObj );
127  }
128  else if(mpObj && nNewState == embed::EmbedStates::RUNNING)
129  {
131  }
132 }
133 
135 {
136  if (mpObj && g_pOLELRU_Cache)
137  g_pOLELRU_Cache->RemoveObj( *mpObj );
138  mpObj = nullptr;
139 }
140 
141 void SAL_CALL SwOLEListener_Impl::disposing( const lang::EventObject& )
142 {
143  if (mpObj && g_pOLELRU_Cache)
144  g_pOLELRU_Cache->RemoveObj( *mpObj );
145 }
146 
147 // TODO/LATER: actually SwEmbedObjectLink should be used here, but because different objects are used to control
148 // embedded object different link objects with the same functionality had to be implemented
149 
151 {
153 
154 public:
155  explicit SwEmbedObjectLink(SwOLENode* pNode);
156 
157  virtual void Closed() override;
158  virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
159  const OUString& rMimeType, const css::uno::Any & rValue ) override;
160 
161  void Connect() { GetRealObject(); }
162 };
163 
165  ::sfx2::SvBaseLink( ::SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::SVXB ),
166  pOleNode(pNode)
167 {
168  SetSynchron( false );
169 }
170 
172  const OUString&, const uno::Any& )
173 {
174  if ( !pOleNode->UpdateLinkURL_Impl() )
175  {
176  // the link URL was not changed
177  uno::Reference< embed::XEmbeddedObject > xObject = pOleNode->GetOLEObj().GetOleRef();
178  OSL_ENSURE( xObject.is(), "The object must exist always!" );
179  if ( xObject.is() )
180  {
181  // let the object reload the link
182  // TODO/LATER: reload call could be used for this case
183 
184  try
185  {
186  sal_Int32 nState = xObject->getCurrentState();
187  if ( nState != embed::EmbedStates::LOADED )
188  {
189  // in some cases the linked file probably is not locked so it could be changed
190  xObject->changeState( embed::EmbedStates::LOADED );
191  xObject->changeState( nState );
192  }
193  }
194  catch (const uno::Exception&)
195  {
196  }
197  }
198  }
199 
201  pOleNode->SetChanged();
202 
203  return SUCCESS;
204 }
205 
207 {
209  SvBaseLink::Closed();
210 }
211 
213  const svt::EmbeddedObjectRef& xObj,
214  SwGrfFormatColl *pGrfColl,
215  SwAttrSet const * pAutoAttr ) :
216  SwNoTextNode( rWhere, SwNodeType::Ole, pGrfColl, pAutoAttr ),
217  maOLEObj( xObj ),
218  mbOLESizeInvalid( false ),
219  mpObjectLink( nullptr )
220 {
221  maOLEObj.SetNode( this );
222 }
223 
225  const OUString &rString,
226  sal_Int64 nAspect,
227  SwGrfFormatColl *pGrfColl,
228  SwAttrSet const * pAutoAttr ) :
229  SwNoTextNode( rWhere, SwNodeType::Ole, pGrfColl, pAutoAttr ),
230  maOLEObj( rString, nAspect ),
231  mbOLESizeInvalid( false ),
232  mpObjectLink( nullptr )
233 {
234  maOLEObj.SetNode( this );
235 }
236 
238 {
240 }
241 
243 {
244  if ( maOLEObj.GetOleRef().is() )
245  return maOLEObj.m_xOLERef.GetGraphic();
246  return nullptr;
247 }
248 
253 {
254  OSL_ENSURE( maOLEObj.GetOleRef().is(), "No object to restore!" );
255  if ( maOLEObj.m_xOLERef.is() )
256  {
257  // If a SvPersist instance already exists, we use it
258  SfxObjectShell* p = GetDoc()->GetPersist();
259  if( !p )
260  {
261  // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
262  // What happens to this document?
263  OSL_ENSURE( false, "Why are we creating a DocShell here?" );
264  p = new SwDocShell( GetDoc(), SfxObjectCreateMode::INTERNAL );
265  p->DoInitNew();
266  }
267 
268  uno::Reference < container::XChild > xChild( maOLEObj.m_xOLERef.GetObject(), uno::UNO_QUERY );
269  if ( xChild.is() )
270  xChild->setParent( p->GetModel() );
271 
272  OSL_ENSURE( !maOLEObj.m_aName.isEmpty(), "No object name!" );
273  OUString aObjName;
275  {
276  if ( xChild.is() )
277  xChild->setParent( nullptr );
278  OSL_FAIL( "InsertObject failed" );
279  }
280  else
281  {
282  maOLEObj.m_aName = aObjName;
285  }
286  }
287 
288  return true;
289 }
290 
292 {
293  xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLENode"));
294  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
295  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
296  BAD_CAST(OString::number(GetIndex()).getStr()));
297 
298  GetOLEObj().dumpAsXml(pWriter);
299 
300  xmlTextWriterEndElement(pWriter);
301 }
302 
307 {
308  if( maOLEObj.m_xOLERef.is() )
309  {
311 
312 #if OSL_DEBUG_LEVEL > 0
313  SfxObjectShell* p = GetDoc()->GetPersist();
314  OSL_ENSURE( p, "No document!" );
315  if( p )
316  {
318  OSL_ENSURE( !pCnt || &rCnt == pCnt, "The helper is assigned to unexpected container!" );
319  }
320 #endif
321 
322  if ( pCnt && pCnt->HasEmbeddedObject( maOLEObj.m_aName ) )
323  {
324  uno::Reference < container::XChild > xChild( maOLEObj.m_xOLERef.GetObject(), uno::UNO_QUERY );
325  if ( xChild.is() )
326  xChild->setParent( nullptr );
327 
328  /*
329  #i119941
330  When cut or move the chart, SwUndoFlyBase::DelFly will call SaveSection
331  to store the content to storage. In this step, chart filter functions
332  will be called. And chart filter will call chart core functions to create
333  the chart again. Then chart core function will call the class
334  ExplicitCategoryProvider to create data source. In this step, when SW data
335  source provider create the data source, a UnoActionRemoveContext
336  will mess with the layout and create a new SwFlyFrame.
337  But later in SwUndoFlyBase::DelFly, it will clear anchor related attributes
338  of SwFlyFrame. Then finally null pointer occur.
339  Resolution:
340  In pCnt->RemoveEmbeddedObject in SaveSection process of table chart,
341  only remove the object from the object container, without removing it's
342  storage and graphic stream. The chart already removed from formatter.
343  */
344  bool bKeepObjectToTempStorage = true;
345  uno::Reference < embed::XEmbeddedObject > xIP = GetOLEObj().GetOleRef();
346  if (IsChart() && !msChartTableName.isEmpty()
348  {
349  uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
350  if (xChart.is() && !xChart->hasInternalDataProvider())
351  {
352  bKeepObjectToTempStorage = false;
353  }
354  }
355 
356  pCnt->RemoveEmbeddedObject( maOLEObj.m_aName, bKeepObjectToTempStorage );
357 
358  // TODO/LATER: aOLEObj.aName has no meaning here, since the undo container contains the object
359  // by different name, in future it might makes sense that the name is transported here.
361  try
362  {
363  // "unload" object
364  maOLEObj.m_xOLERef->changeState( embed::EmbedStates::LOADED );
365  }
366  catch (const uno::Exception&)
367  {
368  }
369  }
370  }
371 
373 
374  return true;
375 }
376 
378  const svt::EmbeddedObjectRef& xObj,
379  SwGrfFormatColl* pGrfColl )
380 {
381  OSL_ENSURE( pGrfColl,"SwNodes::MakeOLENode: Formatpointer is 0." );
382 
383  SwOLENode *pNode =
384  new SwOLENode( rWhere, xObj, pGrfColl, nullptr );
385 
386  // set parent if XChild is supported
388  uno::Reference< container::XChild > xChild( pNode->GetOLEObj().GetObject().GetObject(), UNO_QUERY );
389  if (xChild.is())
390  {
391  SwDocShell *pDocSh = GetDoc()->GetDocShell();
392  if (pDocSh)
393  xChild->setParent( pDocSh->GetModel() );
394  }
395 
396  return pNode;
397 }
398 
400  const OUString &rName, sal_Int64 nAspect, SwGrfFormatColl* pGrfColl, SwAttrSet const * pAutoAttr )
401 {
402  OSL_ENSURE( pGrfColl,"SwNodes::MakeOLENode: Formatpointer is 0." );
403 
404  SwOLENode *pNode =
405  new SwOLENode( rWhere, rName, nAspect, pGrfColl, pAutoAttr );
406 
407  // set parent if XChild is supported
409  uno::Reference< container::XChild > xChild( pNode->GetOLEObj().GetObject().GetObject(), UNO_QUERY );
410  if (xChild.is())
411  {
412  SwDocShell *pDocSh= GetDoc()->GetDocShell();
413  if (pDocSh)
414  xChild->setParent( pDocSh->GetModel() );
415  }
416 
417  return pNode;
418 }
419 
421 {
422  MapMode aMapMode( MapUnit::MapTwip );
423  return const_cast<SwOLENode*>(this)->maOLEObj.GetObject().GetSize( &aMapMode );
424 }
425 
426 SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool) const
427 {
428  // If there's already a SvPersist instance, we use it
429  SfxObjectShell* pPersistShell = pDoc->GetPersist();
430  if( !pPersistShell )
431  {
432  // TODO/LATER: is EmbeddedObjectContainer not enough?
433  // the created document will be closed by pDoc ( should use SfxObjectShellLock )
434  pPersistShell = new SwDocShell( pDoc, SfxObjectCreateMode::INTERNAL );
435  pDoc->SetTmpDocShell( pPersistShell );
436  pPersistShell->DoInitNew();
437  }
438 
439  // We insert it at SvPersist level
440  // TODO/LATER: check if using the same naming scheme for all apps works here
441  OUString aNewName/*( Sw3Io::UniqueName( p->GetStorage(), "Obj" ) )*/;
442  SfxObjectShell* pSrc = GetDoc()->GetPersist();
443 
447  aNewName,
448  pSrc->getDocumentBaseURL(),
449  pPersistShell->getDocumentBaseURL());
450 
451  SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
452  pDoc->GetDfltGrfFormatColl(),
453  GetpSwAttrSet() );
454 
456  pOLENd->SetTitle( GetTitle() );
457  pOLENd->SetDescription( GetDescription() );
458  pOLENd->SetContour( HasContour(), HasAutomaticContour() );
459  pOLENd->SetAspect( GetAspect() ); // the replacement image must be already copied
460 
461  pOLENd->SetOLESizeInvalid( true );
462  pDoc->SetOLEPrtNotifyPending();
463 
464  return pOLENd;
465 }
466 
468 {
469  // Find the "Body Anchor"
470  sal_uLong nEndExtraIdx = GetNodes().GetEndOfExtras().GetIndex();
471  const SwNode* pAnchorNd = this;
472  do {
473  SwFrameFormat* pFlyFormat = pAnchorNd->GetFlyFormat();
474  if( !pFlyFormat )
475  return false;
476 
477  const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor();
478  if( !rAnchor.GetContentAnchor() )
479  return false;
480 
481  pAnchorNd = &rAnchor.GetContentAnchor()->nNode.GetNode();
482  } while( pAnchorNd->GetIndex() < nEndExtraIdx );
483 
484  const SwSectionNode* pSectNd = pAnchorNd->FindSectionNode();
485  if( !pSectNd )
486  return false;
487 
488  while( pSectNd )
489  {
490  pAnchorNd = pSectNd;
491  pSectNd = pAnchorNd->StartOfSectionNode()->FindSectionNode();
492  }
493 
494  // pAnchorNd contains the most recently found Section Node, which
495  // now must fulfill the prerequisites for the GlobalDoc
496  pSectNd = static_cast<const SwSectionNode*>(pAnchorNd);
497  return FILE_LINK_SECTION == pSectNd->GetSection().GetType() &&
498  pSectNd->GetIndex() > nEndExtraIdx;
499 }
500 
502 {
503  if( maOLEObj.m_xOLERef.is() )
504  {
505  SfxObjectShell* p = GetDoc()->GetPersist();
506  if( p ) // Must be there
507  {
509  }
510  }
511  return false;
512 }
513 
515 {
516  if ( maOLEObj.m_xOLERef.is() )
518 }
519 
521 {
522  bool bResult = false;
523 
524  if ( mpObjectLink )
525  {
526  OUString aNewLinkURL;
527  sfx2::LinkManager::GetDisplayNames( mpObjectLink, nullptr, &aNewLinkURL );
528  if ( !aNewLinkURL.equalsIgnoreAsciiCase( maLinkURL ) )
529  {
530  if ( !maOLEObj.m_xOLERef.is() )
532 
533  uno::Reference< embed::XEmbeddedObject > xObj = maOLEObj.m_xOLERef.GetObject();
534  uno::Reference< embed::XCommonEmbedPersist > xPersObj( xObj, uno::UNO_QUERY );
535  OSL_ENSURE( xPersObj.is(), "The object must exist!" );
536  if ( xPersObj.is() )
537  {
538  try
539  {
540  sal_Int32 nCurState = xObj->getCurrentState();
541  if ( nCurState != embed::EmbedStates::LOADED )
542  xObj->changeState( embed::EmbedStates::LOADED );
543 
544  // TODO/LATER: there should be possible to get current mediadescriptor settings from the object
545  uno::Sequence< beans::PropertyValue > aArgs( 1 );
546  aArgs[0].Name = "URL";
547  aArgs[0].Value <<= aNewLinkURL;
548  xPersObj->reload( aArgs, uno::Sequence< beans::PropertyValue >() );
549 
550  maLinkURL = aNewLinkURL;
551  bResult = true;
552 
553  if ( nCurState != embed::EmbedStates::LOADED )
554  xObj->changeState( nCurState );
555  }
556  catch (const uno::Exception&)
557  {
558  }
559  }
560 
561  if ( !bResult )
562  {
563  // TODO/LATER: return the old name to the link manager, is it possible?
564  }
565  }
566  }
567 
568  return bResult;
569 }
570 
572 {
573  SfxObjectShell* pPers = GetDoc()->GetPersist();
574 
575  if ( pPers )
576  {
577  uno::Reference< embed::XStorage > xStorage = pPers->GetStorage();
578  if ( xStorage.is() )
579  {
580  try
581  {
582  uno::Reference< embed::XLinkageSupport > xLinkSupport( maOLEObj.GetOleRef(), uno::UNO_QUERY_THROW );
583  xLinkSupport->breakLink( xStorage, maOLEObj.GetCurrentPersistName() );
585  maLinkURL.clear();
586  }
587  catch( uno::Exception& )
588  {
589  }
590  }
591  }
592 }
593 
595 {
596  if ( mpObjectLink )
597  {
599  mpObjectLink = nullptr;
600  }
601 }
602 
604 {
605  if ( maOLEObj.m_xOLERef.GetObject().is() && !mpObjectLink )
606  {
607  try
608  {
609  uno::Reference< embed::XLinkageSupport > xLinkSupport( maOLEObj.m_xOLERef.GetObject(), uno::UNO_QUERY_THROW );
610  if ( xLinkSupport->isLink() )
611  {
612  const OUString aLinkURL = xLinkSupport->getLinkURL();
613  if ( !aLinkURL.isEmpty() )
614  {
615  // this is a file link so the model link manager should handle it
616  mpObjectLink = new SwEmbedObjectLink( this );
617  maLinkURL = aLinkURL;
620  }
621  }
622  }
623  catch( uno::Exception& )
624  {
625  }
626  }
627 }
628 
629 // #i99665#
630 bool SwOLENode::IsChart() const
631 {
632  bool bIsChart( false );
633 
634  const uno::Reference< embed::XEmbeddedObject > xEmbObj =
635  const_cast<SwOLEObj&>(GetOLEObj()).GetOleRef();
636  if ( xEmbObj.is() )
637  {
638  SvGlobalName aClassID( xEmbObj->getClassID() );
639  bIsChart = SotExchange::IsChart( aClassID );
640  }
641 
642  return bIsChart;
643 }
644 
645 // react on visual change (invalidate)
647 {
648  SwFrame* pFrame(getLayoutFrame(nullptr));
649 
650  if(nullptr == pFrame)
651  {
652  return;
653  }
654 
655  const SwRect aFrameArea(pFrame->getFrameArea());
656  SwViewShell* pVSh(GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell());
657 
658  if(nullptr == pVSh)
659  {
660  return;
661  }
662 
663  for(SwViewShell& rShell : pVSh->GetRingContainer())
664  {
665  SET_CURR_SHELL(&rShell);
666 
667  if(rShell.VisArea().IsOver(aFrameArea) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType())
668  {
669  // invalidate instead of painting
670  rShell.GetWin()->Invalidate(aFrameArea.SVRect());
671  }
672  }
673 }
674 
675 namespace { class DeflateThread; }
676 
679 {
680 private:
682  friend class SwOLEObj;
683 
684  uno::Reference< frame::XModel > maXModel;
687 
688  // evtl.set from the SwOLEObj destructor when a WorkerThread is still active
689  // since it is not possible to kill it - let it terminate and delete the
690  // data working on itself
691  std::atomic< bool> mbKilled;
692 
693  std::shared_ptr<comphelper::ThreadTaskTag> mpTag;
694 
695 public:
696  explicit DeflateData(const uno::Reference< frame::XModel >& rXModel)
697  : maXModel(rXModel),
698  maPrimitive2DSequence(),
699  maRange(),
700  mbKilled(false),
701  mpTag( comphelper::ThreadPool::createThreadTaskTag() )
702  {
703  }
704 
706  {
707  return maPrimitive2DSequence;
708  }
709 
711  {
712  return maRange;
713  }
714 
715  bool isFinished() const
716  {
718  }
719 
721  {
722  // need to wait until the load in progress is finished.
723  // WorkerThreads need the SolarMutex to be able to continue
724  // and finish the running import.
725  SolarMutexReleaser aReleaser;
727  }
728 };
729 
730 namespace {
731 
733 class DeflateThread : public comphelper::ThreadTask
734 {
735  // the data to work on
736  DeflateData& mrDeflateData;
737 
738 public:
739  explicit DeflateThread(DeflateData& rDeflateData)
740  : comphelper::ThreadTask(rDeflateData.mpTag), mrDeflateData(rDeflateData)
741  {
742  }
743 
744 private:
745  virtual void doWork() override
746  {
747  try
748  {
749  // load the chart data and get the primitives
751  mrDeflateData.maXModel,
752  mrDeflateData.maRange);
753 
754  // model no longer needed and done
755  mrDeflateData.maXModel.clear();
756  }
757  catch (const uno::Exception&)
758  {
759  }
760 
761  if(mrDeflateData.mbKilled)
762  {
763  // need to cleanup myself - data will not be used
764  delete &mrDeflateData;
765  }
766  }
767 };
768 
769 }
770 
772 
774  m_pOLENode( nullptr ),
775  m_xOLERef( xObj ),
776  m_aPrimitive2DSequence(),
777  m_aRange()
778 {
779  m_xOLERef.Lock();
780  if ( xObj.is() )
781  {
782  m_xListener = new SwOLEListener_Impl( this );
783  xObj->addStateChangeListener( m_xListener.get() );
784  }
785 }
786 
787 SwOLEObj::SwOLEObj( const OUString &rString, sal_Int64 nAspect ) :
788  m_pOLENode( nullptr ),
789  m_aName( rString ),
790  m_aPrimitive2DSequence(),
791  m_aRange()
792 {
793  m_xOLERef.Lock();
794  m_xOLERef.SetViewAspect( nAspect );
795 }
796 
797 SwOLEObj::~SwOLEObj() COVERITY_NOEXCEPT_FALSE
798 {
799  if(m_pDeflateData)
800  {
801  // set flag so that the worker thread will delete m_pDeflateData
802  // when finished and forget about it
803  m_pDeflateData->mbKilled = true;
804  m_pDeflateData = nullptr;
805  }
806 
807  if( m_xListener )
808  {
809  if ( m_xOLERef.is() )
810  m_xOLERef->removeStateChangeListener( m_xListener.get() );
811  m_xListener->dispose();
812  m_xListener.clear();
813  }
814 
815  if( m_pOLENode && !m_pOLENode->GetDoc()->IsInDtor() )
816  {
817  // if the model is not currently in destruction it means that this object should be removed from the model
819 
820 #if OSL_DEBUG_LEVEL > 0
822  OSL_ENSURE( p, "No document!" );
823  if( p )
824  {
826  OSL_ENSURE( !pCnt || &rCnt == pCnt, "The helper is assigned to unexpected container!" );
827  }
828 #endif
829 
830  if ( pCnt && pCnt->HasEmbeddedObject( m_aName ) )
831  {
832  uno::Reference < container::XChild > xChild( m_xOLERef.GetObject(), uno::UNO_QUERY );
833  if ( xChild.is() )
834  xChild->setParent( nullptr );
835 
836  // not already removed by deleting the object
837  m_xOLERef.AssignToContainer( nullptr, m_aName );
838 
839  // unlock object so that object can be closed in RemoveEmbeddedObject
840  // successful closing of the object will automatically clear the reference then
841  m_xOLERef.Lock(false);
842 
843  // Always remove object from container it is connected to
844  try
845  {
846  // remove object from container but don't close it
847  pCnt->RemoveEmbeddedObject( m_aName );
848  }
849  catch ( uno::Exception& )
850  {
851  }
852  }
853 
854  }
855 
856  if ( m_xOLERef.is() )
857  // in case the object wasn't closed: release it
858  // in case the object was not in the container: it's still locked, try to close
859  m_xOLERef.Clear();
860 }
861 
863 {
864  m_pOLENode = pNode;
865  if ( m_aName.isEmpty() )
866  {
867  SwDoc* pDoc = pNode->GetDoc();
868 
869  // If there's already a SvPersist instance, we use it
870  SfxObjectShell* p = pDoc->GetPersist();
871  if( !p )
872  {
873  // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
874  // What happens to the document?
875  OSL_ENSURE( false, "Why are we creating a DocShell here??" );
876  p = new SwDocShell( pDoc, SfxObjectCreateMode::INTERNAL );
877  p->DoInitNew();
878  }
879 
880  OUString aObjName;
881  uno::Reference < container::XChild > xChild( m_xOLERef.GetObject(), uno::UNO_QUERY );
882  if ( xChild.is() && xChild->getParent() != p->GetModel() )
883  // it is possible that the parent was set already
884  xChild->setParent( p->GetModel() );
886  {
887  OSL_FAIL( "InsertObject failed" );
888  if ( xChild.is() )
889  xChild->setParent( nullptr );
890  }
891  else
893 
894  const_cast<SwOLENode*>(m_pOLENode)->CheckFileLink_Impl(); // for this notification nonconst access is required
895 
896  m_aName = aObjName;
897  }
898 }
899 
901 {
902  OUString strStyle;
903  if (m_xOLERef.is() && m_xOLERef.IsChart())
904  strStyle = m_xOLERef.GetChartType();
905  return strStyle;
906 }
907 
908 bool SwOLEObj::IsOleRef() const
909 {
910  return m_xOLERef.is();
911 }
912 
913 uno::Reference < embed::XEmbeddedObject > const & SwOLEObj::GetOleRef()
914 {
915  if( !m_xOLERef.is() )
916  {
918  assert(p && "No SvPersist present");
919 
920  OUString sDocumentBaseURL = p->getDocumentBaseURL();
921  uno::Reference < embed::XEmbeddedObject > xObj = p->GetEmbeddedObjectContainer().GetEmbeddedObject(m_aName, &sDocumentBaseURL);
922  OSL_ENSURE( !m_xOLERef.is(), "Calling GetOleRef() recursively is not permitted" );
923 
924  if ( !xObj.is() )
925  {
926  // We could not load this part (probably broken)
927  tools::Rectangle aArea;
928  SwFrame *pFrame = m_pOLENode->getLayoutFrame(nullptr);
929  if ( pFrame )
930  {
931  Size aSz( pFrame->getFrameArea().SSize() );
932  const MapMode aSrc ( MapUnit::MapTwip );
933  const MapMode aDest( MapUnit::Map100thMM );
934  aSz = OutputDevice::LogicToLogic( aSz, aSrc, aDest );
935  aArea.SetSize( aSz );
936  }
937  else
938  aArea.SetSize( Size( 5000, 5000 ) );
939  // TODO/LATER: set replacement graphic for dead object
940  // It looks as if it should work even without the object, because the replace will be generated automatically
941  OUString aTmpName;
942  xObj = p->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_DUMMY_CLASSID ).GetByteSequence(), aTmpName );
943  }
944  if (xObj.is())
945  {
948  m_xListener = new SwOLEListener_Impl( this );
949  xObj->addStateChangeListener( m_xListener.get() );
950  }
951 
952  const_cast<SwOLENode*>(m_pOLENode)->CheckFileLink_Impl(); // for this notification nonconst access is required
953  }
954  else if ( m_xOLERef->getCurrentState() == embed::EmbedStates::RUNNING )
955  {
956  // move object to first position in cache
957  if (!g_pOLELRU_Cache)
958  g_pOLELRU_Cache.reset(new SwOLELRUCache);
959  g_pOLELRU_Cache->InsertObj( *this );
960  }
961 
962  return m_xOLERef.GetObject();
963 }
964 
966 {
967  GetOleRef();
968  return m_xOLERef;
969 }
970 
972 {
973  bool bRet = true;
974  if ( m_pOLENode )
975  {
976  const SwDoc* pDoc = m_pOLENode->GetDoc();
978  }
979 
980  return bRet;
981 }
982 
983 bool SwOLEObj::UnloadObject( uno::Reference< embed::XEmbeddedObject > const & xObj, const SwDoc* pDoc, sal_Int64 nAspect )
984 {
985  if ( !pDoc )
986  return false;
987 
988  bool bRet = true;
989  sal_Int32 nState = xObj.is() ? xObj->getCurrentState() : embed::EmbedStates::LOADED;
990  bool bIsActive = ( nState != embed::EmbedStates::LOADED && nState != embed::EmbedStates::RUNNING );
991  sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
992 
993  if( nState != embed::EmbedStates::LOADED && !pDoc->IsInDtor() && !bIsActive &&
994  embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
995  embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) )
996  {
997  SfxObjectShell* p = pDoc->GetPersist();
998  if( p )
999  {
1001  {
1002  try
1003  {
1004  uno::Reference < util::XModifiable > xMod( xObj->getComponent(), uno::UNO_QUERY );
1005  if( xMod.is() && xMod->isModified() )
1006  {
1007  uno::Reference < embed::XEmbedPersist > xPers( xObj, uno::UNO_QUERY );
1008  assert(xPers.is() && "Modified object without persistence in cache!");
1009  xPers->storeOwn();
1010  }
1011 
1012  // setting object to loaded state will remove it from cache
1013  xObj->changeState( embed::EmbedStates::LOADED );
1014  }
1015  catch (const uno::Exception&)
1016  {
1017  bRet = false;
1018  }
1019  }
1020  else
1021  bRet = false;
1022  }
1023  }
1024 
1025  return bRet;
1026 }
1027 
1029 {
1030  uno::Reference< embed::XEmbeddedObject > xEmbObj = GetOleRef();
1031  if ( !xEmbObj.is() )
1032  return OUString();
1033 
1034  SvGlobalName aClassID( xEmbObj->getClassID() );
1035  if ( SotExchange::IsMath( aClassID ) )
1036  return SwResId(STR_MATH_FORMULA);
1037 
1038  if ( SotExchange::IsChart( aClassID ) )
1039  return SwResId(STR_CHART);
1040 
1041  return SwResId(STR_OLE);
1042 }
1043 
1045  basegfx::B2DRange& rRange,
1046  bool bSynchron)
1047 {
1048  if(m_pDeflateData)
1049  {
1050  if(bSynchron)
1051  {
1052  // data in high quality is requested, wait until the data is available
1053  // since a WorkerThread was already started to load it
1054  m_pDeflateData->waitFinished();
1055  }
1056 
1057  if(m_pDeflateData->isFinished())
1058  {
1059  // copy the result data and cleanup
1060  m_aPrimitive2DSequence = m_pDeflateData->getSequence();
1061  m_aRange = m_pDeflateData->getRange();
1062  m_pDeflateData.reset();
1063  }
1064  }
1065 
1067  {
1068  const uno::Reference< frame::XModel > aXModel(m_xOLERef->getComponent(), uno::UNO_QUERY);
1069 
1070  if(aXModel.is())
1071  {
1072  // disabled for now, need to check deeper
1073  static bool bAsynchronousLoadingAllowed = false; // loplugin:constvars:ignore
1074 
1075  if(bSynchron ||
1076  !bAsynchronousLoadingAllowed)
1077  {
1078  // load chart synchron in this Thread
1080  aXModel,
1081  m_aRange);
1082  }
1083  else
1084  {
1085  // if not yet setup, initiate and start a WorkerThread to load the chart
1086  // and it's primitives asynchron. If it already works, returning nothing
1087  // is okay (preview will be reused)
1088  if(!m_pDeflateData)
1089  {
1090  m_pDeflateData.reset( new DeflateData(aXModel) );
1091  std::unique_ptr<DeflateThread> pNew( new DeflateThread(*m_pDeflateData) );
1093  }
1094  }
1095  }
1096  }
1097 
1098  if(!m_aPrimitive2DSequence.empty() && !m_aRange.isEmpty())
1099  {
1100  // when we have data, also copy the buffered Range data as output
1101  rRange = m_aRange;
1102  }
1103 
1104  return m_aPrimitive2DSequence;
1105 }
1106 
1108 {
1110  m_aRange.reset();
1111 
1112  if(m_pDeflateData)
1113  {
1114  // load is in progress, wait until finished and cleanup without using it
1115  m_pDeflateData->waitFinished();
1116  m_pDeflateData.reset();
1117  }
1118 }
1119 
1121 {
1122  xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLEObj"));
1123  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1124 
1125  xmlTextWriterStartElement(pWriter, BAD_CAST("m_xOLERef"));
1126  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"),
1127  BAD_CAST(typeid(*m_xOLERef.GetObject().get()).name()));
1128  xmlTextWriterEndElement(pWriter);
1129 
1130  xmlTextWriterEndElement(pWriter);
1131 }
1132 
1134  : utl::ConfigItem("Office.Common/Cache")
1135  , m_nLRU_InitSize( 20 )
1136 {
1138  Load();
1139 }
1140 
1141 uno::Sequence< OUString > SwOLELRUCache::GetPropertyNames()
1142 {
1143  Sequence< OUString > aNames { "Writer/OLE_Objects" };
1144  return aNames;
1145 }
1146 
1147 void SwOLELRUCache::Notify( const uno::Sequence< OUString>& )
1148 {
1149  Load();
1150 }
1151 
1153 {
1154 }
1155 
1157 {
1159  Sequence< Any > aValues = GetProperties( aNames );
1160  const Any* pValues = aValues.getConstArray();
1161  OSL_ENSURE( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
1162  if (aValues.getLength() != aNames.getLength() || !pValues->hasValue())
1163  return;
1164 
1165  sal_Int32 nVal = 0;
1166  *pValues >>= nVal;
1167 
1168  if (nVal < m_nLRU_InitSize)
1169  {
1170  std::shared_ptr<SwOLELRUCache> tmp(g_pOLELRU_Cache); // prevent delete this
1171  // size of cache has been changed
1172  sal_Int32 nCount = m_OleObjects.size();
1173  sal_Int32 nPos = nCount;
1174 
1175  // try to remove the last entries until new maximum size is reached
1176  while( nCount > nVal )
1177  {
1178  SwOLEObj *const pObj = m_OleObjects[ --nPos ];
1179  if ( pObj->UnloadObject() )
1180  nCount--;
1181  if ( !nPos )
1182  break;
1183  }
1184  }
1185 
1186  m_nLRU_InitSize = nVal;
1187 }
1188 
1190 {
1191  SwOLEObj* pObj = &rObj;
1192  OleObjects_t::iterator it =
1193  std::find(m_OleObjects.begin(), m_OleObjects.end(), pObj);
1194  if (it != m_OleObjects.end() && it != m_OleObjects.begin())
1195  {
1196  // object in cache but is currently not the first in cache
1197  m_OleObjects.erase(it);
1198  it = m_OleObjects.end();
1199  }
1200  if (it == m_OleObjects.end())
1201  {
1202  std::shared_ptr<SwOLELRUCache> tmp(g_pOLELRU_Cache); // prevent delete this
1203  // try to remove objects if necessary
1204  sal_Int32 nCount = m_OleObjects.size();
1205  sal_Int32 nPos = nCount-1;
1206  while (nPos >= 0 && nCount >= m_nLRU_InitSize)
1207  {
1208  pObj = m_OleObjects[ nPos-- ];
1209  if ( pObj->UnloadObject() )
1210  nCount--;
1211  }
1212  m_OleObjects.push_front(&rObj);
1213  }
1214 }
1215 
1217 {
1218  OleObjects_t::iterator const it =
1219  std::find(m_OleObjects.begin(), m_OleObjects.end(), &rObj);
1220  if (it != m_OleObjects.end())
1221  {
1222  m_OleObjects.erase(it);
1223  }
1224  if (m_OleObjects.empty())
1225  {
1226  if (g_pOLELRU_Cache.use_count() == 1) // test that we're not in InsertObj()
1227  {
1228  g_pOLELRU_Cache.reset();
1229  }
1230  }
1231 }
1232 
1233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAspect(sal_Int64 nAspect)
Definition: ndole.hxx:137
bool UnloadObject()
Definition: ndole.cxx:971
virtual void SAL_CALL stateChanged(const lang::EventObject &aEvent,::sal_Int32 nOldState,::sal_Int32 nNewState) override
Definition: ndole.cxx:115
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:960
void SetDescription(const OUString &rDescription)
Definition: ndnotxt.cxx:272
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
Base class of the Writer layout elements.
Definition: frame.hxx:295
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
const char *const aClassID
sal_uLong GetIndex() const
Definition: node.hxx:282
SwOLENode(const SwNodeIndex &rWhere, const svt::EmbeddedObjectRef &, SwGrfFormatColl *pGrfColl, SwAttrSet const *pAutoAttr)
Definition: ndole.cxx:212
sal_Int64 GetAspect() const
Definition: ndole.hxx:136
SwOLEObj maOLEObj
Definition: ndole.hxx:88
friend DeflateThread
Definition: ndole.cxx:681
bool HasAutomaticContour() const
Definition: ndnotxt.hxx:78
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:2987
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
OUString msChartTableName
with chart objects: name of referenced table.
Definition: ndole.hxx:89
SwDocShell * GetDocShell()
Definition: doc.hxx:1341
void waitUntilDone(const std::shared_ptr< ThreadTaskTag > &, bool bJoinAll=true)
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SwNodeIndex nNode
Definition: pam.hxx:37
OUString GetDescription()
Definition: ndole.cxx:1028
sal_uIntPtr sal_uLong
const OUString & GetChartTableName() const
Definition: ndole.hxx:152
std::unique_ptr< DeflateData > m_pDeflateData
Definition: ndole.hxx:49
void SetTitle(const OUString &rTitle)
Definition: ndnotxt.cxx:247
#define OBJECT_CLIENT_OLE
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:913
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1148
rtl::Reference< SwOLEListener_Impl > m_xListener
Definition: ndole.hxx:39
void RemoveObj(SwOLEObj &rObj)
Definition: ndole.cxx:1216
Definition: doc.hxx:185
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:292
SwOLEObj * mpObj
Definition: ndole.cxx:93
bool HasEmbeddedObject(const OUString &)
SwNode & GetNode() const
Definition: ndindex.hxx:118
void SetTmpDocShell(SfxObjectShellLock rLock)
in case during copying of embedded object a new shell is created, it should be set here and cleaned l...
Definition: doc.hxx:1347
void Load()
Definition: ndole.cxx:1156
css::uno::Reference< css::frame::XModel > GetModel() const
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual OUString getDocumentBaseURL() const override
std::atomic< bool > mbKilled
Definition: ndole.cxx:691
void DisconnectFileLink_Impl()
Definition: ndole.cxx:594
static sal_uInt16 IsChart(const SvGlobalName &rName)
virtual ~SwOLENode() override
Definition: ndole.cxx:237
const tools::PolyPolygon * HasContour() const
Definition: ndnotxt.cxx:107
const SwSection & GetSection() const
Definition: node.hxx:541
css::uno::Reference< css::embed::XStorage > const & GetStorage()
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: ndole.cxx:291
bool IsChart() const
Definition: ndole.cxx:630
bool UpdateLinkURL_Impl()
Definition: ndole.cxx:520
drawinglayer::primitive2d::Primitive2DContainer const & tryToGetChartContentAsPrimitive2DSequence(basegfx::B2DRange &rRange, bool bSynchron)
Definition: ndole.cxx:1044
void InsertObj(SwOLEObj &rObj)
Definition: ndole.cxx:1189
static drawinglayer::primitive2d::Primitive2DContainer tryToGetChartContentAsPrimitive2DSequence(const css::uno::Reference< css::frame::XModel > &rXModel, basegfx::B2DRange &rRange)
~SwOLEObj() COVERITY_NOEXCEPT_FALSE
Definition: ndole.cxx:797
const SwRect & getFrameArea() const
Definition: frame.hxx:175
OUTDEV_WINDOW
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:965
drawinglayer::primitive2d::Primitive2DContainer m_aPrimitive2DSequence
Definition: ndole.hxx:47
const Graphic * GetGraphic() const
sal_Int32 m_nLRU_InitSize
Definition: ndole.cxx:73
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: ndole.cxx:1120
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
SotClipboardFormatId
const SwOLENode * m_pOLENode
Definition: ndole.hxx:38
static sal_uInt16 IsMath(const SvGlobalName &rName)
virtual void Notify(const uno::Sequence< OUString > &aPropertyNames) override
Definition: ndole.cxx:1147
uno::Reference< frame::XModel > maXModel
Definition: ndole.cxx:684
const OUString & GetCurrentPersistName() const
Definition: ndole.hxx:69
virtual SwContentNode * MakeCopy(SwDoc *, const SwNodeIndex &, bool bNewFrames) const override
Is in ndcopy.cxx.
Definition: ndole.cxx:426
basegfx::B2DRange maRange
Definition: ndole.cxx:686
static ThreadPool & getSharedOptimalPool()
SwOLENode * MakeOLENode(const SwNodeIndex &rWhere, const svt::EmbeddedObjectRef &, SwGrfFormatColl *pColl)
in ndole.cxx
Definition: ndole.cxx:377
bool isEmpty() const
struct _xmlTextWriter * xmlTextWriterPtr
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
void SetOLEPrtNotifyPending(bool bSet=true)
Definition: doc.hxx:1665
Style of a layout element.
Definition: frmfmt.hxx:57
void AssignToContainer(comphelper::EmbeddedObjectContainer *pContainer, const OUString &rPersistName)
Holder for local data for a parallel-executed task to load a chart model.
Definition: ndole.cxx:678
SwNodeType
Definition: ndtyp.hxx:28
OUString m_aName
Definition: ndole.hxx:44
comphelper::EmbeddedObjectContainer * GetContainer() const
void waitFinished()
Definition: ndole.cxx:720
drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence
Definition: ndole.cxx:685
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
void pushTask(std::unique_ptr< ThreadTask > pTask)
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
void Remove(SvBaseLink const *pLink)
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
void InsertFileLink(sfx2::SvBaseLink &, sal_uInt16 nFileType, const OUString &rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
#define SO3_DUMMY_CLASSID
OUString maLinkURL
Definition: ndole.hxx:94
void SetSize(const Size &rSize)
void Assign(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
const Graphic * GetGraphic()
Definition: ndole.cxx:242
FlyAnchors.
Definition: fmtanchr.hxx:34
SwDoc * GetDoc()
Definition: node.hxx:702
static bool isTaskTagDone(const std::shared_ptr< ThreadTaskTag > &)
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
bool isFinished() const
Definition: ndole.cxx:715
#define SET_CURR_SHELL(shell)
Definition: swtypes.hxx:101
Marks a node in the document model.
Definition: ndindex.hxx:31
OUString GetStyleString()
Definition: ndole.cxx:900
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
SwEmbedObjectLink * mpObjectLink
Definition: ndole.hxx:93
ring_container GetRingContainer()
Definition: ring.hxx:240
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
std::shared_ptr< comphelper::ThreadTaskTag > mpTag
Definition: ndole.cxx:693
void SSize(const Size &rNew)
Definition: swrect.hxx:176
virtual Size GetTwipSize() const override
Definition: ndole.cxx:420
DeflateData(const uno::Reference< frame::XModel > &rXModel)
Definition: ndole.cxx:696
virtual bool SavePersistentData() override
OLE object is transported into UNDO area.
Definition: ndole.cxx:306
virtual void SAL_CALL changingState(const lang::EventObject &aEvent,::sal_Int32 nOldState,::sal_Int32 nNewState) override
Definition: ndole.cxx:111
void SetNode(SwOLENode *pNode)
Definition: ndole.cxx:862
bool IsOLEObjectDeleted() const
Definition: ndole.cxx:501
SwDoc * GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:305
static uno::Sequence< OUString > GetPropertyNames()
Definition: ndole.cxx:1141
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: node.cxx:2058
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
bool IsOleRef() const
To avoid unnecessary loading of object.
Definition: ndole.cxx:908
OleObjects_t m_OleObjects
Definition: ndole.cxx:72
void SetChartTableName(const OUString &rNm)
Definition: ndole.hxx:153
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
void RemoveEmbeddedObject(const OUString &rName, bool bKeepToTempStorage=true)
static std::shared_ptr< SwOLELRUCache > g_pOLELRU_Cache
Definition: ndole.cxx:89
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
void SetViewAspect(sal_Int64 nAspect)
SwOLEListener_Impl(SwOLEObj *pObj)
Definition: ndole.cxx:102
OUString GetTitle() const
Definition: ndnotxt.cxx:260
void CheckFileLink_Impl()
Definition: ndole.cxx:603
virtual void SAL_CALL disposing(const lang::EventObject &aEvent) override
Definition: ndole.cxx:141
virtual bool RestorePersistentData() override
Loading an OLE object that has been moved to the Undo Area.
Definition: ndole.cxx:252
void BreakFileLink_Impl()
Definition: ndole.cxx:571
void SetChanged()
Definition: ndole.cxx:646
virtual void ImplCommit() override
Definition: ndole.cxx:1152
bool DoInitNew(SfxMedium *pMedium=nullptr)
SwNodes & GetNodes()
Definition: doc.hxx:402
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:218
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:634
Size GetSize(MapMode const *pTargetMapMode) const
const char * name
svt::EmbeddedObjectRef m_xOLERef
Either ref or name are known.
Definition: ndole.hxx:43
bool IsChart() const
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
SwOLEObj(const SwOLEObj &rObj)=delete
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:134
virtual sfx2::LinkManager & GetLinkManager()=0
const basegfx::B2DRange & getRange() const
Definition: ndole.cxx:710
css::uno::Reference< css::embed::XEmbeddedObject > CopyAndGetEmbeddedObject(EmbeddedObjectContainer &rSrc, const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, OUString &rName, const OUString &rSrcShellID, const OUString &rDestShellID)
bool IsInDtor() const
Definition: doc.hxx:397
const drawinglayer::primitive2d::Primitive2DContainer & getSequence() const
Definition: ndole.cxx:705
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
basegfx::B2DRange m_aRange
Definition: ndole.hxx:48
SectionType GetType() const
Definition: section.hxx:171
sal_Int64 GetViewAspect() const
void resetBufferedData()
Definition: ndole.cxx:1107
const SwGrfFormatColl * GetDfltGrfFormatColl() const
Definition: doc.hxx:800
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:162
sal_Int32 nPos
void Lock(bool bLock=true)
std::deque< SwOLEObj * > OleObjects_t
Definition: ndole.cxx:71
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:710
SfxLinkUpdateMode
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
Definition: ndnotxt.cxx:87
void GetNewReplacement()
Definition: ndole.cxx:514
Base class of the Writer document model elements.
Definition: node.hxx:79
OUString GetDescription() const
Remove OLE-object from "memory".
Definition: ndole.hxx:141
bool IsInGlobalDocSection() const
Definition: ndole.cxx:467