diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-13 15:14:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-13 15:15:11 +0000 |
commit | 131e5d35a4edb9f8875a197e8e0382c168834f70 (patch) | |
tree | 80a1f601731ccb98e25882c47fa1c1b36dc359be /svx | |
parent | merge return branches (diff) | |
download | core-131e5d35a4edb9f8875a197e8e0382c168834f70.tar.gz core-131e5d35a4edb9f8875a197e8e0382c168834f70.zip |
Resolves: fdo#46728 reference count the overlay managers
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/sdr/overlay/overlaymanager.hxx | 21 | ||||
-rw-r--r-- | svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx | 9 | ||||
-rw-r--r-- | svx/inc/svx/sdr/overlay/overlayobject.hxx | 1 | ||||
-rw-r--r-- | svx/inc/svx/sdrpagewindow.hxx | 3 | ||||
-rw-r--r-- | svx/inc/svx/sdrpaintwindow.hxx | 12 | ||||
-rw-r--r-- | svx/source/engine3d/view3d.cxx | 8 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanager.cxx | 22 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanagerbuffered.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpaintwindow.cxx | 49 | ||||
-rw-r--r-- | svx/source/svdraw/svdcrtv.cxx | 24 | ||||
-rw-r--r-- | svx/source/svdraw/svddrgv.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdhdl.cxx | 72 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdsnpv.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdview.cxx | 6 | ||||
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 6 | ||||
-rw-r--r-- | svx/source/table/tablehandles.cxx | 12 |
18 files changed, 171 insertions, 114 deletions
diff --git a/svx/inc/svx/sdr/overlay/overlaymanager.hxx b/svx/inc/svx/sdr/overlay/overlaymanager.hxx index 532b481e81f9..5a525ac209c1 100644 --- a/svx/inc/svx/sdr/overlay/overlaymanager.hxx +++ b/svx/inc/svx/sdr/overlay/overlaymanager.hxx @@ -29,6 +29,8 @@ #ifndef _SDR_OVERLAY_OVERLAYMANAGER_HXX #define _SDR_OVERLAY_OVERLAYMANAGER_HXX +#include <boost/utility.hpp> +#include <rtl/ref.hxx> #include <svx/sdr/animation/scheduler.hxx> #include <svx/sdr/overlay/overlayobject.hxx> #include <vcl/mapmod.hxx> @@ -58,8 +60,13 @@ namespace sdr { namespace overlay { - class SVX_DLLPUBLIC OverlayManager : public ::sdr::animation::Scheduler + class SVX_DLLPUBLIC OverlayManager + : private boost::noncopyable + , protected ::sdr::animation::Scheduler + , public rtl::IReference { + private: + oslInterlockedCount mnRefCount; protected: // the OutputDevice to work on, set on construction and not to be changed OutputDevice& rmOutputDevice; @@ -92,15 +99,18 @@ namespace sdr // ViewTransformation and evtl. correct mfDiscreteOne double getDiscreteOne() const; - public: // when handing over another OverlayManager at construction, the OverlayObjects // will be taken over from it. The new one will have added all OverlayObjects // while the handed over one will have none OverlayManager( OutputDevice& rOutputDevice, - OverlayManager* pOldOverlayManager = 0); + OverlayManager* pOldOverlayManager); virtual ~OverlayManager(); + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager = 0); + // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const; @@ -140,6 +150,11 @@ namespace sdr // access to maDrawinglayerOpt const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; } + + void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); } + + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); }; } // end of namespace overlay } // end of namespace sdr diff --git a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx index d1cec1123cba..6f9c03305063 100644 --- a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx +++ b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx @@ -70,16 +70,19 @@ namespace sdr void ImpRestoreBackground(const Region& rRegionPixel) const; void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L); - public: // when handing over another OverlayManager at construction, the OverlayObjects // will be taken over from it. The new one will have added all OverlayObjects // while the handed over one will have none OverlayManagerBuffered( OutputDevice& rOutputDevice, - OverlayManager* pOldOverlayManager = 0, - bool bRefreshWithPreRendering = false); + OverlayManager* pOldOverlayManager, + bool bRefreshWithPreRendering); virtual ~OverlayManagerBuffered(); + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager = 0, bool bRefreshWithPreRendering = false); + // complete redraw virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const; diff --git a/svx/inc/svx/sdr/overlay/overlayobject.hxx b/svx/inc/svx/sdr/overlay/overlayobject.hxx index 321190931a58..ea4c3e4a4510 100644 --- a/svx/inc/svx/sdr/overlay/overlayobject.hxx +++ b/svx/inc/svx/sdr/overlay/overlayobject.hxx @@ -32,6 +32,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/range/b2drange.hxx> #include <tools/color.hxx> +#include <rtl/ref.hxx> #include <svx/sdr/animation/scheduler.hxx> #include "svx/svxdllapi.h" #include <drawinglayer/primitive2d/baseprimitive2d.hxx> diff --git a/svx/inc/svx/sdrpagewindow.hxx b/svx/inc/svx/sdrpagewindow.hxx index 7464c1bfb101..88a0a20516d3 100644 --- a/svx/inc/svx/sdrpagewindow.hxx +++ b/svx/inc/svx/sdrpagewindow.hxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/util/XModeChangeListener.hpp> #include <cppuhelper/implbase4.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> #include <svx/svdtypes.hxx> // for SdrLayerID #include <svl/svarray.hxx> #include <tools/contnr.hxx> @@ -105,7 +106,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > GetControlContainer( bool _bCreateIfNecessary = true ) const; // OVERLAYMANAGER - ::sdr::overlay::OverlayManager* GetOverlayManager() const; + rtl::Reference< ::sdr::overlay::OverlayManager > GetOverlayManager() const; // #i72752# allow patcing SdrPaintWindow from SdrPageView::DrawLayer if needed void patchPaintWindow(SdrPaintWindow& rPaintWindow); diff --git a/svx/inc/svx/sdrpaintwindow.hxx b/svx/inc/svx/sdrpaintwindow.hxx index 24388ef324cc..9ecfbed65839 100644 --- a/svx/inc/svx/sdrpaintwindow.hxx +++ b/svx/inc/svx/sdrpaintwindow.hxx @@ -29,6 +29,7 @@ #ifndef _SDRPAINTWINDOW_HXX #define _SDRPAINTWINDOW_HXX +#include <rtl/ref.hxx> #include <vcl/virdev.hxx> #include "svx/svxdllapi.h" @@ -78,7 +79,7 @@ private: // the new OverlayManager for the new OverlayObjects. Test add here, will // replace the IAOManager as soon as it works. - ::sdr::overlay::OverlayManager* mpOverlayManager; + rtl::Reference< ::sdr::overlay::OverlayManager > mxOverlayManager; // The PreRenderDevice for PreRendering SdrPreRenderDevice* mpPreRenderDevice; @@ -90,14 +91,14 @@ private: // #i72889# flag if this is only a temporary target for repaint, default is false unsigned mbTemporaryTarget : 1; - /** Remember whether the mpOverlayManager supports buffering. Using - this flags expensive dynamic_casts on mpOverlayManager in order to + /** Remember whether the mxOverlayManager supports buffering. Using + this flags expensive dynamic_casts on mxOverlayManager in order to detect this. */ bool mbUseBuffer; // helpers - /** Create mpOverlayManager member on demand. + /** Create mxOverlayManager member on demand. @param bUseBuffer Specifies whether to use the buffered (OverlayManagerBuffered) or the unbuffered (OverlayManager) version of the overlay @@ -119,7 +120,8 @@ public: OutputDevice& GetOutputDevice() const { return mrOutputDevice; } // OVERLAYMANAGER - ::sdr::overlay::OverlayManager* GetOverlayManager() const; + rtl::Reference< ::sdr::overlay::OverlayManager > GetOverlayManager() const; + // #i73602# add flag if buffer shall be used void DrawOverlay(const Region& rRegion, bool bUseBuffer); diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 20509dc70052..869c2f95bdbe 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -176,9 +176,9 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr for(sal_uInt32 a(0); a < mrView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = mrView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if(xTargetOverlay.is()) { // buld transfoprmation: translate and rotate so that given edge is // on x axis, them mirror in y and translate back @@ -210,7 +210,7 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } } @@ -223,7 +223,7 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr aPolyPolygon.transform(aMatrixTransform); ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index db14b9abb10c..e94f02d4e918 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -176,6 +176,14 @@ namespace sdr } } + rtl::Reference<OverlayManager> OverlayManager::create( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager) + { + return rtl::Reference<OverlayManager>(new OverlayManager(rOutputDevice, + pOldOverlayManager)); + } + const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const { if(getOutputDevice().GetViewTransformation() != maViewTransformation) @@ -385,6 +393,20 @@ namespace sdr ImpStripeDefinitionChanged(); } } + + oslInterlockedCount OverlayManager::acquire() + { + return osl_incrementInterlockedCount( &mnRefCount ); + } + + oslInterlockedCount OverlayManager::release() + { + oslInterlockedCount nCount( osl_decrementInterlockedCount( &mnRefCount ) ); + if ( nCount == 0 ) + delete this; + return nCount; + } + } // end of namespace overlay } // end of namespace sdr diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 1a0016fa6b37..933e5e97ca70 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -219,6 +219,9 @@ namespace sdr IMPL_LINK(OverlayManagerBuffered, ImpBufferTimerHandler, AutoTimer*, /*pTimer*/) { + //Resolves: fdo#46728 ensure this exists until end of scope + rtl::Reference<OverlayManager> xRef(this); + // stop timer maBufferTimer.Stop(); @@ -412,6 +415,15 @@ namespace sdr maBufferTimer.SetTimeoutHdl(LINK(this, OverlayManagerBuffered, ImpBufferTimerHandler)); } + rtl::Reference<OverlayManager> OverlayManagerBuffered::create( + OutputDevice& rOutputDevice, + OverlayManager* pOldOverlayManager, + bool bRefreshWithPreRendering) + { + return rtl::Reference<OverlayManager>(new OverlayManagerBuffered(rOutputDevice, + pOldOverlayManager, bRefreshWithPreRendering)); + } + OverlayManagerBuffered::~OverlayManagerBuffered() { // Clear timer diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 9a4bcac9af51..48d2de4e69bb 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -147,7 +147,7 @@ sdr::contact::ObjectContact* SdrPageWindow::CreateViewSpecificObjectContact() } // OVERLAY MANAGER -::sdr::overlay::OverlayManager* SdrPageWindow::GetOverlayManager() const +rtl::Reference< ::sdr::overlay::OverlayManager > SdrPageWindow::GetOverlayManager() const { return GetPaintWindow().GetOverlayManager(); } diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index 1e0311b93939..02186241fc47 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -112,17 +112,17 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) // When the buffer usage has changed then we have to create a new // overlay manager. Save the current one so that later we can move its // overlay objects to the new one. - sdr::overlay::OverlayManager* pOldOverlayManager = NULL; + rtl::Reference<sdr::overlay::OverlayManager> xOldOverlayManager; if(mbUseBuffer != bUseBuffer) { mbUseBuffer = bUseBuffer; - pOldOverlayManager = mpOverlayManager; - mpOverlayManager = NULL; + xOldOverlayManager = mxOverlayManager; + mxOverlayManager.clear(); } // not yet one created? - if(!mpOverlayManager) + if(!mxOverlayManager.is()) { // is it a window? if(OUTDEV_WINDOW == GetOutputDevice().GetOutDevType()) @@ -135,7 +135,8 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) // whether that refresh itself will use a 2nd vdev to avoid flickering. // Also hand over the old OverlayManager if existent; this means to take over // the registered OverlayObjects from it - mpOverlayManager = new ::sdr::overlay::OverlayManagerBuffered(GetOutputDevice(), pOldOverlayManager, true); + mxOverlayManager = ::sdr::overlay::OverlayManagerBuffered::create(GetOutputDevice(), + xOldOverlayManager.get(), true); } else { @@ -143,10 +144,11 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) // take place // Also hand over the old OverlayManager if existent; this means to take over // the registered OverlayObjects from it - mpOverlayManager = new ::sdr::overlay::OverlayManager(GetOutputDevice(), pOldOverlayManager); + mxOverlayManager = ::sdr::overlay::OverlayManager::create(GetOutputDevice(), + xOldOverlayManager.get()); } - OSL_ENSURE(mpOverlayManager, "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)"); + OSL_ENSURE(mxOverlayManager.is(), "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)"); // Request a repaint so that the buffered overlay manager fills // its buffer properly. This is a workaround for missing buffer @@ -164,25 +166,16 @@ void SdrPaintWindow::impCreateOverlayManager(const bool bUseBuffer) aColB.Invert(); } - mpOverlayManager->setStripeColorA(aColA); - mpOverlayManager->setStripeColorB(aColB); - mpOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength()); + mxOverlayManager->setStripeColorA(aColA); + mxOverlayManager->setStripeColorB(aColB); + mxOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength()); } } - - // OverlayObjects are transfered for the in some cases newly created OverlayManager by handing over - // at construction time - if(pOldOverlayManager) - { - // The old overlay manager is not used any more and can be (has to be) deleted. - delete pOldOverlayManager; - } } SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut) : mrOutputDevice(rOut), mrPaintView(rNewPaintView), - mpOverlayManager(0L), mpPreRenderDevice(0L), mbTemporaryTarget(false), // #i72889# mbUseBuffer(true) @@ -191,24 +184,20 @@ SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut) SdrPaintWindow::~SdrPaintWindow() { - if(mpOverlayManager) - { - delete mpOverlayManager; - mpOverlayManager = 0L; - } + mxOverlayManager.clear(); DestroyPreRenderDevice(); } -::sdr::overlay::OverlayManager* SdrPaintWindow::GetOverlayManager() const +rtl::Reference< ::sdr::overlay::OverlayManager > SdrPaintWindow::GetOverlayManager() const { - if(!mpOverlayManager) + if(!mxOverlayManager.is()) { // Create buffered overlay manager by default. const_cast< SdrPaintWindow* >(this)->impCreateOverlayManager(true); } - return mpOverlayManager; + return mxOverlayManager; } Rectangle SdrPaintWindow::GetVisibleArea() const @@ -273,15 +262,15 @@ void SdrPaintWindow::DrawOverlay(const Region& rRegion, bool bUseBuffer) // save the background to get a controlled start into overlay mechanism impCreateOverlayManager(bUseBuffer); - if(mpOverlayManager && !OutputToPrinter()) + if(mxOverlayManager.is() && !OutputToPrinter()) { if(mpPreRenderDevice && bUseBuffer) { - mpOverlayManager->completeRedraw(rRegion, &mpPreRenderDevice->GetPreRenderDevice()); + mxOverlayManager->completeRedraw(rRegion, &mpPreRenderDevice->GetPreRenderDevice()); } else { - mpOverlayManager->completeRedraw(rRegion); + mxOverlayManager->completeRedraw(rRegion); } } } diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 3d113eda2d74..546f143682da 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -76,15 +76,15 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if(xTargetOverlay.is()) { - Size aHalfLogicSize(pTargetOverlay->getOutputDevice().PixelToLogic(Size(4, 4))); + Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4, 4))); // object ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aB2DPolyPolygon); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); // glue points @@ -109,7 +109,7 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S aTempPolyPoly.append(aTempPoly); pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aTempPolyPoly); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } } @@ -153,9 +153,9 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); + rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pCandidate->GetOverlayManager(); - if(pOverlayManager) + if (xOverlayManager.is()) { if(pObject) { @@ -163,14 +163,14 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence(); sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); - pOverlayManager->add(*pNew); + xOverlayManager->add(*pNew); maObjects.append(*pNew); } if(rPolyPoly.count()) { ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(rPolyPoly); - pOverlayManager->add(*pNew); + xOverlayManager->add(*pNew); maObjects.append(*pNew); } } @@ -857,11 +857,11 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/) for(sal_uInt32 a(0); a < PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = GetPaintWindow(a); - sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); + rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pCandidate->GetOverlayManager(); - if(pOverlayManager) + if (xOverlayManager.is()) { - pOverlayManager->flush(); + xOverlayManager->flush(); } } } diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index b1d66bf26305..0baddd30db0d 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -829,14 +829,14 @@ void SdrDragView::ShowDragObj() for(sal_uInt32 a(0); a < PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = GetPaintWindow(a); - sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager(); + rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pCandidate->GetOverlayManager(); - if(pOverlayManager) + if (xOverlayManager.is()) { - mpCurrentSdrDragMethod->CreateOverlayGeometry(*pOverlayManager); + mpCurrentSdrDragMethod->CreateOverlayGeometry(*xOverlayManager); // #i101679# Force changed overlay to be shown - pOverlayManager->flush(); + xOverlayManager->flush(); } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 6ac8941b6af7..818f8e7d6056 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -570,7 +570,8 @@ void SdrHdl::CreateB2dIAObject() aMoveOutsideOffset.X() += aOffset.Height(); } - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject( @@ -582,7 +583,7 @@ void SdrHdl::CreateB2dIAObject() // OVERLAYMANAGER if(pNewOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -929,7 +930,8 @@ void SdrHdlColor::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { Bitmap aBmpCol(CreateColorDropper(aMarkerColor)); basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); @@ -945,7 +947,7 @@ void SdrHdlColor::CreateB2dIAObject() // OVERLAYMANAGER if(pNewOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1096,7 +1098,8 @@ void SdrHdlGradient::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { // striped line in between basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y()); @@ -1119,7 +1122,7 @@ void SdrHdlGradient::CreateB2dIAObject() DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)); - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); // arrowhead @@ -1141,7 +1144,7 @@ void SdrHdlGradient::CreateB2dIAObject() ); DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1255,7 +1258,8 @@ void SdrHdlLine::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y()); basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y()); @@ -1273,7 +1277,7 @@ void SdrHdlLine::CreateB2dIAObject() // color(?) pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED)); - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1315,7 +1319,8 @@ void SdrHdlBezWgt::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y()); basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y()); @@ -1338,7 +1343,7 @@ void SdrHdlBezWgt::CreateB2dIAObject() // color(?) pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE)); - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1376,20 +1381,20 @@ void E3dVolumeMarker::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager() && aWireframePoly.count()) - { - ::sdr::overlay::OverlayObject* pNewOverlayObject = new - ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is() && aWireframePoly.count()) + { + ::sdr::overlay::OverlayObject* pNewOverlayObject = new + ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly); + DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); - // OVERLAYMANAGER - if(pNewOverlayObject) - { - pNewOverlayObject->setBaseColor(Color(COL_BLACK)); + // OVERLAYMANAGER + if(pNewOverlayObject) + { + pNewOverlayObject->setBaseColor(Color(COL_BLACK)); - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -1397,6 +1402,7 @@ void E3dVolumeMarker::CreateB2dIAObject() } } } +} //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1441,7 +1447,8 @@ void ImpEdgeHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); @@ -1453,7 +1460,7 @@ void ImpEdgeHdl::CreateB2dIAObject() // OVERLAYMANAGER if(pNewOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1561,7 +1568,8 @@ void ImpMeasureHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); @@ -1573,7 +1581,7 @@ void ImpMeasureHdl::CreateB2dIAObject() // OVERLAYMANAGER if(pNewOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -1624,7 +1632,8 @@ void ImpTextframeHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top()); const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom()); @@ -1644,7 +1653,7 @@ void ImpTextframeHdl::CreateB2dIAObject() // OVERLAYMANAGER if(pNewOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); + xManager->add(*pNewOverlayObject); maOverlayGroup.append(*pNewOverlayObject); } } @@ -2264,7 +2273,8 @@ void SdrCropHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); @@ -2297,7 +2307,7 @@ void SdrCropHdl::CreateB2dIAObject() // OVERLAYMANAGER if(pOverlayObject) { - rPageWindow.GetOverlayManager()->add(*pOverlayObject); + xManager->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); } } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 3729c02b5f7e..9ef1e738745b 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -93,13 +93,13 @@ ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx: for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if (xTargetOverlay.is()) { ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped( rStartPos, rStartPos, false); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } } diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index fb8157bd9004..52c37a187f80 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -64,13 +64,13 @@ ImplPageOriginOverlay::ImplPageOriginOverlay(const SdrPaintView& rView, const ba for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if (xTargetOverlay.is()) { ::sdr::overlay::OverlayCrosshairStriped* aNew = new ::sdr::overlay::OverlayCrosshairStriped( maPosition); - pTargetOverlay->add(*aNew); + xTargetOverlay->add(*aNew); maObjects.append(*aNew); } } @@ -142,13 +142,13 @@ ImplHelpLineOverlay::ImplHelpLineOverlay( for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if (xTargetOverlay.is()) { ::sdr::overlay::OverlayHelplineStriped* aNew = new ::sdr::overlay::OverlayHelplineStriped( maPosition, meHelpLineKind); - pTargetOverlay->add(*aNew); + xTargetOverlay->add(*aNew); maObjects.append(*aNew); } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index e7ffe85f2a09..074669421536 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -104,13 +104,13 @@ void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegf for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++) { SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); - ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); + rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager(); - if(pTargetOverlay) + if (xTargetOverlay.is()) { ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped( rPolyPolygon); - pTargetOverlay->add(*pNew); + xTargetOverlay->add(*pNew); maObjects.append(*pNew); } } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 736e40041148..f3ca36ff81ca 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1935,15 +1935,15 @@ void SvxTableController::updateSelectionOverlay() SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(nIndex); if( pPaintWindow ) { - ::sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager(); - if( pOverlayManager ) + rtl::Reference < ::sdr::overlay::OverlayManager > xOverlayManager = pPaintWindow->GetOverlayManager(); + if( xOverlayManager.is() ) { // sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_INVERT; sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_TRANSPARENT; sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); - pOverlayManager->add(*pOverlay); + xOverlayManager->add(*pOverlay); mpSelectionOverlay = new ::sdr::overlay::OverlayObjectList; mpSelectionOverlay->append(*pOverlay); } diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 73a980ac06c3..7b1db08662ac 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -181,13 +181,14 @@ void TableEdgeHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { if(aVisible.count()) { // create overlay object for visible parts sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aVisible, true); - rPageWindow.GetOverlayManager()->add(*pOverlayObject); + xManager->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); } @@ -197,7 +198,7 @@ void TableEdgeHdl::CreateB2dIAObject() // a standard HitTest using the primitives from that overlay object // (see OverlayTableEdge implementation) sdr::overlay::OverlayObject* pOverlayObject = new OverlayTableEdge(aInvisible, false); - rPageWindow.GetOverlayManager()->add(*pOverlayObject); + xManager->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); } } @@ -286,7 +287,8 @@ void TableBorderHdl::CreateB2dIAObject() if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + rtl::Reference< ::sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); + if (xManager.is()) { const basegfx::B2DRange aRange(vcl::unotools::b2DRectangleFromRectangle(maRectangle)); sdr::overlay::OverlayObject* pOverlayObject = new sdr::overlay::OverlayHatchRect( @@ -298,7 +300,7 @@ void TableBorderHdl::CreateB2dIAObject() 45 * F_PI180, 0.0); - rPageWindow.GetOverlayManager()->add(*pOverlayObject); + xManager->add(*pOverlayObject); maOverlayGroup.append(*pOverlayObject); } } |