xref: /aoo41x/main/sd/source/ui/inc/framework/Pane.hxx (revision 7a32b0c8)
1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c45d927aSAndrew Rist  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19c45d927aSAndrew Rist  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_FRAMEWORK_PANE_HXX
25cdf0e10cSrcweir #define SD_FRAMEWORK_PANE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "MutexOwner.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane2.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/framework/TabBarButton.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
33cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx>
34cdf0e10cSrcweir #include <tools/link.hxx>
35cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
36cdf0e10cSrcweir #include <boost/weak_ptr.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class Window;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace css = ::com::sun::star;
41cdf0e10cSrcweir namespace cssu = ::com::sun::star::uno;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper3 <
46cdf0e10cSrcweir     ::com::sun::star::drawing::framework::XPane,
47cdf0e10cSrcweir     ::com::sun::star::drawing::framework::XPane2,
48cdf0e10cSrcweir       ::com::sun::star::lang::XUnoTunnel
49cdf0e10cSrcweir     > PaneInterfaceBase;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir } // end of anonymous namespace.
52cdf0e10cSrcweir 
53cdf0e10cSrcweir namespace sd { namespace framework {
54cdf0e10cSrcweir 
55cdf0e10cSrcweir /** A pane is a wrapper for a window and possibly for a tab bar (for view
56cdf0e10cSrcweir     switching).  Panes are unique resources.
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     This class has two responsibilities:
59cdf0e10cSrcweir     1. It implements the XPane interface.  This is the most important
60cdf0e10cSrcweir     interface of this class for API based views (of which there not that
61cdf0e10cSrcweir     many yet) because it gives access to the XWindow.
62cdf0e10cSrcweir     2. It gives access to the underlying VCL Window by implementing the
63cdf0e10cSrcweir     XUnoTunnel interface.  This is necessary at the moment and in the
64cdf0e10cSrcweir     foreseeable future because many parts of the Draw and Impress views rely
65cdf0e10cSrcweir     on direct access on the Window class.
66cdf0e10cSrcweir */
67cdf0e10cSrcweir class Pane
68cdf0e10cSrcweir     : protected MutexOwner,
69cdf0e10cSrcweir       public PaneInterfaceBase
70cdf0e10cSrcweir {
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir     /** Create a new Pane object that wrapps the given window.
73cdf0e10cSrcweir         @param rsPaneURL
74cdf0e10cSrcweir             The URL that is used by the configuration to identify the pane.
75cdf0e10cSrcweir             The given URL has to be valid.
76cdf0e10cSrcweir         @param pWindow
77cdf0e10cSrcweir             The VCL Window (usually this really is an sd::Window) that is
78cdf0e10cSrcweir             wrapped by the new Pane object.  The given pointer must not be
79cdf0e10cSrcweir             NULL.
80cdf0e10cSrcweir     */
81cdf0e10cSrcweir 	Pane (
82cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
83cdf0e10cSrcweir             com::sun::star::drawing::framework::XResourceId>& rxPaneId,
84cdf0e10cSrcweir         ::Window* pWindow)
85cdf0e10cSrcweir         throw ();
86cdf0e10cSrcweir 	virtual ~Pane (void) throw();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /** This method is typically used together with the XUnoTunnel to obtain
93cdf0e10cSrcweir         a Window pointer from an XPane object.
94cdf0e10cSrcweir     */
95cdf0e10cSrcweir     virtual ::Window* GetWindow (void);
96cdf0e10cSrcweir 
97*7a32b0c8SAndre Fischer     void SetWindow (::Window* pWindow);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     //----- XPane -------------------------------------------------------------
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     /** For a UNO API based implementation of a view this may the most
102cdf0e10cSrcweir         important method of this class because the view is only interested
103cdf0e10cSrcweir         in the window of the pane.
104cdf0e10cSrcweir     */
105cdf0e10cSrcweir     virtual cssu::Reference<css::awt::XWindow>
106cdf0e10cSrcweir         SAL_CALL getWindow (void)
107cdf0e10cSrcweir         throw (cssu::RuntimeException);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     virtual cssu::Reference<css::rendering::XCanvas>
110cdf0e10cSrcweir         SAL_CALL getCanvas (void)
111cdf0e10cSrcweir         throw (cssu::RuntimeException);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     //----- XPane2 -------------------------------------------------------------
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isVisible (void)
117cdf0e10cSrcweir         throw (cssu::RuntimeException);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
120cdf0e10cSrcweir         throw (cssu::RuntimeException);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
123cdf0e10cSrcweir         throw (cssu::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     virtual void SAL_CALL setAccessible (
126cdf0e10cSrcweir         const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
127cdf0e10cSrcweir         throw (cssu::RuntimeException);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     //----- XResource ---------------------------------------------------------
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
133cdf0e10cSrcweir         SAL_CALL getResourceId (void)
134cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     /** For the typical pane it makes no sense to be dislayed without a
137cdf0e10cSrcweir         view.  Therefore this default implementation returns always <TRUE/>.
138cdf0e10cSrcweir     */
139cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAnchorOnly (void)
140cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     //----- XUnoTunnel --------------------------------------------------------
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
146cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir protected:
150cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
151cdf0e10cSrcweir     ::Window* mpWindow;
152cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
153cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     /** Overload this method, not getCanvas(), when you want to provide a
156cdf0e10cSrcweir         different canvas.
157cdf0e10cSrcweir     */
158cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
159cdf0e10cSrcweir         CreateCanvas (void)
160cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     /** Throw DisposedException when the object has already been disposed or
163cdf0e10cSrcweir         is currently being disposed.  Otherwise this method returns
164cdf0e10cSrcweir         normally.
165cdf0e10cSrcweir     */
166cdf0e10cSrcweir     void ThrowIfDisposed (void) const
167cdf0e10cSrcweir         throw (::com::sun::star::lang::DisposedException);
168cdf0e10cSrcweir };
169cdf0e10cSrcweir 
170cdf0e10cSrcweir } } // end of namespace sd::framework
171cdf0e10cSrcweir 
172cdf0e10cSrcweir #endif
173