summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx14
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx26
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx22
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx37
4 files changed, 45 insertions, 54 deletions
diff --git a/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
index 548378731ba4..fdf64e887dc1 100644
--- a/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
+++ b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
@@ -21,12 +21,12 @@
#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
#include <svx/sdr/contact/viewobjectcontact.hxx>
-
+#include <boost/optional.hpp>
// predeclarations
class SdrObject;
class SetOfByte;
-
+class OutputDevice;
namespace sdr
@@ -51,6 +51,16 @@ namespace sdr
virtual ~ViewObjectContactOfSdrObj();
virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+
+ /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView
+
+ Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not
+ constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice
+ might be temporarily patched.
+
+ This method cares for this, by retrieving the very original OutputDevice.
+ */
+ boost::optional<const OutputDevice&> getPageViewOutputDevice() const;
};
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
index 8a4a20b7dd96..429ebbeef126 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
@@ -18,18 +18,16 @@
*/
-#include <svx/sdr/contact/objectcontactofpageview.hxx>
#include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/svdomedia.hxx>
#include <svx/svdpagv.hxx>
#include <vcl/outdev.hxx>
#include <vcl/window.hxx>
#include <avmedia/mediaitem.hxx>
#include "sdrmediawindow.hxx"
-#include <svx/sdrpagewindow.hxx>
-#include <svx/sdrpaintwindow.hxx>
@@ -69,26 +67,12 @@ Window* ViewObjectContactOfSdrMediaObj::getWindow() const
{
Window* pRetval = 0;
- const ObjectContactOfPageView* pObjectContactOfPageView = dynamic_cast< const ObjectContactOfPageView* >(&GetObjectContact());
-
- if(pObjectContactOfPageView)
+ boost::optional<const OutputDevice&> oPageOutputDev = getPageViewOutputDevice();
+ if( oPageOutputDev )
{
- const SdrPageWindow& rPageWindow = pObjectContactOfPageView->GetPageWindow();
- const SdrPaintWindow* pPaintWindow = &rPageWindow.GetPaintWindow();
-
- if(rPageWindow.GetOriginalPaintWindow())
- {
- // #i83183# prefer OriginalPaintWindow if set; this is
- // the real target device. GetPaintWindow() may return
- // the current buffer device instead
- pPaintWindow = rPageWindow.GetOriginalPaintWindow();
- }
-
- OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
-
- if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
+ if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType())
{
- pRetval = static_cast< Window* >(&rOutDev);
+ pRetval = static_cast< Window* >(&const_cast<OutputDevice&>(oPageOutputDev.get()));
}
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
index 3466acfbd393..2d4871a3da44 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
@@ -22,9 +22,13 @@
#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdview.hxx>
+#include <vcl/outdev.hxx>
#include "fmobj.hxx"
@@ -140,6 +144,24 @@ namespace sdr
return true;
}
+
+ boost::optional<const OutputDevice&> ViewObjectContactOfSdrObj::getPageViewOutputDevice() const
+ {
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &GetObjectContact() );
+ if ( pPageViewContact )
+ {
+ // if the PageWindow has a patched PaintWindow, use the original PaintWindow
+ // this ensures that our control is _not_ re-created just because somebody
+ // (temporarily) changed the window to paint onto.
+ // #i72429# / 2007-02-20 / frank.schoenheit (at) sun.com
+ SdrPageWindow& rPageWindow( pPageViewContact->GetPageWindow() );
+ if ( rPageWindow.GetOriginalPaintWindow() )
+ return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice();
+
+ return rPageWindow.GetPaintWindow().GetOutputDevice();
+ }
+ return boost::optional<const OutputDevice&>();
+ }
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 726a8c7ecad9..4b88239d8082 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -846,16 +846,6 @@ namespace sdr { namespace contact {
const basegfx::B2DHomMatrix& _rInitialViewTransformation
);
- /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView
-
- Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not
- constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice
- might be temporarily patched.
-
- This method cares for this, by retrieving the very original OutputDevice.
- */
- static const OutputDevice& impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact );
-
const OutputDevice& impl_getOutputDevice_throw() const;
private:
@@ -1051,7 +1041,7 @@ namespace sdr { namespace contact {
if ( pPageViewContact )
{
SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() );
- const OutputDevice& rDevice( impl_getPageViewOutputDevice_nothrow( *pPageViewContact ) );
+ const OutputDevice& rDevice( m_pAntiImpl->getPageViewOutputDevice().get() );
return impl_ensureControl_nothrow(
aPVAccess,
rDevice,
@@ -1071,13 +1061,11 @@ namespace sdr { namespace contact {
const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getOutputDevice_throw() const
{
- ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
- if ( pPageViewContact )
- {
- // do not use ObjectContact::TryToGetOutputDevice here, it would not care for the PageWindow's
- // OriginalPaintWindow
- return impl_getPageViewOutputDevice_nothrow( *pPageViewContact );
- }
+ // do not use ObjectContact::TryToGetOutputDevice, it would not care for the PageWindow's
+ // OriginalPaintWindow
+ boost::optional<const OutputDevice&> oPageOutputDev = m_pAntiImpl->getPageViewOutputDevice();
+ if( oPageOutputDev )
+ return oPageOutputDev.get();
const OutputDevice* pDevice = m_pAntiImpl->GetObjectContact().TryToGetOutputDevice();
ENSURE_OR_THROW( pDevice, "no output device -> no control" );
@@ -1085,19 +1073,6 @@ namespace sdr { namespace contact {
}
- const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact )
- {
- // if the PageWindow has a patched PaintWindow, use the original PaintWindow
- // this ensures that our control is _not_ re-created just because somebody
- // (temporarily) changed the window to paint onto.
- // #i72429# / 2007-02-20 / frank.schoenheit@sun.com
- SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() );
- if ( rPageWindow.GetOriginalPaintWindow() )
- return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice();
-
- return rPageWindow.GetPaintWindow().GetOutputDevice();
- }
-
namespace
{
static void lcl_resetFlag( bool& rbFlag )