update dev300-m58
[ooovba.git] / sd / source / ui / inc / framework / Pane.hxx
blobd65843275337779dfe998a96ae797510a20dc90e
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: Pane.hxx,v $
10 * $Revision: 1.4 $
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 SD_FRAMEWORK_PANE_HXX
32 #define SD_FRAMEWORK_PANE_HXX
34 #include "MutexOwner.hxx"
36 #include <com/sun/star/drawing/framework/XPane.hpp>
37 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #include <cppuhelper/compbase2.hxx>
40 #include <tools/link.hxx>
41 #include <boost/shared_ptr.hpp>
42 #include <boost/weak_ptr.hpp>
44 class Window;
46 namespace {
48 typedef ::cppu::WeakComponentImplHelper2 <
49 ::com::sun::star::drawing::framework::XPane,
50 ::com::sun::star::lang::XUnoTunnel
51 > PaneInterfaceBase;
53 } // end of anonymous namespace.
55 namespace sd { namespace framework {
57 /** A pane is a wrapper for a window and possibly for a tab bar (for view
58 switching). Panes are unique resources.
60 This class has two responsibilities:
61 1. It implements the XPane interface. This is the most important
62 interface of this class for API based views (of which there not that
63 many yet) because it gives access to the XWindow.
64 2. It gives access to the underlying VCL Window by implementing the
65 XUnoTunnel interface. This is necessary at the moment and in the
66 foreseeable future because many parts of the Draw and Impress views rely
67 on direct access on the Window class.
69 class Pane
70 : protected MutexOwner,
71 public PaneInterfaceBase
73 public:
74 /** Create a new Pane object that wrapps the given window.
75 @param rsPaneURL
76 The URL that is used by the configuration to identify the pane.
77 The given URL has to be valid.
78 @param pWindow
79 The VCL Window (usually this really is an sd::Window) that is
80 wrapped by the new Pane object. The given pointer must not be
81 NULL.
83 Pane (
84 const ::com::sun::star::uno::Reference<
85 com::sun::star::drawing::framework::XResourceId>& rxPaneId,
86 ::Window* pWindow)
87 throw ();
88 virtual ~Pane (void) throw();
90 virtual void SAL_CALL disposing (void);
92 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
94 /** This method is typically used together with the XUnoTunnel to obtain
95 a Window pointer from an XPane object.
97 virtual ::Window* GetWindow (void);
99 // XPane
101 /** For a UNO API based implementation of a view this may the most
102 important method of this class because the view is only interested
103 in the window of the pane.
105 virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
106 SAL_CALL getWindow (void)
107 throw (::com::sun::star::uno::RuntimeException);
109 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
110 SAL_CALL getCanvas (void)
111 throw (::com::sun::star::uno::RuntimeException);
114 // XResource
116 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
117 SAL_CALL getResourceId (void)
118 throw (::com::sun::star::uno::RuntimeException);
120 /** For the typical pane it makes no sense to be dislayed without a
121 view. Therefore this default implementation returns always <TRUE/>.
123 virtual sal_Bool SAL_CALL isAnchorOnly (void)
124 throw (com::sun::star::uno::RuntimeException);
127 // XUnoTunnel
129 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
130 throw (com::sun::star::uno::RuntimeException);
132 protected:
133 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
134 ::Window* mpWindow;
135 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
136 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
138 /** Overload this method, not getCanvas(), when you want to provide a
139 different canvas.
141 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
142 CreateCanvas (void)
143 throw (::com::sun::star::uno::RuntimeException);
145 /** Throw DisposedException when the object has already been disposed or
146 is currently being disposed. Otherwise this method returns
147 normally.
149 void ThrowIfDisposed (void) const
150 throw (::com::sun::star::lang::DisposedException);
153 } } // end of namespace sd::framework
155 #endif