bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / framework / Pane.hxx
bloba38ae7bb110351e38c71c6fcd2da3e49048ea642
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_INC_FRAMEWORK_PANE_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_PANE_HXX
23 #include "MutexOwner.hxx"
25 #include <com/sun/star/drawing/framework/XPane.hpp>
26 #include <com/sun/star/drawing/framework/XPane2.hpp>
27 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <cppuhelper/compbase3.hxx>
30 #include <boost/shared_ptr.hpp>
31 #include <boost/weak_ptr.hpp>
32 #include <vcl/vclptr.hxx>
34 namespace vcl { class Window; }
37 namespace {
39 typedef ::cppu::WeakComponentImplHelper3 <
40 ::com::sun::star::drawing::framework::XPane,
41 ::com::sun::star::drawing::framework::XPane2,
42 ::com::sun::star::lang::XUnoTunnel
43 > PaneInterfaceBase;
45 } // end of anonymous namespace.
47 namespace sd { namespace framework {
49 /** A pane is a wrapper for a window and possibly for a tab bar (for view
50 switching). Panes are unique resources.
52 This class has two responsibilities:
53 1. It implements the XPane interface. This is the most important
54 interface of this class for API based views (of which there not that
55 many yet) because it gives access to the XWindow.
56 2. It gives access to the underlying VCL Window by implementing the
57 XUnoTunnel interface. This is necessary at the moment and in the
58 foreseeable future because many parts of the Draw and Impress views rely
59 on direct access on the Window class.
61 class Pane
62 : protected MutexOwner,
63 public PaneInterfaceBase
65 public:
66 /** Create a new Pane object that wrapps the given window.
67 @param rsPaneURL
68 The URL that is used by the configuration to identify the pane.
69 The given URL has to be valid.
70 @param pWindow
71 The VCL Window (usually this really is an sd::Window) that is
72 wrapped by the new Pane object. The given pointer must not be
73 NULL.
75 Pane (
76 const ::com::sun::star::uno::Reference<
77 com::sun::star::drawing::framework::XResourceId>& rxPaneId,
78 vcl::Window* pWindow)
79 throw ();
80 virtual ~Pane();
82 virtual void SAL_CALL disposing() SAL_OVERRIDE;
84 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
86 /** This method is typically used together with the XUnoTunnel to obtain
87 a Window pointer from an XPane object.
89 virtual vcl::Window* GetWindow();
91 //----- XPane -------------------------------------------------------------
93 /** For a UNO API based implementation of a view this may the most
94 important method of this class because the view is only interested
95 in the window of the pane.
97 virtual css::uno::Reference<css::awt::XWindow>
98 SAL_CALL getWindow()
99 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual css::uno::Reference<css::rendering::XCanvas>
102 SAL_CALL getCanvas()
103 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 //----- XPane2 -------------------------------------------------------------
107 virtual sal_Bool SAL_CALL isVisible()
108 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
111 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible()
114 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 virtual void SAL_CALL setAccessible (
117 const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible)
118 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 //----- XResource ---------------------------------------------------------
122 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
123 SAL_CALL getResourceId()
124 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 /** For the typical pane it makes no sense to be dislayed without a
127 view. Therefore this default implementation returns always <TRUE/>.
129 virtual sal_Bool SAL_CALL isAnchorOnly()
130 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 //----- XUnoTunnel --------------------------------------------------------
134 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
135 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 protected:
138 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
139 VclPtr<vcl::Window> mpWindow;
140 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
141 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
143 /** Override this method, not getCanvas(), when you want to provide a
144 different canvas.
146 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
147 CreateCanvas()
148 throw (::com::sun::star::uno::RuntimeException);
150 /** Throw DisposedException when the object has already been disposed or
151 is currently being disposed. Otherwise this method returns
152 normally.
154 void ThrowIfDisposed() const
155 throw (::com::sun::star::lang::DisposedException);
158 } } // end of namespace sd::framework
160 #endif
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */