cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / inc / framework / Pane.hxx
blob51b7a5ed0934d33a87969995dec998e7e8231640
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 <com/sun/star/drawing/framework/XPane.hpp>
23 #include <com/sun/star/drawing/framework/XPane2.hpp>
24 #include <cppuhelper/basemutex.hxx>
25 #include <cppuhelper/compbase.hxx>
26 #include <vcl/vclptr.hxx>
27 #include <vcl/window.hxx>
29 namespace sd::framework {
31 typedef ::cppu::WeakComponentImplHelper <
32 css::drawing::framework::XPane,
33 css::drawing::framework::XPane2
34 > PaneInterfaceBase;
36 /** A pane is a wrapper for a window and possibly for a tab bar (for view
37 switching). Panes are unique resources.
39 This class has two responsibilities:
40 1. It implements the XPane interface. This is the most important
41 interface of this class for API based views (of which there not that
42 many yet) because it gives access to the XWindow.
43 2. It gives access to the underlying VCL Window.
44 This is necessary at the moment and in the
45 foreseeable future because many parts of the Draw and Impress views rely
46 on direct access on the Window class.
48 class Pane
49 : protected cppu::BaseMutex,
50 public PaneInterfaceBase
52 public:
53 /** Create a new Pane object that wraps the given window.
54 @param rsPaneURL
55 The URL that is used by the configuration to identify the pane.
56 The given URL has to be valid.
57 @param pWindow
58 The VCL Window (usually this really is an sd::Window) that is
59 wrapped by the new Pane object. The given pointer must not be
60 NULL.
62 Pane (
63 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
64 vcl::Window* pWindow)
65 noexcept;
66 virtual ~Pane() override;
68 virtual void SAL_CALL disposing() override;
70 /** This method is typically used to obtain
71 a Window pointer from an XPane object.
73 virtual vcl::Window* GetWindow();
75 //----- XPane -------------------------------------------------------------
77 /** For a UNO API based implementation of a view this may the most
78 important method of this class because the view is only interested
79 in the window of the pane.
81 virtual css::uno::Reference<css::awt::XWindow>
82 SAL_CALL getWindow() override;
84 virtual css::uno::Reference<css::rendering::XCanvas>
85 SAL_CALL getCanvas() override;
87 //----- XPane2 -------------------------------------------------------------
89 virtual sal_Bool SAL_CALL isVisible() override;
91 virtual void SAL_CALL setVisible (sal_Bool bIsVisible) override;
93 virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible() override;
95 virtual void SAL_CALL setAccessible (
96 const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible) override;
98 //----- XResource ---------------------------------------------------------
100 virtual css::uno::Reference<css::drawing::framework::XResourceId>
101 SAL_CALL getResourceId() override;
103 /** For the typical pane it makes no sense to be displayed without a
104 view. Therefore this default implementation returns always <TRUE/>.
106 virtual sal_Bool SAL_CALL isAnchorOnly() override;
108 protected:
109 css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
110 VclPtr<vcl::Window> mpWindow;
111 css::uno::Reference<css::awt::XWindow> mxWindow;
112 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
114 /** Override this method, not getCanvas(), when you want to provide a
115 different canvas.
117 @throws css::uno::RuntimeException
119 virtual css::uno::Reference<css::rendering::XCanvas>
120 CreateCanvas();
122 /** Throw DisposedException when the object has already been disposed or
123 is currently being disposed. Otherwise this method returns
124 normally.
126 @throws css::lang::DisposedException
128 void ThrowIfDisposed() const;
131 } // end of namespace sd::framework
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */