1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _ACCFRAME_HXX 28 #define _ACCFRAME_HXX 29 30 #include <swrect.hxx> 31 32 #include <sal/types.h> 33 #include <tools/string.hxx> 34 35 #include <list> 36 #include <accfrmobj.hxx> 37 38 class SwAccessibleMap; 39 class SwFrm; 40 class ViewShell; 41 namespace sw { namespace access { 42 class SwAccessibleChild; 43 }} 44 45 // Any method of this class must be called with an acquired solar mutex! 46 47 class SwAccessibleFrame 48 { 49 SwRect maVisArea; 50 const SwFrm* mpFrm; 51 const sal_Bool mbIsInPagePreview; 52 53 protected: 54 // --> OD 2007-06-29 #i77106# 55 // method needs to be called by new class <SwAccessibleTableColHeaders> 56 static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap, 57 const SwRect& rVisArea, 58 const SwFrm *pFrm, 59 sal_Bool bInPagePreview ); 60 private: 61 static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap, 62 const SwRect& rVisArea, 63 const SwFrm& rFrm, 64 sal_Int32& rPos, 65 sal_Bool bInPagePreview); 66 67 static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap, 68 const SwRect& rVisArea, 69 const SwFrm& rFrm, 70 const sw::access::SwAccessibleChild& rChild, 71 sal_Int32& rPos, 72 sal_Bool bInPagePreview ); 73 74 static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea, 75 const SwFrm& rFrm, 76 const Point& rPos, 77 sal_Bool bInPagePreview, 78 SwAccessibleMap& rAccMap ); 79 80 static void GetChildren( SwAccessibleMap& rAccMap, 81 const SwRect& rVisArea, 82 const SwFrm& rFrm, 83 ::std::list< sw::access::SwAccessibleChild >& rChildren, 84 sal_Bool bInPagePreview ); 85 86 protected: 87 88 sal_Bool IsEditable( ViewShell *pVSh ) const; 89 90 sal_Bool IsOpaque( ViewShell *pVSh ) const; 91 92 sal_Bool IsShowing( const SwAccessibleMap& rAccMap, 93 const sw::access::SwAccessibleChild& rFrmOrObj ) const; 94 inline sal_Bool IsShowing( const SwRect& rFrm ) const; 95 inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const; 96 97 inline sal_Bool IsInPagePreview() const 98 { 99 return mbIsInPagePreview; 100 } 101 102 inline void ClearFrm() 103 { 104 mpFrm = 0; 105 } 106 107 SwAccessibleFrame( const SwRect& rVisArea, 108 const SwFrm *pFrm, 109 sal_Bool bIsPagePreview ); 110 virtual ~SwAccessibleFrame(); 111 112 public: 113 // Return the SwFrm this context is attached to. 114 const SwFrm* GetFrm() const { return mpFrm; }; 115 116 static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj, 117 sal_Bool bInPagePreview ); 118 119 sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap, 120 const sw::access::SwAccessibleChild& rChild ) const; 121 122 protected: 123 124 // Return the bounding box of the frame clipped to the vis area. If 125 // no frame is specified, use this' frame. 126 SwRect GetBounds( const SwAccessibleMap& rAccMap, 127 const SwFrm *pFrm = 0 ); 128 129 // Return the upper that has a context attached. This might be 130 // another one than the immediate upper. 131 inline const SwFrm *GetParent() const; 132 133 // Return the lower count or the nth lower, there the lowers have a 134 // not be same one as the SwFrm's lowers 135 sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const; 136 sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap, 137 sal_Int32 nPos ) const; 138 sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos, 139 SwAccessibleMap& rAccMap ) const; 140 void GetChildren( SwAccessibleMap& rAccMap, 141 ::std::list< sw::access::SwAccessibleChild >& rChildren ) const; 142 143 inline void SetVisArea( const SwRect& rNewVisArea ) 144 { 145 maVisArea = rNewVisArea; 146 } 147 148 inline const SwRect& GetVisArea() const 149 { 150 return maVisArea; 151 } 152 153 154 String GetFormattedPageNumber() const; 155 }; 156 157 inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const 158 { 159 return rFrm.IsOver( maVisArea ); 160 } 161 162 inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const 163 { 164 sw::access::SwAccessibleChild aFrmOrObj( GetFrm() ); 165 return IsShowing( rAccMap, aFrmOrObj ); 166 } 167 168 inline const SwFrm *SwAccessibleFrame::GetParent() const 169 { 170 sw::access::SwAccessibleChild aFrmOrObj( GetFrm() ); 171 return GetParent( aFrmOrObj, IsInPagePreview() ); 172 } 173 174 #endif 175 176