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 wraps 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 108 virtual cssu::Reference<css::rendering::XCanvas> 109 SAL_CALL getCanvas (void); 110 111 112 //----- XPane2 ------------------------------------------------------------- 113 114 virtual sal_Bool SAL_CALL isVisible (void); 115 116 virtual void SAL_CALL setVisible (sal_Bool bIsVisible); 117 118 virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void); 119 120 virtual void SAL_CALL setAccessible ( 121 const cssu::Reference<css::accessibility::XAccessible>& rxAccessible); 122 123 124 //----- XResource --------------------------------------------------------- 125 126 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> 127 SAL_CALL getResourceId (void); 128 129 /** For the typical pane it makes no sense to be dislayed without a 130 view. Therefore this default implementation returns always <TRUE/>. 131 */ 132 virtual sal_Bool SAL_CALL isAnchorOnly (void); 133 134 135 //----- XUnoTunnel -------------------------------------------------------- 136 137 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId); 138 139 140 protected: 141 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId; 142 ::Window* mpWindow; 143 ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow; 144 ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas; 145 146 /** Overload this method, not getCanvas(), when you want to provide a 147 different canvas. 148 */ 149 virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> 150 CreateCanvas (void); 151 152 /** Throw DisposedException when the object has already been disposed or 153 is currently being disposed. Otherwise this method returns 154 normally. 155 */ 156 void ThrowIfDisposed (void) const; 157 }; 158 159 } } // end of namespace sd::framework 160 161 #endif 162