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_CHILD_WINDOW_PANE_HXX
25cdf0e10cSrcweir #define SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "framework/Pane.hxx"
28cdf0e10cSrcweir #include "PaneShells.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
31cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DRAWING_FRAMEWORK_XRESOURCEID_HPP_
34cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceId.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
37cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE1_HXX_
40cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COMPHELPER_UNO3_HXX_
43cdf0e10cSrcweir #include <comphelper/uno3.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #include <tools/link.hxx>
46cdf0e10cSrcweir #include <memory>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace {
49cdf0e10cSrcweir 
50cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1 <
51cdf0e10cSrcweir     ::sd::framework::Pane,
52cdf0e10cSrcweir     ::com::sun::star::lang::XEventListener
53cdf0e10cSrcweir     > ChildWindowPaneInterfaceBase;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir } // end of anonymous namespace.
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class SfxViewFrame;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace sd { class ViewShellBase; }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir namespace sd { namespace framework {
63cdf0e10cSrcweir 
64cdf0e10cSrcweir /** The ChildWindowPane listens to the child window and disposes itself when
65cdf0e10cSrcweir     the child window becomes inaccessible.  This happens for instance when a
66cdf0e10cSrcweir     document is made read-only and the task pane is turned off.
67cdf0e10cSrcweir */
68cdf0e10cSrcweir class ChildWindowPane
69cdf0e10cSrcweir     : public ChildWindowPaneInterfaceBase
70cdf0e10cSrcweir {
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir 	ChildWindowPane (
73cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
74cdf0e10cSrcweir             ::com::sun::star::drawing::framework::XResourceId>& rxPaneId,
75cdf0e10cSrcweir         sal_uInt16 nChildWindowId,
76cdf0e10cSrcweir         ViewShellBase& rViewShellBase,
77cdf0e10cSrcweir         ::std::auto_ptr<SfxShell> pShell);
78cdf0e10cSrcweir     virtual ~ChildWindowPane (void) throw();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     /** Hide the pane.  To make the pane visible again, call GetWindow().
81cdf0e10cSrcweir     */
82cdf0e10cSrcweir     void Hide (void);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     /** This returns the content window when the child window is already
87cdf0e10cSrcweir         visible.  Otherwise <NULL/> is returned.  In that case a later call
88cdf0e10cSrcweir         may return the requested window (making a child window visible is an
89cdf0e10cSrcweir         asynchronous process.)
90cdf0e10cSrcweir         Note that GetWindow() may return different Window pointers when
91cdf0e10cSrcweir         Hide() is called in between.
92cdf0e10cSrcweir     */
93cdf0e10cSrcweir     virtual ::Window* GetWindow (void);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     /** The local getWindow() first calls GetWindow() to provide a valid
96cdf0e10cSrcweir         window pointer before forwarding the call to the base class.
97cdf0e10cSrcweir     */
98cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
99cdf0e10cSrcweir         SAL_CALL getWindow (void)
100cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     DECLARE_XINTERFACE()
103cdf0e10cSrcweir 	DECLARE_XTYPEPROVIDER()
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // XEventListener
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     virtual void SAL_CALL disposing(
109cdf0e10cSrcweir         const com::sun::star::lang::EventObject& rEvent)
110cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir private:
113cdf0e10cSrcweir     ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
114cdf0e10cSrcweir     sal_uInt16 mnChildWindowId;
115cdf0e10cSrcweir     ViewShellBase& mrViewShellBase;
116cdf0e10cSrcweir     ::std::auto_ptr<SfxShell> mpShell;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     /** This flag is set when the pane shell has been activated at least
119cdf0e10cSrcweir         once.  It is used to optimize the start-up performance (by not
120cdf0e10cSrcweir         showing the window too early) and by not delaying its creation at
121cdf0e10cSrcweir         later times.
122cdf0e10cSrcweir     */
123cdf0e10cSrcweir     bool mbHasBeenActivated;
124cdf0e10cSrcweir };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir } } // end of namespace sd::framework
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #endif
129