1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #ifndef INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX 21 #define INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX 22 23 #include <com/sun/star/uno/Reference.hxx> 24 #include <svx/svxdllapi.h> 25 #include <vcl/window.hxx> 26 27 namespace com { namespace sun { namespace star { 28 namespace accessibility { class XAccessibleComponent; } 29 namespace document { class XShapeEventBroadcaster; } 30 namespace frame { class XController; } 31 } } } 32 33 class SdrView; 34 35 namespace accessibility { 36 37 class IAccessibleViewForwarder; 38 39 /** This class bundles all information that is passed down the tree of 40 accessible shapes so that each shape has access to that info. 41 42 There are basically four members that can be set and queried: 43 <ul> 44 <li>The model broadcaster is used for getting notified about shape 45 changes. Using this broadcaster makes in unnecessary to register at 46 each shape separately.</li> 47 <li>The view forwarder is responsible for transformation between 48 coordinate systems and for providing the visible area both with respect 49 to a specific window.</li> 50 <li>The SdrView is used for creating accessible edit engines.</li> 51 <li>The Window is used for creating accessible edit engines.</li> 52 </ul> 53 */ 54 class SVX_DLLPUBLIC AccessibleShapeTreeInfo 55 { 56 public: 57 /** Use this constructor to create an empty object that is filled later 58 with more meaningful data. 59 */ 60 AccessibleShapeTreeInfo(); 61 62 /** Create a copy of the given shape info. 63 @param rInfo 64 The shape tree info object to copy. 65 */ 66 AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo); 67 68 ~AccessibleShapeTreeInfo(); 69 70 AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo); 71 72 void dispose(); 73 74 /** Deprecated. Don't use this method. 75 */ 76 void SetDocumentWindow (const css::uno::Reference< 77 css::accessibility::XAccessibleComponent>& rxViewWindow); 78 79 /** Deprecated. Don't use this method. 80 */ 81 const css::uno::Reference< 82 css::accessibility::XAccessibleComponent>& GetDocumentWindow() const83 GetDocumentWindow() const { return mxDocumentWindow;} 84 85 /** Set a new broadcaster that sends events indicating shape changes. 86 The broadcaster usually is or belongs to a document model. 87 @param rxModelBroadcaster 88 The new broadcaster. It replaces the current one. An empty 89 reference may be passed to unset the broadcaster 90 */ 91 void SetModelBroadcaster (const css::uno::Reference< 92 css::document::XShapeEventBroadcaster>& rxModelBroadcaster); 93 94 /** Return the current model broadcaster. 95 @return 96 The returned reference may be empty if the broadcaster has not 97 been set or has been set to an empty reference. 98 */ 99 const css::uno::Reference< 100 css::document::XShapeEventBroadcaster>& GetModelBroadcaster() const101 GetModelBroadcaster() const { return mxModelBroadcaster;} 102 103 /** Set the view that will be used to construct SvxTextEditSources which 104 in turn are used to create accessible edit engines. 105 @param pView 106 The new SdrView that replaces the current one. A NULL pointer 107 may be passed to unset the view. 108 */ 109 void SetSdrView (SdrView* pView); 110 111 /** Return the current SdrView. 112 @return 113 The returned value may be NULL. 114 */ GetSdrView() const115 SdrView* GetSdrView() const { return mpView;} 116 117 /** Set a new controller. This will usually but not necessarily 118 correspond to the SdrView. 119 @param rxController 120 The new controller that replaces the current one. An empty 121 reference may be passed to unset the controller. 122 */ 123 void SetController (const css::uno::Reference< 124 css::frame::XController>& rxController); 125 126 /** Return the currently set controller. 127 @return 128 The reference to the currently set controller may be empty. 129 */ 130 const css::uno::Reference< 131 css::frame::XController>& GetController() const132 GetController() const { return mxController;} 133 134 /** Set the window that is used to construct SvxTextEditSources which in 135 turn is used to create accessible edit engines. 136 */ 137 void SetDevice(OutputDevice* pWindow); 138 139 /** Return the current Window. 140 @return 141 The returned value may be NULL. 142 */ GetWindow() const143 vcl::Window* GetWindow() const 144 { 145 if (mpWindow && mpWindow->GetOutDevType() == OUTDEV_WINDOW) 146 return static_cast<vcl::Window*>(mpWindow.get()); 147 return nullptr; 148 } GetDevice() const149 OutputDevice* GetDevice() const { return mpWindow;} 150 151 /** The view forwarder allows the transformation between internal 152 and pixel coordinates and can be asked for the visible area. 153 @param pViewForwarder 154 This view forwarder replaces the current one. 155 */ 156 void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder); 157 158 /** Return the current view forwarder. 159 @return 160 The returned pointer may be NULL. 161 */ GetViewForwarder() const162 const IAccessibleViewForwarder* GetViewForwarder() const { return mpViewForwarder;} 163 164 private: 165 /** Deprecated. 166 */ 167 css::uno::Reference< 168 css::accessibility::XAccessibleComponent> mxDocumentWindow; 169 170 /** this broadcaster sends events indicating shape changes. 171 The broadcaster usually is or belongs to a document model. 172 173 This once was named mxControllerBroadcaster. 174 */ 175 css::uno::Reference< 176 css::document::XShapeEventBroadcaster> mxModelBroadcaster; 177 178 /** This view is necessary to construct an SvxTextEditSource which in 179 turn is used to create an accessible edit engine. 180 */ 181 SdrView* mpView; 182 183 /** The controller is used e.g. for obtaining the selected shapes. 184 */ 185 css::uno::Reference< 186 css::frame::XController> mxController; 187 188 /** This window is necessary to construct an SvxTextEditSource which in 189 turn is used to create an accessible edit engine. 190 */ 191 VclPtr<OutputDevice> mpWindow; 192 193 /** The view forwarder allows the transformation between internal 194 and pixel coordinates and can be asked for the visible area. 195 */ 196 const IAccessibleViewForwarder* mpViewForwarder; 197 }; 198 199 } // end of namespace accessibility 200 201 #endif 202 203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 204