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