diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 36 | ||||
-rw-r--r-- | sw/source/core/ole/ndole.cxx | 41 |
2 files changed, 53 insertions, 24 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index ebb083ac2741..555fd46bd69d 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -69,7 +69,6 @@ #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <svtools/embedhlp.hxx> -#include <svx/charthelper.hxx> #include <dview.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> @@ -1034,29 +1033,22 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr if(bIsChart) { - const uno::Reference< frame::XModel > aXModel(pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY); + basegfx::B2DRange aSourceRange; + const drawinglayer::primitive2d::Primitive2DContainer aSequence( + pOLENd->GetOLEObj().tryToGetChartContentAsPrimitive2DSequence( + aSourceRange)); - if(aXModel.is()) + if(!aSequence.empty() && !aSourceRange.isEmpty()) { - basegfx::B2DRange aSourceRange; - - const drawinglayer::primitive2d::Primitive2DContainer aSequence( - ChartHelper::tryToGetChartContentAsPrimitive2DSequence( - aXModel, - aSourceRange)); - - if(!aSequence.empty() && !aSourceRange.isEmpty()) - { - const basegfx::B2DRange aTargetRange( - aAlignedGrfArea.Left(), aAlignedGrfArea.Top(), - aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom()); - - bDone = paintUsingPrimitivesHelper( - *pOut, - aSequence, - aSourceRange, - aTargetRange); - } + const basegfx::B2DRange aTargetRange( + aAlignedGrfArea.Left(), aAlignedGrfArea.Top(), + aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom()); + + bDone = paintUsingPrimitivesHelper( + *pOut, + aSequence, + aSourceRange, + aTargetRange); } } diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index c9f26b9b2156..354c3404b427 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -57,6 +57,7 @@ #include <unotools/ucbstreamhelper.hxx> #include <vcl/graphicfilter.hxx> #include <comcore.hrc> +#include <svx/charthelper.hxx> #include <deque> @@ -125,6 +126,10 @@ void SAL_CALL SwOLEListener_Impl::stateChanged( const lang::EventObject&, ::sal_ if (g_pOLELRU_Cache) g_pOLELRU_Cache->RemoveObj( *mpObj ); } + else if(mpObj && nNewState == embed::EmbedStates::RUNNING) + { + mpObj->resetBufferedData(); + } } void SwOLEListener_Impl::Release() @@ -673,7 +678,9 @@ void SwOLENode::SetChanged() SwOLEObj::SwOLEObj( const svt::EmbeddedObjectRef& xObj ) : pOLENd( nullptr ), pListener( nullptr ), - xOLERef( xObj ) + xOLERef( xObj ), + m_aPrimitive2DSequence(), + m_aRange() { xOLERef.Lock(); if ( xObj.is() ) @@ -687,7 +694,9 @@ SwOLEObj::SwOLEObj( const svt::EmbeddedObjectRef& xObj ) : SwOLEObj::SwOLEObj( const OUString &rString, sal_Int64 nAspect ) : pOLENd( nullptr ), pListener( nullptr ), - aName( rString ) + aName( rString ), + m_aPrimitive2DSequence(), + m_aRange() { xOLERef.Lock(); xOLERef.SetViewAspect( nAspect ); @@ -932,6 +941,34 @@ OUString SwOLEObj::GetDescription() return SW_RESSTR(STR_OLE); } +drawinglayer::primitive2d::Primitive2DContainer SwOLEObj::tryToGetChartContentAsPrimitive2DSequence(basegfx::B2DRange& rRange) +{ + if(m_aPrimitive2DSequence.empty() && m_aRange.isEmpty() && xOLERef.is() && xOLERef.IsChart()) + { + const uno::Reference< frame::XModel > aXModel(xOLERef->getComponent(), uno::UNO_QUERY); + + if(aXModel.is()) + { + m_aPrimitive2DSequence = ChartHelper::tryToGetChartContentAsPrimitive2DSequence( + aXModel, + m_aRange); + } + } + + if(!m_aPrimitive2DSequence.empty() && !m_aRange.isEmpty()) + { + rRange = m_aRange; + } + + return m_aPrimitive2DSequence; +} + +void SwOLEObj::resetBufferedData() +{ + m_aPrimitive2DSequence = drawinglayer::primitive2d::Primitive2DContainer(); + m_aRange.reset(); +} + SwOLELRUCache::SwOLELRUCache() : utl::ConfigItem(OUString("Office.Common/Cache")) , m_nLRU_InitSize( 20 ) |