cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / framework / factories / ChildWindowPane.hxx
blob08217775780e918779dddc7da2e12cb18f0471a8
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 #pragma once
22 #include <framework/Pane.hxx>
24 #include <com/sun/star/lang/XEventListener.hpp>
25 #include <cppuhelper/implbase.hxx>
26 #include <comphelper/uno3.hxx>
27 #include <memory>
29 class SfxShell;
31 namespace sd { class ViewShellBase; }
32 namespace com::sun::star::awt { class XWindow; }
33 namespace com::sun::star::drawing::framework { class XResourceId; }
35 namespace sd::framework {
37 typedef ::cppu::ImplInheritanceHelper <
38 ::sd::framework::Pane,
39 css::lang::XEventListener
40 > ChildWindowPaneInterfaceBase;
42 /** The ChildWindowPane listens to the child window and disposes itself when
43 the child window becomes inaccessible. This happens for instance when a
44 document is made read-only and the task pane is turned off.
46 class ChildWindowPane
47 : public ChildWindowPaneInterfaceBase
49 public:
50 ChildWindowPane (
51 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
52 sal_uInt16 nChildWindowId,
53 ViewShellBase& rViewShellBase,
54 ::std::unique_ptr<SfxShell> && pShell);
55 virtual ~ChildWindowPane() override;
57 /** Hide the pane. To make the pane visible again, call GetWindow().
59 void Hide();
61 virtual void SAL_CALL disposing() override;
63 /** This returns the content window when the child window is already
64 visible. Otherwise <NULL/> is returned. In that case a later call
65 may return the requested window (making a child window visible is an
66 asynchronous process.)
67 Note that GetWindow() may return different Window pointers when
68 Hide() is called in between.
70 virtual vcl::Window* GetWindow() override;
72 /** The local getWindow() first calls GetWindow() to provide a valid
73 window pointer before forwarding the call to the base class.
75 virtual css::uno::Reference<css::awt::XWindow>
76 SAL_CALL getWindow() override;
78 DECLARE_XINTERFACE()
79 DECLARE_XTYPEPROVIDER()
81 // XEventListener
83 virtual void SAL_CALL disposing(
84 const css::lang::EventObject& rEvent) override;
86 private:
87 sal_uInt16 mnChildWindowId;
88 ViewShellBase& mrViewShellBase;
89 ::std::unique_ptr<SfxShell> mpShell;
91 /** This flag is set when the pane shell has been activated at least
92 once. It is used to optimize the start-up performance (by not
93 showing the window too early) and by not delaying its creation at
94 later times.
96 bool mbHasBeenActivated;
99 } // end of namespace sd::framework
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */