merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / framework / factories / ChildWindowPane.hxx
blobb9b978b61cff40749054358a4b354896afe6f1a8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChildWindowPane.hxx,v $
11 * $Revision: 1.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
33 #define SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
35 #include "framework/Pane.hxx"
36 #include "PaneShells.hxx"
38 #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
39 #include <com/sun/star/lang/XEventListener.hpp>
40 #endif
41 #ifndef _COM_SUN_STAR_DRAWING_FRAMEWORK_XRESOURCEID_HPP_
42 #include <com/sun/star/drawing/framework/XResourceId.hpp>
43 #endif
44 #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
45 #include <com/sun/star/awt/XWindow.hpp>
46 #endif
47 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
48 #include <cppuhelper/implbase1.hxx>
49 #endif
50 #ifndef _COMPHELPER_UNO3_HXX_
51 #include <comphelper/uno3.hxx>
52 #endif
53 #include <tools/link.hxx>
54 #include <memory>
56 namespace {
58 typedef ::cppu::ImplInheritanceHelper1 <
59 ::sd::framework::Pane,
60 ::com::sun::star::lang::XEventListener
61 > ChildWindowPaneInterfaceBase;
63 } // end of anonymous namespace.
66 class SfxViewFrame;
68 namespace sd { class ViewShellBase; }
70 namespace sd { namespace framework {
72 /** The ChildWindowPane listens to the child window and disposes itself when
73 the child window becomes inaccessible. This happens for instance when a
74 document is made read-only and the task pane is turned off.
76 class ChildWindowPane
77 : public ChildWindowPaneInterfaceBase
79 public:
80 ChildWindowPane (
81 const ::com::sun::star::uno::Reference<
82 ::com::sun::star::drawing::framework::XResourceId>& rxPaneId,
83 USHORT nChildWindowId,
84 ViewShellBase& rViewShellBase,
85 ::std::auto_ptr<SfxShell> pShell);
86 virtual ~ChildWindowPane (void) throw();
88 /** Hide the pane. To make the pane visible again, call GetWindow().
90 void Hide (void);
92 virtual void SAL_CALL disposing (void);
94 /** This returns the content window when the child window is already
95 visible. Otherwise <NULL/> is returned. In that case a later call
96 may return the requested window (making a child window visible is an
97 asynchronous process.)
98 Note that GetWindow() may return different Window pointers when
99 Hide() is called in between.
101 virtual ::Window* GetWindow (void);
103 /** The local getWindow() first calls GetWindow() to provide a valid
104 window pointer before forwarding the call to the base class.
106 virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
107 SAL_CALL getWindow (void)
108 throw (::com::sun::star::uno::RuntimeException);
110 DECLARE_XINTERFACE()
111 DECLARE_XTYPEPROVIDER()
114 // XEventListener
116 virtual void SAL_CALL disposing(
117 const com::sun::star::lang::EventObject& rEvent)
118 throw (com::sun::star::uno::RuntimeException);
120 private:
121 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
122 USHORT mnChildWindowId;
123 ViewShellBase& mrViewShellBase;
124 ::std::auto_ptr<SfxShell> mpShell;
126 /** This flag is set when the pane shell has been activated at least
127 once. It is used to optimize the start-up performance (by not
128 showing the window too early) and by not delaying its creation at
129 later times.
131 bool mbHasBeenActivated;
134 } } // end of namespace sd::framework
136 #endif