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