xref: /aoo41x/main/sd/source/ui/inc/framework/Pane.hxx (revision c45d927a)
1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew 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 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     //----- XPane -------------------------------------------------------------
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     /** For a UNO API based implementation of a view this may the most
101cdf0e10cSrcweir         important method of this class because the view is only interested
102cdf0e10cSrcweir         in the window of the pane.
103cdf0e10cSrcweir     */
104cdf0e10cSrcweir     virtual cssu::Reference<css::awt::XWindow>
105cdf0e10cSrcweir         SAL_CALL getWindow (void)
106cdf0e10cSrcweir         throw (cssu::RuntimeException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     virtual cssu::Reference<css::rendering::XCanvas>
109cdf0e10cSrcweir         SAL_CALL getCanvas (void)
110cdf0e10cSrcweir         throw (cssu::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     //----- XPane2 -------------------------------------------------------------
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isVisible (void)
116cdf0e10cSrcweir         throw (cssu::RuntimeException);
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
119cdf0e10cSrcweir         throw (cssu::RuntimeException);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
122cdf0e10cSrcweir         throw (cssu::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     virtual void SAL_CALL setAccessible (
125cdf0e10cSrcweir         const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
126cdf0e10cSrcweir         throw (cssu::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     //----- XResource ---------------------------------------------------------
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
132cdf0e10cSrcweir         SAL_CALL getResourceId (void)
133cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     /** For the typical pane it makes no sense to be dislayed without a
136cdf0e10cSrcweir         view.  Therefore this default implementation returns always <TRUE/>.
137cdf0e10cSrcweir     */
138cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAnchorOnly (void)
139cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     //----- XUnoTunnel --------------------------------------------------------
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
145cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 
148cdf0e10cSrcweir protected:
149cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
150cdf0e10cSrcweir     ::Window* mpWindow;
151cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
152cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     /** Overload this method, not getCanvas(), when you want to provide a
155cdf0e10cSrcweir         different canvas.
156cdf0e10cSrcweir     */
157cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
158cdf0e10cSrcweir         CreateCanvas (void)
159cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     /** Throw DisposedException when the object has already been disposed or
162cdf0e10cSrcweir         is currently being disposed.  Otherwise this method returns
163cdf0e10cSrcweir         normally.
164cdf0e10cSrcweir     */
165cdf0e10cSrcweir     void ThrowIfDisposed (void) const
166cdf0e10cSrcweir         throw (::com::sun::star::lang::DisposedException);
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir } } // end of namespace sd::framework
170cdf0e10cSrcweir 
171cdf0e10cSrcweir #endif
172