summaryrefslogtreecommitdiff
path: root/svx/source/sdr/contact/viewcontactofunocontrol.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr/contact/viewcontactofunocontrol.cxx')
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx40
1 files changed, 11 insertions, 29 deletions
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index 5c23e3e1fe..1de8ffd792 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -121,36 +121,18 @@ namespace sdr { namespace contact {
//--------------------------------------------------------------------
ViewObjectContact& ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact )
{
+ // print or print preview requires special handling
+ const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice();
+ bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER );
+
ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact );
- if ( pPageViewContact )
- {
- // special classes for special devices:
- // - PDF export
- ::vcl::PDFExtOutDevData* pPDFExport = PTR_CAST( ::vcl::PDFExtOutDevData, pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetExtOutDevData() );
- if ( pPDFExport != NULL )
- return *new UnoControlPDFExportContact( *pPageViewContact, *this );
-
- // - print preview
- if ( pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview() )
- return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
-
- OutDevType eDeviceType = pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetOutDevType();
- // - printing
- if ( eDeviceType == OUTDEV_PRINTER )
- return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
-
- // - any other virtual device
- if ( eDeviceType == OUTDEV_VIRDEV )
- return *new UnoControlDefaultContact( *pPageViewContact, *this );
-
- // - normal windows have special, design-mode dependent handling
- if ( eDeviceType == OUTDEV_WINDOW )
- return *new UnoControlWindowContact( *pPageViewContact, *this );
- }
+ bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview();
+
+ if ( bPrintOrPreview )
+ return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
- // if we're not working for a ObjectContactOfPageView, then we can't use a ViewObjectContactOfUnoControl, or any
- // of its derivees. Fall back to a "normal" SdrObj's contact object.
- return *new ViewObjectContactOfSdrObj( _rObjectContact, *this );
+ // all others are nowadays served by the same implementation
+ return *new ViewObjectContactOfUnoControl( _rObjectContact, *this );
}
//--------------------------------------------------------------------
@@ -173,7 +155,7 @@ namespace sdr { namespace contact {
aTransform.set(0, 2, aRange.getMinX());
aTransform.set(1, 2, aRange.getMinY());
- // create control primitive WITHOUT evtl. existing XControl; this would be done in
+ // create control primitive WITHOUT possibly existing XControl; this would be done in
// the VOC in createPrimitive2DSequence()
const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D(
aTransform, xControlModel));