xref: /aoo41x/main/sd/source/ui/inc/framework/Pane.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SD_FRAMEWORK_PANE_HXX
29*cdf0e10cSrcweir #define SD_FRAMEWORK_PANE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "MutexOwner.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane2.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/TabBarButton.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
37*cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx>
38*cdf0e10cSrcweir #include <tools/link.hxx>
39*cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
40*cdf0e10cSrcweir #include <boost/weak_ptr.hpp>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir class Window;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace css = ::com::sun::star;
45*cdf0e10cSrcweir namespace cssu = ::com::sun::star::uno;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir namespace {
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper3 <
50*cdf0e10cSrcweir     ::com::sun::star::drawing::framework::XPane,
51*cdf0e10cSrcweir     ::com::sun::star::drawing::framework::XPane2,
52*cdf0e10cSrcweir       ::com::sun::star::lang::XUnoTunnel
53*cdf0e10cSrcweir     > PaneInterfaceBase;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir } // end of anonymous namespace.
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir namespace sd { namespace framework {
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir /** A pane is a wrapper for a window and possibly for a tab bar (for view
60*cdf0e10cSrcweir     switching).  Panes are unique resources.
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     This class has two responsibilities:
63*cdf0e10cSrcweir     1. It implements the XPane interface.  This is the most important
64*cdf0e10cSrcweir     interface of this class for API based views (of which there not that
65*cdf0e10cSrcweir     many yet) because it gives access to the XWindow.
66*cdf0e10cSrcweir     2. It gives access to the underlying VCL Window by implementing the
67*cdf0e10cSrcweir     XUnoTunnel interface.  This is necessary at the moment and in the
68*cdf0e10cSrcweir     foreseeable future because many parts of the Draw and Impress views rely
69*cdf0e10cSrcweir     on direct access on the Window class.
70*cdf0e10cSrcweir */
71*cdf0e10cSrcweir class Pane
72*cdf0e10cSrcweir     : protected MutexOwner,
73*cdf0e10cSrcweir       public PaneInterfaceBase
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir public:
76*cdf0e10cSrcweir     /** Create a new Pane object that wrapps the given window.
77*cdf0e10cSrcweir         @param rsPaneURL
78*cdf0e10cSrcweir             The URL that is used by the configuration to identify the pane.
79*cdf0e10cSrcweir             The given URL has to be valid.
80*cdf0e10cSrcweir         @param pWindow
81*cdf0e10cSrcweir             The VCL Window (usually this really is an sd::Window) that is
82*cdf0e10cSrcweir             wrapped by the new Pane object.  The given pointer must not be
83*cdf0e10cSrcweir             NULL.
84*cdf0e10cSrcweir     */
85*cdf0e10cSrcweir 	Pane (
86*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
87*cdf0e10cSrcweir             com::sun::star::drawing::framework::XResourceId>& rxPaneId,
88*cdf0e10cSrcweir         ::Window* pWindow)
89*cdf0e10cSrcweir         throw ();
90*cdf0e10cSrcweir 	virtual ~Pane (void) throw();
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     /** This method is typically used together with the XUnoTunnel to obtain
97*cdf0e10cSrcweir         a Window pointer from an XPane object.
98*cdf0e10cSrcweir     */
99*cdf0e10cSrcweir     virtual ::Window* GetWindow (void);
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     //----- XPane -------------------------------------------------------------
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     /** For a UNO API based implementation of a view this may the most
105*cdf0e10cSrcweir         important method of this class because the view is only interested
106*cdf0e10cSrcweir         in the window of the pane.
107*cdf0e10cSrcweir     */
108*cdf0e10cSrcweir     virtual cssu::Reference<css::awt::XWindow>
109*cdf0e10cSrcweir         SAL_CALL getWindow (void)
110*cdf0e10cSrcweir         throw (cssu::RuntimeException);
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     virtual cssu::Reference<css::rendering::XCanvas>
113*cdf0e10cSrcweir         SAL_CALL getCanvas (void)
114*cdf0e10cSrcweir         throw (cssu::RuntimeException);
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     //----- XPane2 -------------------------------------------------------------
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isVisible (void)
120*cdf0e10cSrcweir         throw (cssu::RuntimeException);
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
123*cdf0e10cSrcweir         throw (cssu::RuntimeException);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
126*cdf0e10cSrcweir         throw (cssu::RuntimeException);
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir     virtual void SAL_CALL setAccessible (
129*cdf0e10cSrcweir         const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
130*cdf0e10cSrcweir         throw (cssu::RuntimeException);
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     //----- XResource ---------------------------------------------------------
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
136*cdf0e10cSrcweir         SAL_CALL getResourceId (void)
137*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     /** For the typical pane it makes no sense to be dislayed without a
140*cdf0e10cSrcweir         view.  Therefore this default implementation returns always <TRUE/>.
141*cdf0e10cSrcweir     */
142*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAnchorOnly (void)
143*cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir     //----- XUnoTunnel --------------------------------------------------------
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
149*cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir protected:
153*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
154*cdf0e10cSrcweir     ::Window* mpWindow;
155*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
156*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir     /** Overload this method, not getCanvas(), when you want to provide a
159*cdf0e10cSrcweir         different canvas.
160*cdf0e10cSrcweir     */
161*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
162*cdf0e10cSrcweir         CreateCanvas (void)
163*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     /** Throw DisposedException when the object has already been disposed or
166*cdf0e10cSrcweir         is currently being disposed.  Otherwise this method returns
167*cdf0e10cSrcweir         normally.
168*cdf0e10cSrcweir     */
169*cdf0e10cSrcweir     void ThrowIfDisposed (void) const
170*cdf0e10cSrcweir         throw (::com::sun::star::lang::DisposedException);
171*cdf0e10cSrcweir };
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir } } // end of namespace sd::framework
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir #endif
176