bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / inc / framework / Pane.hxx
blobde6e36015e26b0bd59521c9c463f986f5d5ba6c0
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 SD_FRAMEWORK_PANE_HXX
21 #define SD_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>
33 class Window;
35 namespace cssu = ::com::sun::star::uno;
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 ::Window* pWindow)
79 throw ();
80 virtual ~Pane (void);
82 virtual void SAL_CALL disposing (void);
84 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
86 /** This method is typically used together with the XUnoTunnel to obtain
87 a Window pointer from an XPane object.
89 virtual ::Window* GetWindow (void);
91 void SetWindow (::Window* pWindow);
93 //----- XPane -------------------------------------------------------------
95 /** For a UNO API based implementation of a view this may the most
96 important method of this class because the view is only interested
97 in the window of the pane.
99 virtual cssu::Reference<css::awt::XWindow>
100 SAL_CALL getWindow (void)
101 throw (cssu::RuntimeException);
103 virtual cssu::Reference<css::rendering::XCanvas>
104 SAL_CALL getCanvas (void)
105 throw (cssu::RuntimeException);
108 //----- XPane2 -------------------------------------------------------------
110 virtual sal_Bool SAL_CALL isVisible (void)
111 throw (cssu::RuntimeException);
113 virtual void SAL_CALL setVisible (sal_Bool bIsVisible)
114 throw (cssu::RuntimeException);
116 virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void)
117 throw (cssu::RuntimeException);
119 virtual void SAL_CALL setAccessible (
120 const cssu::Reference<css::accessibility::XAccessible>& rxAccessible)
121 throw (cssu::RuntimeException);
124 //----- XResource ---------------------------------------------------------
126 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
127 SAL_CALL getResourceId (void)
128 throw (::com::sun::star::uno::RuntimeException);
130 /** For the typical pane it makes no sense to be dislayed without a
131 view. Therefore this default implementation returns always <TRUE/>.
133 virtual sal_Bool SAL_CALL isAnchorOnly (void)
134 throw (com::sun::star::uno::RuntimeException);
137 //----- XUnoTunnel --------------------------------------------------------
139 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
140 throw (com::sun::star::uno::RuntimeException);
143 protected:
144 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
145 ::Window* mpWindow;
146 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
147 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
149 /** Overload this method, not getCanvas(), when you want to provide a
150 different canvas.
152 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
153 CreateCanvas (void)
154 throw (::com::sun::star::uno::RuntimeException);
156 /** Throw DisposedException when the object has already been disposed or
157 is currently being disposed. Otherwise this method returns
158 normally.
160 void ThrowIfDisposed (void) const
161 throw (::com::sun::star::lang::DisposedException);
164 } } // end of namespace sd::framework
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */