merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / framework / Pane.hxx
blobda9b88a22fd70540e4bf56d10f84711edf93e0b8
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/XPane2.hpp>
38 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
39 #include <com/sun/star/lang/XUnoTunnel.hpp>
40 #include <cppuhelper/compbase3.hxx>
41 #include <tools/link.hxx>
42 #include <boost/shared_ptr.hpp>
43 #include <boost/weak_ptr.hpp>
45 class Window;
47 namespace css = ::com::sun::star;
48 namespace cssu = ::com::sun::star::uno;
50 namespace {
52 typedef ::cppu::WeakComponentImplHelper3 <
53 ::com::sun::star::drawing::framework::XPane,
54 ::com::sun::star::drawing::framework::XPane2,
55 ::com::sun::star::lang::XUnoTunnel
56 > PaneInterfaceBase;
58 } // end of anonymous namespace.
60 namespace sd { namespace framework {
62 /** A pane is a wrapper for a window and possibly for a tab bar (for view
63 switching). Panes are unique resources.
65 This class has two responsibilities:
66 1. It implements the XPane interface. This is the most important
67 interface of this class for API based views (of which there not that
68 many yet) because it gives access to the XWindow.
69 2. It gives access to the underlying VCL Window by implementing the
70 XUnoTunnel interface. This is necessary at the moment and in the
71 foreseeable future because many parts of the Draw and Impress views rely
72 on direct access on the Window class.
74 class Pane
75 : protected MutexOwner,
76 public PaneInterfaceBase
78 public:
79 /** Create a new Pane object that wrapps the given window.
80 @param rsPaneURL
81 The URL that is used by the configuration to identify the pane.
82 The given URL has to be valid.
83 @param pWindow
84 The VCL Window (usually this really is an sd::Window) that is
85 wrapped by the new Pane object. The given pointer must not be
86 NULL.
88 Pane (
89 const ::com::sun::star::uno::Reference<
90 com::sun::star::drawing::framework::XResourceId>& rxPaneId,
91 ::Window* pWindow)
92 throw ();
93 virtual ~Pane (void) throw();
95 virtual void SAL_CALL disposing (void);
97 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
99 /** This method is typically used together with the XUnoTunnel to obtain
100 a Window pointer from an XPane object.
102 virtual ::Window* GetWindow (void);
105 //----- XPane -------------------------------------------------------------
107 /** For a UNO API based implementation of a view this may the most
108 important method of this class because the view is only interested
109 in the window of the pane.
111 virtual cssu::Reference<css::awt::XWindow>
112 SAL_CALL getWindow (void)
113 throw (cssu::RuntimeException);
115 virtual cssu::Reference<css::rendering::XCanvas>
116 SAL_CALL getCanvas (void)
117 throw (cssu::RuntimeException);
120 //----- XPane2 -------------------------------------------------------------
122 virtual sal_Bool SAL_CALL isVisible (void)
123 throw (cssu::RuntimeException);
125 virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
126 throw (cssu::RuntimeException);
128 virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
129 throw (cssu::RuntimeException);
131 virtual void SAL_CALL setAccessible (
132 const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
133 throw (cssu::RuntimeException);
136 //----- XResource ---------------------------------------------------------
138 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
139 SAL_CALL getResourceId (void)
140 throw (::com::sun::star::uno::RuntimeException);
142 /** For the typical pane it makes no sense to be dislayed without a
143 view. Therefore this default implementation returns always <TRUE/>.
145 virtual sal_Bool SAL_CALL isAnchorOnly (void)
146 throw (com::sun::star::uno::RuntimeException);
149 //----- XUnoTunnel --------------------------------------------------------
151 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
152 throw (com::sun::star::uno::RuntimeException);
155 protected:
156 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
157 ::Window* mpWindow;
158 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
159 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
161 /** Overload this method, not getCanvas(), when you want to provide a
162 different canvas.
164 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
165 CreateCanvas (void)
166 throw (::com::sun::star::uno::RuntimeException);
168 /** Throw DisposedException when the object has already been disposed or
169 is currently being disposed. Otherwise this method returns
170 normally.
172 void ThrowIfDisposed (void) const
173 throw (::com::sun::star::lang::DisposedException);
176 } } // end of namespace sd::framework
178 #endif