update dev300-m58
[ooovba.git] / canvas / source / vcl / windowoutdevholder.hxx
blob0f230365eba772f6bcc7ac526293669c81d79928
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: windowoutdevholder.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _VCLCANVAS_WINDOWOUTDEVHOLDER_HXX
32 #define _VCLCANVAS_WINDOWOUTDEVHOLDER_HXX
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <com/sun/star/awt/XWindow.hpp>
36 #include <vcl/window.hxx>
38 #include "outdevprovider.hxx"
40 #include <boost/utility.hpp>
42 namespace vclcanvas
44 class WindowOutDevHolder : public OutDevProvider,
45 private ::boost::noncopyable
47 public:
48 explicit WindowOutDevHolder( const ::com::sun::star::uno::Reference<
49 ::com::sun::star::awt::XWindow>& xWin );
51 private:
52 virtual OutputDevice& getOutDev() { return mrOutputWindow; }
53 virtual const OutputDevice& getOutDev() const { return mrOutputWindow; }
55 // TODO(Q2): Lifetime issue. Though WindowGraphicDeviceBase
56 // now listenes to the window component, I still consider
57 // holding a naked reference unsafe here (especially as we
58 // pass it around via getOutDev). This _only_ works reliably,
59 // if disposing the SpriteCanvas correctly disposes all
60 // entities which hold this pointer.
61 // So: as soon as the protocol inside
62 // vcl/source/window/window.cxx is broken, that disposes the
63 // canvas during window deletion, we're riding a dead horse
64 // here
65 Window& mrOutputWindow;
69 #endif /* _VCLCANVAS_WINDOWOUTDEVHOLDER_HXX */