LibreOffice Module vcl (master) 1
svtabbx.hxx
Go to the documentation of this file.
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#pragma once
21
22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
24#endif
25
26#include <vcl/dllapi.h>
29
30#include <tools/debug.hxx>
31
32#include <memory>
33#include <vector>
34
35enum class SvTabJustify
36{
37 AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
38 AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
40};
41
43{
44private:
45 std::vector<SvLBoxTab> mvTabList;
46 OUString aCurEntry;
47
48protected:
49 static std::u16string_view GetToken( std::u16string_view sStr, sal_Int32 &nIndex );
50
51 virtual void SetTabs() override;
52 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override;
53
54 OUString GetTabEntryText( sal_uInt32 nPos, sal_uInt16 nCol ) const;
55 SvTreeListEntry* GetEntryOnPos( sal_uInt32 _nEntryPos ) const;
56 SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uInt32 _nEntryPos, sal_uInt32& _rPos ) const;
57
58public:
59 SvTabListBox( vcl::Window* pParent, WinBits );
60 virtual ~SvTabListBox() override;
61 virtual void dispose() override;
62 void SetTabs(sal_uInt16 nTabs, tools::Long const pTabPositions[], MapUnit = MapUnit::MapAppFont);
64 tools::Long GetLogicTab( sal_uInt16 nTab );
65
66 virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
67 bool bChildrenOnDemand = false,
68 sal_uInt32 nPos=TREELIST_APPEND, void* pUserData = nullptr ) override;
69
70 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
71 sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr );
72
73 virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override;
74 static OUString GetEntryText( const SvTreeListEntry*, sal_uInt16 nCol );
75 OUString GetEntryText( sal_uInt32 nPos, sal_uInt16 nCol = 0xffff ) const;
77 OUString GetCellText( sal_uInt32 nPos, sal_uInt16 nCol ) const;
78 sal_uInt32 GetEntryPos( const SvTreeListEntry* pEntry ) const;
79
80 void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
81 void SetTabEditable( sal_uInt16 nTab, bool bEditable );
82
83 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
84};
85
86// class SvHeaderTabListBox ---------------------------------------------------
87
88class HeaderBar;
89namespace vcl {
90 struct SvHeaderTabListBoxImpl;
91}
92
94{
95private:
96 typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
97
99 std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
102
103 DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
104 DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );
105
106 void RecalculateAccessibleChildren();
107
108public:
109 SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
110 virtual ~SvHeaderTabListBox() override;
111 virtual void dispose() override;
112
113 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
114
115 void InitHeaderBar(HeaderBar* pHeaderBar);
116 HeaderBar* GetHeaderBar();
117 static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
118
119 virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
120 sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override;
121 virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND) override;
122 virtual sal_uInt32 Insert( SvTreeListEntry* pEntry, sal_uInt32 nRootPos = TREELIST_APPEND ) override;
123
124 // Accessible -------------------------------------------------------------
125
126 bool IsCellCheckBox( sal_Int32 _nRow, sal_uInt16 _nColumn, TriState& _rState ) const;
127
129 virtual sal_Int32 GetRowCount() const override;
131 virtual sal_uInt16 GetColumnCount() const override;
132
134 virtual sal_Int32 GetCurrRow() const override;
136 virtual sal_uInt16 GetCurrColumn() const override;
137
140 virtual OUString GetRowDescription( sal_Int32 _nRow ) const override;
143 virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
144
146 virtual bool HasRowHeader() const override; //GetColumnId
148 virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
149
150 virtual void SetNoSelection() override;
152 virtual void SelectAll() override;
153 virtual void SelectRow( sal_Int32 _nRow, bool _bSelect = true, bool bExpand = true ) override;
154 virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
155 virtual sal_Int32 GetSelectedRowCount() const override;
156 virtual sal_Int32 GetSelectedColumnCount() const override;
158 virtual bool IsRowSelected( sal_Int32 _nRow ) const override;
159 virtual bool IsColumnSelected( sal_Int32 _nColumn ) const override;
160 virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
161 virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
162
164 virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
165 virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override;
166
167 virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override;
168 virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override;
169 virtual tools::Rectangle GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) override;
170
171 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
172 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
173 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
174
175 virtual sal_Int32 GetAccessibleControlCount() const override;
176 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
177 virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
178
179 virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override;
180 virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override;
181 virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override;
182
183 virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
184 virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
185 virtual vcl::Window* GetWindowInstance() override;
186
187 virtual void FillAccessibleStateSet( sal_Int64& _rStateSet, AccessibleBrowseBoxObjType _eType ) const override;
188 virtual void FillAccessibleStateSetForCell( sal_Int64& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
189 virtual void GrabTableFocus() override;
190
191 // OutputDevice
192 virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
193
194 // Window
195 virtual tools::Rectangle GetWindowExtentsAbsolute() const override;
196 virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override;
197 virtual void GrabFocus() override;
198 virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
200 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
201 virtual vcl::Window* GetAccessibleParentWindow() const override;
202
203 virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
204 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
205
206 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
207};
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AccessibleBrowseBoxObjType
This enumeration contains a constant for each kind of accessible object of a BrowseBox.
Definition: image.hxx:40
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren
Definition: svtabbx.hxx:96
DECL_DLLPRIVATE_LINK(ScrollHdl_Impl, SvTreeListBox *, void)
AccessibleChildren m_aAccessibleChildren
Definition: svtabbx.hxx:101
std::unique_ptr<::vcl::SvHeaderTabListBoxImpl > m_pImpl
Definition: svtabbx.hxx:99
DECL_DLLPRIVATE_LINK(CreateAccessibleHdl_Impl, HeaderBar *, void)
::vcl::IAccessibleTabListBox * m_pAccessible
Definition: svtabbx.hxx:100
OUString aCurEntry
Definition: svtabbx.hxx:46
std::vector< SvLBoxTab > mvTabList
Definition: svtabbx.hxx:45
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Creates and returns the accessible object of the Box.
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uInt32 nPos=TREELIST_APPEND, void *pUserData=nullptr)
virtual void InitEntry(SvTreeListEntry *, const OUString &, const Image &, const Image &)
virtual OUString GetEntryText(SvTreeListEntry *pEntry) const
virtual void SetTabs()
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SelectAll(bool bSelect)
void SetEntryText(SvTreeListEntry *, const OUString &)
virtual sal_uInt32 Insert(SvTreeListEntry *pEnt, SvTreeListEntry *pPar, sal_uInt32 nPos=TREELIST_APPEND)
SvLBoxTab * GetTab(SvTreeListEntry const *, SvLBoxItem const *) const
interface for an implementation of a table control's Accessible component
This abstract class provides methods to implement an accessible table object.
tools::Rectangle GetWindowExtentsAbsolute() const
Definition: window.cxx:2924
void GrabFocus()
Definition: window.cxx:2976
vcl::Window * GetAccessibleParentWindow() const
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3356
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
Definition: window.cxx:2914
SwLayoutFrame * GetCurrColumn(const SwLayoutFrame *pLayFrame)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
TriState
MapUnit
long Long
SvTabJustify
Definition: svtabbx.hxx:36
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:167
sal_Int64 WinBits
Definition: wintypes.hxx:109