bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / framework / factories / ChildWindowPane.hxx
blobba83dfb53edb224921adfbdbcd860b467cccc33e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_SOURCE_UI_FRAMEWORK_FACTORIES_CHILDWINDOWPANE_HXX
21 #define INCLUDED_SD_SOURCE_UI_FRAMEWORK_FACTORIES_CHILDWINDOWPANE_HXX
23 #include "framework/Pane.hxx"
24 #include "PaneShells.hxx"
26 #include <com/sun/star/lang/XEventListener.hpp>
27 #include <com/sun/star/drawing/framework/XResourceId.hpp>
28 #include <com/sun/star/awt/XWindow.hpp>
29 #include <cppuhelper/implbase1.hxx>
30 #include <comphelper/uno3.hxx>
31 #include <memory>
33 namespace {
35 typedef ::cppu::ImplInheritanceHelper1 <
36 ::sd::framework::Pane,
37 ::com::sun::star::lang::XEventListener
38 > ChildWindowPaneInterfaceBase;
40 } // end of anonymous namespace.
42 namespace sd { class ViewShellBase; }
44 namespace sd { namespace framework {
46 /** The ChildWindowPane listens to the child window and disposes itself when
47 the child window becomes inaccessible. This happens for instance when a
48 document is made read-only and the task pane is turned off.
50 class ChildWindowPane
51 : public ChildWindowPaneInterfaceBase
53 public:
54 ChildWindowPane (
55 const ::com::sun::star::uno::Reference<
56 ::com::sun::star::drawing::framework::XResourceId>& rxPaneId,
57 sal_uInt16 nChildWindowId,
58 ViewShellBase& rViewShellBase,
59 ::std::unique_ptr<SfxShell> && pShell);
60 virtual ~ChildWindowPane();
62 /** Hide the pane. To make the pane visible again, call GetWindow().
64 void Hide();
66 virtual void SAL_CALL disposing() SAL_OVERRIDE;
68 /** This returns the content window when the child window is already
69 visible. Otherwise <NULL/> is returned. In that case a later call
70 may return the requested window (making a child window visible is an
71 asynchronous process.)
72 Note that GetWindow() may return different Window pointers when
73 Hide() is called in between.
75 virtual vcl::Window* GetWindow() SAL_OVERRIDE;
77 /** The local getWindow() first calls GetWindow() to provide a valid
78 window pointer before forwarding the call to the base class.
80 virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
81 SAL_CALL getWindow()
82 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 DECLARE_XINTERFACE()
85 DECLARE_XTYPEPROVIDER()
87 // XEventListener
89 virtual void SAL_CALL disposing(
90 const com::sun::star::lang::EventObject& rEvent)
91 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 private:
94 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
95 sal_uInt16 mnChildWindowId;
96 ViewShellBase& mrViewShellBase;
97 ::std::unique_ptr<SfxShell> mpShell;
99 /** This flag is set when the pane shell has been activated at least
100 once. It is used to optimize the start-up performance (by not
101 showing the window too early) and by not delaying its creation at
102 later times.
104 bool mbHasBeenActivated;
107 } } // end of namespace sd::framework
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */