Extract getPageWindowOutputDevice to a common place
Change-Id: Idef06778251d7437cfce2151c6fb9654db04d3a4
This commit is contained in:
@@ -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
|
||||
|
@@ -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())
|
||||
if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType())
|
||||
{
|
||||
// #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())
|
||||
{
|
||||
pRetval = static_cast< Window* >(&rOutDev);
|
||||
pRetval = static_cast< Window* >(&const_cast<OutputDevice&>(oPageOutputDev.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user