1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SD_FRAMEWORK_PANE_HXX 25 #define SD_FRAMEWORK_PANE_HXX 26 27 #include "MutexOwner.hxx" 28 29 #include <com/sun/star/drawing/framework/XPane.hpp> 30 #include <com/sun/star/drawing/framework/XPane2.hpp> 31 #include <com/sun/star/drawing/framework/TabBarButton.hpp> 32 #include <com/sun/star/lang/XUnoTunnel.hpp> 33 #include <cppuhelper/compbase3.hxx> 34 #include <tools/link.hxx> 35 #include <boost/shared_ptr.hpp> 36 #include <boost/weak_ptr.hpp> 37 38 class Window; 39 40 namespace css = ::com::sun::star; 41 namespace cssu = ::com::sun::star::uno; 42 43 namespace { 44 45 typedef ::cppu::WeakComponentImplHelper3 < 46 ::com::sun::star::drawing::framework::XPane, 47 ::com::sun::star::drawing::framework::XPane2, 48 ::com::sun::star::lang::XUnoTunnel 49 > PaneInterfaceBase; 50 51 } // end of anonymous namespace. 52 53 namespace sd { namespace framework { 54 55 /** A pane is a wrapper for a window and possibly for a tab bar (for view 56 switching). Panes are unique resources. 57 58 This class has two responsibilities: 59 1. It implements the XPane interface. This is the most important 60 interface of this class for API based views (of which there not that 61 many yet) because it gives access to the XWindow. 62 2. It gives access to the underlying VCL Window by implementing the 63 XUnoTunnel interface. This is necessary at the moment and in the 64 foreseeable future because many parts of the Draw and Impress views rely 65 on direct access on the Window class. 66 */ 67 class Pane 68 : protected MutexOwner, 69 public PaneInterfaceBase 70 { 71 public: 72 /** Create a new Pane object that wrapps the given window. 73 @param rsPaneURL 74 The URL that is used by the configuration to identify the pane. 75 The given URL has to be valid. 76 @param pWindow 77 The VCL Window (usually this really is an sd::Window) that is 78 wrapped by the new Pane object. The given pointer must not be 79 NULL. 80 */ 81 Pane ( 82 const ::com::sun::star::uno::Reference< 83 com::sun::star::drawing::framework::XResourceId>& rxPaneId, 84 ::Window* pWindow) 85 throw (); 86 virtual ~Pane (void) throw(); 87 88 virtual void SAL_CALL disposing (void); 89 90 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void); 91 92 /** This method is typically used together with the XUnoTunnel to obtain 93 a Window pointer from an XPane object. 94 */ 95 virtual ::Window* GetWindow (void); 96 97 void SetWindow (::Window* pWindow); 98 99 //----- XPane ------------------------------------------------------------- 100 101 /** For a UNO API based implementation of a view this may the most 102 important method of this class because the view is only interested 103 in the window of the pane. 104 */ 105 virtual cssu::Reference<css::awt::XWindow> 106 SAL_CALL getWindow (void) 107 throw (cssu::RuntimeException); 108 109 virtual cssu::Reference<css::rendering::XCanvas> 110 SAL_CALL getCanvas (void) 111 throw (cssu::RuntimeException); 112 113 114 //----- XPane2 ------------------------------------------------------------- 115 116 virtual sal_Bool SAL_CALL isVisible (void) 117 throw (cssu::RuntimeException); 118 119 virtual void SAL_CALL setVisible (sal_Bool bIsVisible) 120 throw (cssu::RuntimeException); 121 122 virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void) 123 throw (cssu::RuntimeException); 124 125 virtual void SAL_CALL setAccessible ( 126 const cssu::Reference<css::accessibility::XAccessible>& rxAccessible) 127 throw (cssu::RuntimeException); 128 129 130 //----- XResource --------------------------------------------------------- 131 132 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> 133 SAL_CALL getResourceId (void) 134 throw (::com::sun::star::uno::RuntimeException); 135 136 /** For the typical pane it makes no sense to be dislayed without a 137 view. Therefore this default implementation returns always <TRUE/>. 138 */ 139 virtual sal_Bool SAL_CALL isAnchorOnly (void) 140 throw (com::sun::star::uno::RuntimeException); 141 142 143 //----- XUnoTunnel -------------------------------------------------------- 144 145 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId) 146 throw (com::sun::star::uno::RuntimeException); 147 148 149 protected: 150 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId; 151 ::Window* mpWindow; 152 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow; 153 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas; 154 155 /** Overload this method, not getCanvas(), when you want to provide a 156 different canvas. 157 */ 158 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> 159 CreateCanvas (void) 160 throw (::com::sun::star::uno::RuntimeException); 161 162 /** Throw DisposedException when the object has already been disposed or 163 is currently being disposed. Otherwise this method returns 164 normally. 165 */ 166 void ThrowIfDisposed (void) const 167 throw (::com::sun::star::lang::DisposedException); 168 }; 169 170 } } // end of namespace sd::framework 171 172 #endif 173