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