1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_VCL_SVTABBX_HXX
20 #define INCLUDED_VCL_SVTABBX_HXX
22 #include <vcl/dllapi.h>
23 #include <vcl/treelistbox.hxx>
24 #include <vcl/accessibletableprovider.hxx>
26 #include <tools/debug.hxx>
31 enum class SvTabJustify
33 AdjustRight
= static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT
),
34 AdjustLeft
= static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT
),
35 AdjustCenter
= static_cast<int>(SvLBoxTabFlags::ADJUST_CENTER
)
38 class VCL_DLLPUBLIC SvTabListBox
: public SvTreeListBox
41 std::vector
<SvLBoxTab
> mvTabList
;
45 static OUString
GetToken( const OUString
&sStr
, sal_Int32
&nIndex
);
47 virtual void SetTabs() override
;
48 virtual void InitEntry(SvTreeListEntry
*, const OUString
&, const Image
&, const Image
&) override
;
50 OUString
GetTabEntryText( sal_uLong nPos
, sal_uInt16 nCol
) const;
51 SvTreeListEntry
* GetEntryOnPos( sal_uLong _nEntryPos
) const;
52 SvTreeListEntry
* GetChildOnPos( SvTreeListEntry
* _pParent
, sal_uLong _nEntryPos
, sal_uLong
& _rPos
) const;
55 SvTabListBox( vcl::Window
* pParent
, WinBits
);
56 virtual ~SvTabListBox() override
;
57 virtual void dispose() override
;
58 void SetTabs(sal_uInt16 nTabs
, long const pTabPositions
[], MapUnit
= MapUnit::MapAppFont
);
59 using SvTreeListBox::GetTab
;
60 void SetTab( sal_uInt16 nTab
, long nValue
, MapUnit
= MapUnit::MapAppFont
);
61 long GetLogicTab( sal_uInt16 nTab
);
63 virtual SvTreeListEntry
* InsertEntry( const OUString
& rText
, SvTreeListEntry
* pParent
= nullptr,
64 bool bChildrenOnDemand
= false,
65 sal_uLong nPos
=TREELIST_APPEND
, void* pUserData
= nullptr ) override
;
67 virtual SvTreeListEntry
* InsertEntry( const OUString
& rText
,
68 const Image
& rExpandedEntryBmp
,
69 const Image
& rCollapsedEntryBmp
,
70 SvTreeListEntry
* pParent
= nullptr,
71 bool bChildrenOnDemand
= false,
72 sal_uLong nPos
= TREELIST_APPEND
, void* pUserData
= nullptr ) override
;
74 virtual SvTreeListEntry
* InsertEntryToColumn( const OUString
&, SvTreeListEntry
* pParent
,
75 sal_uLong nPos
, sal_uInt16 nCol
, void* pUserData
= nullptr );
76 virtual SvTreeListEntry
* InsertEntryToColumn( const OUString
&, const Image
& rExpandedEntryBmp
,
77 const Image
& rCollapsedEntryBmp
, SvTreeListEntry
* pParent
,
78 sal_uLong nPos
= TREELIST_APPEND
, sal_uInt16 nCol
= 0xffff, void* pUserData
= nullptr );
80 virtual OUString
GetEntryText( SvTreeListEntry
* pEntry
) const override
;
81 static OUString
GetEntryText( SvTreeListEntry
*, sal_uInt16 nCol
);
82 OUString
GetEntryText( sal_uLong nPos
, sal_uInt16 nCol
= 0xffff ) const;
83 using SvTreeListBox::SetEntryText
;
84 void SetEntryText(const OUString
&, SvTreeListEntry
*, sal_uInt16 nCol
=0xffff);
85 OUString
GetCellText( sal_uLong nPos
, sal_uInt16 nCol
) const;
86 sal_uLong
GetEntryPos( const SvTreeListEntry
* pEntry
) const;
88 void SetTabJustify( sal_uInt16 nTab
, SvTabJustify
);
91 // class SvHeaderTabListBox ---------------------------------------------------
95 struct SvHeaderTabListBoxImpl
;
98 class VCL_DLLPUBLIC SvHeaderTabListBox
: public SvTabListBox
, public vcl::IAccessibleTableProvider
101 typedef ::std::vector
< css::uno::Reference
< css::accessibility::XAccessible
> > AccessibleChildren
;
104 std::unique_ptr
<::vcl::SvHeaderTabListBoxImpl
> m_pImpl
;
105 ::vcl::IAccessibleTabListBox
* m_pAccessible
;
106 AccessibleChildren m_aAccessibleChildren
;
108 DECL_DLLPRIVATE_LINK( ScrollHdl_Impl
, SvTreeListBox
*, void );
109 DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl
, HeaderBar
*, void );
111 void RecalculateAccessibleChildren();
114 SvHeaderTabListBox( vcl::Window
* pParent
, WinBits nBits
);
115 virtual ~SvHeaderTabListBox() override
;
116 virtual void dispose() override
;
118 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& ) override
;
120 void InitHeaderBar(HeaderBar
* pHeaderBar
);
121 HeaderBar
* GetHeaderBar();
122 static bool IsItemChecked( SvTreeListEntry
* pEntry
, sal_uInt16 nCol
);
124 virtual SvTreeListEntry
* InsertEntryToColumn( const OUString
&, SvTreeListEntry
* pParent
,
125 sal_uLong nPos
, sal_uInt16 nCol
, void* pUserData
= nullptr ) override
;
126 virtual SvTreeListEntry
* InsertEntryToColumn( const OUString
&, const Image
& rExpandedEntryBmp
,
127 const Image
& rCollapsedEntryBmp
, SvTreeListEntry
* pParent
,
128 sal_uLong nPos
= TREELIST_APPEND
, sal_uInt16 nCol
= 0xffff, void* pUserData
= nullptr ) override
;
129 virtual sal_uLong
Insert( SvTreeListEntry
* pEnt
,SvTreeListEntry
* pPar
,sal_uLong nPos
=TREELIST_APPEND
) override
;
130 virtual sal_uLong
Insert( SvTreeListEntry
* pEntry
, sal_uLong nRootPos
= TREELIST_APPEND
) override
;
132 // Accessible -------------------------------------------------------------
134 bool IsCellCheckBox( long _nRow
, sal_uInt16 _nColumn
, TriState
& _rState
);
136 /** @return The count of the rows. */
137 virtual long GetRowCount() const override
;
138 /** @return The count of the columns. */
139 virtual sal_uInt16
GetColumnCount() const override
;
141 /** @return The position of the current row. */
142 virtual sal_Int32
GetCurrRow() const override
;
143 /** @return The position of the current column. */
144 virtual sal_uInt16
GetCurrColumn() const override
;
146 /** @return The description of a row.
147 @param _nRow The row which description is in demand. */
148 virtual OUString
GetRowDescription( sal_Int32 _nRow
) const override
;
149 /** @return The description of a column.
150 @param _nColumn The column which description is in demand. */
151 virtual OUString
GetColumnDescription( sal_uInt16 _nColumn
) const override
;
153 /** @return <TRUE/>, if the object has a row header. */
154 virtual bool HasRowHeader() const override
; //GetColumnId
155 /** @return <TRUE/>, if the object can focus a cell. */
156 virtual bool GoToCell( sal_Int32 _nRow
, sal_uInt16 _nColumn
) override
;
158 virtual void SetNoSelection() override
;
159 using SvTabListBox::SelectAll
;
160 virtual void SelectAll() override
;
161 virtual void SelectRow( long _nRow
, bool _bSelect
= true, bool bExpand
= true ) override
;
162 virtual void SelectColumn( sal_uInt16 _nColumn
, bool _bSelect
= true ) override
;
163 virtual sal_Int32
GetSelectedRowCount() const override
;
164 virtual sal_Int32
GetSelectedColumnCount() const override
;
165 /** @return <TRUE/>, if the row is selected. */
166 virtual bool IsRowSelected( long _nRow
) const override
;
167 virtual bool IsColumnSelected( long _nColumn
) const override
;
168 virtual void GetAllSelectedRows( css::uno::Sequence
< sal_Int32
>& _rRows
) const override
;
169 virtual void GetAllSelectedColumns( css::uno::Sequence
< sal_Int32
>& _rColumns
) const override
;
171 /** @return <TRUE/>, if the cell is visible. */
172 virtual bool IsCellVisible( sal_Int32 _nRow
, sal_uInt16 _nColumn
) const override
;
173 virtual OUString
GetAccessibleCellText( long _nRow
, sal_uInt16 _nColumnPos
) const override
;
175 virtual tools::Rectangle
calcHeaderRect( bool _bIsColumnBar
, bool _bOnScreen
= true ) override
;
176 virtual tools::Rectangle
calcTableRect( bool _bOnScreen
= true ) override
;
177 virtual tools::Rectangle
GetFieldRectPixelAbs( sal_Int32 _nRow
, sal_uInt16 _nColumn
, bool _bIsHeader
, bool _bOnScreen
= true ) override
;
179 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessibleCell( sal_Int32 _nRow
, sal_uInt16 _nColumn
) override
;
180 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessibleRowHeader( sal_Int32 _nRow
) override
;
181 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos
) override
;
183 virtual sal_Int32
GetAccessibleControlCount() const override
;
184 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessibleControl( sal_Int32 _nIndex
) override
;
185 virtual bool ConvertPointToControlIndex( sal_Int32
& _rnIndex
, const Point
& _rPoint
) override
;
187 virtual bool ConvertPointToCellAddress( sal_Int32
& _rnRow
, sal_uInt16
& _rnColPos
, const Point
& _rPoint
) override
;
188 virtual bool ConvertPointToRowHeader( sal_Int32
& _rnRow
, const Point
& _rPoint
) override
;
189 virtual bool ConvertPointToColumnHeader( sal_uInt16
& _rnColPos
, const Point
& _rPoint
) override
;
191 virtual OUString
GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType _eType
, sal_Int32 _nPos
= -1 ) const override
;
192 virtual OUString
GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType
, sal_Int32 _nPos
= -1 ) const override
;
193 virtual vcl::Window
* GetWindowInstance() override
;
195 virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper
& _rStateSet
, ::vcl::AccessibleBrowseBoxObjType _eType
) const override
;
196 virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper
& _rStateSet
, sal_Int32 _nRow
, sal_uInt16 _nColumn
) const override
;
197 virtual void GrabTableFocus() override
;
200 virtual bool GetGlyphBoundRects( const Point
& rOrigin
, const OUString
& rStr
, int nIndex
, int nLen
, MetricVector
& rVector
) override
;
203 virtual tools::Rectangle
GetWindowExtentsRelative( vcl::Window
*pRelativeWindow
) const override
;
204 virtual void GrabFocus() override
;
205 virtual css::uno::Reference
< css::accessibility::XAccessible
> GetAccessible() override
;
206 /** Creates and returns the accessible object of the whole BrowseBox. */
207 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessible() override
;
208 virtual vcl::Window
* GetAccessibleParentWindow() const override
;
210 virtual tools::Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
) override
;
211 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
) override
;
214 #endif // INCLUDED_VCL_SVTABBX_HXX
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */