Update ooo320-m1
[ooovba.git] / svx / source / sdr / contact / objectcontacttools.cxx
blob42f186fbc20b6592b3d4d58315b0beff5ec15b1d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: objectcontacttools.cxx,v $
11 * $Revision: 1.2.18.1 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_svx.hxx"
35 #include <svx/sdr/contact/objectcontacttools.hxx>
36 #include <vcl/outdev.hxx>
37 #include <basegfx/matrix/b2dhommatrix.hxx>
38 #include <basegfx/range/b2drange.hxx>
39 #include <vcl/gdimtf.hxx>
40 #include <basegfx/tools/canvastools.hxx>
41 #include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx>
42 #include <drawinglayer/processor2d/vclpixelprocessor2d.hxx>
43 #include <drawinglayer/processor2d/canvasprocessor.hxx>
44 #include <vcl/window.hxx>
46 //////////////////////////////////////////////////////////////////////////////
48 using namespace com::sun::star;
50 //////////////////////////////////////////////////////////////////////////////
52 namespace sdr
54 namespace contact
56 drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
57 OutputDevice& rTargetOutDev,
58 const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
60 const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile();
61 const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
63 if(bOutputToRecordingMetaFile)
65 // create MetaFile Vcl-Processor and process
66 return new drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev);
68 else
70 #ifdef WIN32
71 // for a first AA incarnation VCL-PixelRenderer will be okay since
72 // simple (and fast) GDIPlus support over VCL will be used.
73 // Leaving the code below as a hint for what to do when we will
74 // use canvas renderers in the future
76 //static SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
78 //if(false && aSvtOptionsDrawinglayer.IsAntiAliasing())
79 //{
80 // // for WIN32 AA, create cairo canvas processor
81 // return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
82 //}
83 //else
84 //{
85 // create Pixel Vcl-Processor
86 return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
87 //}
88 #else
89 static bool bTryTestCanvas(false);
91 if(bTryTestCanvas)
93 // create test-cancas-Processor
94 return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
96 else
98 // create Pixel Vcl-Processor
99 return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
101 #endif
104 } // end of namespace contact
105 } // end of namespace sdr
107 //////////////////////////////////////////////////////////////////////////////
108 // eof