bump product version to 4.2.0.1
[LibreOffice.git] / include / svtools / svtabbx.hxx
blob3424856283bf13361cda1d6f5aee91e3272d7064
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 .
19 #ifndef INCLUDED_SVTOOLS_SVTABBX_HXX
20 #define INCLUDED_SVTOOLS_SVTABBX_HXX
22 #include <svtools/svtdllapi.h>
23 #include <svtools/treelistbox.hxx>
24 #include <svtools/accessibletableprovider.hxx>
26 #include <vector>
28 enum SvTabJustify
30 AdjustRight = SV_LBOXTAB_ADJUST_RIGHT,
31 AdjustLeft = SV_LBOXTAB_ADJUST_LEFT,
32 AdjustCenter = SV_LBOXTAB_ADJUST_CENTER,
33 AdjustNumeric = SV_LBOXTAB_ADJUST_NUMERIC
36 struct TabListBoxEventData
38 SvTreeListEntry* m_pEntry;
39 sal_uInt16 m_nColumn;
40 OUString m_sOldText;
42 TabListBoxEventData( SvTreeListEntry* pEntry, sal_uInt16 nColumn, const OUString& rOldText ) :
43 m_pEntry( pEntry ), m_nColumn( nColumn ), m_sOldText( rOldText ) {}
46 class SVT_DLLPUBLIC SvTabListBox : public SvTreeListBox
48 private:
49 SvLBoxTab* pTabList;
50 sal_uInt16 nTabCount;
51 OUString aCurEntry;
53 protected:
54 SvTreeListEntry* pViewParent;
56 static OUString GetToken( const OUString &sStr, sal_Int32 &nIndex );
58 virtual void SetTabs();
59 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
61 OUString GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const;
62 SvTreeListEntry* GetEntryOnPos( sal_uLong _nEntryPos ) const;
63 SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const;
65 public:
66 SvTabListBox( Window* pParent, WinBits = WB_BORDER );
67 SvTabListBox( Window* pParent, const ResId& );
68 ~SvTabListBox();
69 void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
70 sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; }
71 using SvTreeListBox::GetTab;
72 long GetTab( sal_uInt16 nTab ) const;
73 void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT );
74 long GetLogicTab( sal_uInt16 nTab );
76 virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = 0,
77 sal_Bool bChildrenOnDemand = sal_False,
78 sal_uLong nPos=LIST_APPEND, void* pUserData = 0,
79 SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
81 virtual SvTreeListEntry* InsertEntry( const OUString& rText,
82 const Image& rExpandedEntryBmp,
83 const Image& rCollapsedEntryBmp,
84 SvTreeListEntry* pParent = 0,
85 sal_Bool bChildrenOnDemand = sal_False,
86 sal_uLong nPos = LIST_APPEND, void* pUserData = 0,
87 SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
89 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, sal_uLong nPos = LIST_APPEND,
90 sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
91 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
92 sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL );
93 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
94 const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
95 sal_uLong nPos = LIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
97 virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
98 OUString GetEntryText( SvTreeListEntry*, sal_uInt16 nCol ) const;
99 OUString GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const;
100 using SvTreeListBox::SetEntryText;
101 void SetEntryText(const OUString&, sal_uLong, sal_uInt16 nCol=0xffff);
102 void SetEntryText(const OUString&, SvTreeListEntry*, sal_uInt16 nCol=0xffff);
103 OUString GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const;
104 sal_uLong GetEntryPos( const OUString&, sal_uInt16 nCol = 0xffff );
105 sal_uLong GetEntryPos( const SvTreeListEntry* pEntry ) const;
107 virtual void Resize();
108 void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
111 inline long SvTabListBox::GetTab( sal_uInt16 nTab ) const
113 DBG_ASSERT( nTab < nTabCount, "GetTabPos:Invalid Tab" );
114 return pTabList[nTab].GetPos();
117 // class SvHeaderTabListBox ---------------------------------------------------
119 class HeaderBar;
120 namespace svt {
121 class AccessibleTabListBox;
122 class IAccessibleTabListBox;
123 struct SvHeaderTabListBoxImpl;
126 class SVT_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public svt::IAccessibleTableProvider
128 private:
129 typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
131 sal_Bool m_bFirstPaint;
132 ::svt::SvHeaderTabListBoxImpl* m_pImpl;
133 ::svt::IAccessibleTabListBox* m_pAccessible;
134 AccessibleChildren m_aAccessibleChildren;
136 DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, void* );
137 DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, void* );
139 void RecalculateAccessibleChildren();
141 public:
142 SvHeaderTabListBox( Window* pParent, WinBits nBits );
143 SvHeaderTabListBox( Window* pParent, const ResId& );
144 ~SvHeaderTabListBox();
146 virtual void Paint( const Rectangle& );
148 void InitHeaderBar( HeaderBar* pHeaderBar );
149 sal_Bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ) const;
151 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, sal_uLong nPos = LIST_APPEND,
152 sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
153 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
154 sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL );
155 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
156 const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
157 sal_uLong nPos = LIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
158 virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=LIST_APPEND);
159 virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = LIST_APPEND );
160 void RemoveEntry( SvTreeListEntry* _pEntry );
161 void Clear();
163 // Accessible -------------------------------------------------------------
165 inline void DisableTransientChildren() { SetChildrenNotTransient(); }
166 inline sal_Bool IsTransientChildrenDisabled() const { return !AreChildrenTransient(); }
168 sal_Bool IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState );
170 /** @return The count of the rows. */
171 virtual long GetRowCount() const;
172 /** @return The count of the columns. */
173 virtual sal_uInt16 GetColumnCount() const;
175 /** @return The position of the current row. */
176 virtual sal_Int32 GetCurrRow() const;
177 /** @return The position of the current column. */
178 virtual sal_uInt16 GetCurrColumn() const;
180 /** @return The description of a row.
181 @param _nRow The row which description is in demand. */
182 virtual OUString GetRowDescription( sal_Int32 _nRow ) const;
183 /** @return The description of a column.
184 @param _nColumn The column which description is in demand. */
185 virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const;
187 /** @return <TRUE/>, if the object has a row header. */
188 virtual sal_Bool HasRowHeader() const; //GetColumnId
189 /** @return <TRUE/>, if the object can focus a cell. */
190 virtual sal_Bool IsCellFocusable() const;
191 virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
193 virtual void SetNoSelection();
194 using SvListView::SelectAll;
195 virtual void SelectAll();
196 virtual void SelectAll( sal_Bool bSelect, sal_Bool bPaint = sal_True );
197 virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True );
198 virtual void SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect = sal_True );
199 virtual sal_Int32 GetSelectedRowCount() const;
200 virtual sal_Int32 GetSelectedColumnCount() const;
201 /** @return <TRUE/>, if the row is selected. */
202 virtual bool IsRowSelected( long _nRow ) const;
203 virtual sal_Bool IsColumnSelected( long _nColumn ) const;
204 virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const;
205 virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const;
207 /** @return <TRUE/>, if the cell is visible. */
208 virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
209 virtual OUString GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const;
211 virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True );
212 virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True );
213 virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True );
215 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
216 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow );
217 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos );
219 virtual sal_Int32 GetAccessibleControlCount() const;
220 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex );
221 virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
223 virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint );
224 virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint );
225 virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint );
227 virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const;
228 virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const;
229 virtual Window* GetWindowInstance();
231 using SvTreeListBox::FillAccessibleStateSet;
232 virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const;
233 virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
234 virtual void GrabTableFocus();
236 // OutputDevice
237 virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
239 // Window
240 virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
241 virtual void GrabFocus();
242 virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True );
243 virtual Window* GetAccessibleParentWindow() const;
245 /** Creates and returns the accessible object of the whole BrowseBox. */
246 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible();
248 virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
249 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
252 #endif // INCLUDED_SVTOOLS_SVTABBX_HXX
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */