26#include <com/sun/star/accessibility/AccessibleStateType.hpp>
27#include <rtl/ustrbuf.hxx>
31#include <osl/diagnose.h>
55 rJsonWriter.
put(
"text",
static_cast<const SvLBoxString*
>(pIt)->GetText());
59 auto aColumns = rJsonWriter.
startArray(
"columns");
70 rJsonWriter.
put(
"text", pStringItem->
GetText());
84 rJsonWriter.
put(
"collapsed", rCollapsed);
86 rJsonWriter.
put(
"expanded", rExpanded);
96 if (rChildren.size() == 1)
98 auto& rChild = rChildren[0];
102 rJsonWriter.
put(
"ondemand",
true);
110 rJsonWriter.
put(
"state",
false);
112 rJsonWriter.
put(
"state",
true);
116 rJsonWriter.
put(
"selected",
true);
123 auto childrenNode = rJsonWriter.
startArray(
"children");
139 auto entriesNode = rJsonWriter.
startArray(
"entries");
184 for( sal_uInt16 nCurTab = 1; nCurTab < sal_uInt16(
mvTabList.size()); nCurTab++ )
202 pEntry->
AddItem(std::make_unique<SvLBoxString>(OUString(aToken)));
229 MapMode aMMDest( MapUnit::MapPixel );
231 for( sal_uInt16 nIdx = 0; nIdx < sal_uInt16(
mvTabList.size()); nIdx++, pTabPositions++ )
233 Size aSize( *pTabPositions, 0 );
248 sal_uInt32 nPos,
void* pUserData )
266 OUString aFirstStr(
aStr );
267 sal_Int32 nEnd = aFirstStr.indexOf(
'\t' );
270 aFirstStr = aFirstStr.copy(0, nEnd);
285 DBG_ASSERT(pEntry,
"GetEntryText:Invalid Entry");
286 OUStringBuffer aResult;
298 if (!aResult.isEmpty())
299 aResult.append(
"\t");
312 return aResult.makeStringAndClear();
324 DBG_ASSERT( pEntry,
"SvTabListBox::GetCellText(): Invalid Entry" );
341 if ( pTmpEntry == pEntry )
343 pTmpEntry =
Next( pTmpEntry );
358 DBG_ASSERT( pEntry,
"GetTabEntryText(): Invalid entry " );
359 OUStringBuffer aResult;
369 if ( nCol == 0xffff )
371 if (!aResult.isEmpty())
372 aResult.append(
"\t");
380 if ( sRet.isEmpty() )
381 sRet =
VclResId( STR_SVT_ACC_EMPTY_FIELD );
390 return aResult.makeStringAndClear();
400 if (
nPos == _nEntryPos )
423 if ( _rPos == _nEntryPos )
444 nFlags &= ~MYTABMASK;
471 return aTabs[ nTab ]->GetPos();
487 , m_bFirstPaint(true)
489 , m_pAccessible(nullptr)
516 DBG_ASSERT( pHeaderBar,
"invalid header bar initialization" );
517 m_pImpl->m_pHeaderBar = pHeaderBar;
542 const OUString& rStr,
SvTreeListEntry* pParent, sal_uInt32 nPos, sal_uInt16 nCol,
void* pUserData )
568 auto aHeaders = rJsonWriter.
startArray(
"headers");
580 m_pImpl->m_pHeaderBar->SetOffset( -GetXOffset() );
586 DBG_ASSERT( pParent,
"SvHeaderTabListBox..CreateAccessibleHdl_Impl - accessible parent not found" );
589 css::uno::Reference< XAccessible > xAccParent = pParent->
GetAccessible();
590 if ( xAccParent.is() )
592 Reference< XAccessible > xAccessible =
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderBar(
594 m_pImpl->m_pHeaderBar->SetAccessible( xAccessible );
619 sal_uInt16 nItemCount = pEntry->
ItemCount();
620 if ( nItemCount > ( _nColumn + 1 ) )
632 SAL_WARN(
"svtools.contnr",
"SvHeaderTabListBox::IsCellCheckBox(): column out of range" );
644 return m_pImpl->m_pHeaderBar->GetItemCount();
654 for ( sal_uInt32
i = 0;
i <
nCount; ++
i )
679 return m_pImpl->m_pHeaderBar->GetItemText(
m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) );
735 rRowIndices.realloc(
nCount);
736 auto pRows = rRowIndices.getArray();
745 assert(
nIndex ==
nCount &&
"Mismatch between GetSelectedRowCount() and count of selected rows when iterating.");
769 pParent =
m_pImpl->m_pHeaderBar->GetAccessibleParentWindow();
771 aRect =
m_pImpl->m_pHeaderBar->GetWindowExtentsRelative( *pParent );
786 DBG_ASSERT( !_bIsHeader || 0 == _nRow,
"invalid parameters" );
793 DBG_ASSERT(
m_pImpl->m_pHeaderBar->GetItemCount() > _nColumn,
"invalid column" );
811 OSL_ENSURE(
m_pAccessible,
"Invalid call: Accessible is null" );
813 Reference< XAccessible > xChild;
818 xChild =
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleCheckBoxCell(
821 xChild =
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
829 Reference< XAccessible > xHeader;
848 xChild =
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderCell(
866 Reference< XAccessible > xControl;
908 if (nColumnCount > 0)
910 sal_Int32 nRow =
_nPos / nColumnCount;
911 sal_uInt16 nColumn =
static_cast< sal_uInt16
>(
_nPos % nColumnCount );
923 aRetText =
m_pImpl->m_pHeaderBar->GetItemText(
m_pImpl->m_pHeaderBar->GetItemId(
static_cast<sal_uInt16
>(
_nPos) ) );
933 OSL_FAIL(
"BrowseBox::GetAccessibleName: invalid enum!");
945 if (nColumnCount > 0)
947 sal_Int32 nRow =
_nPos / nColumnCount;
948 sal_uInt16 nColumn =
static_cast< sal_uInt16
>(
_nPos % nColumnCount );
950 OUString aText(
VclResId(STR_SVT_ACC_DESC_TABLISTBOX) );
951 aText = aText.replaceFirst(
"%1", OUString::number( nRow ) );
952 OUString sColHeader =
m_pImpl->m_pHeaderBar->GetItemText(
m_pImpl->m_pHeaderBar->GetItemId( nColumn ) );
953 if ( sColHeader.isEmpty() )
954 sColHeader = OUString::number( nColumn );
955 aText = aText.replaceFirst(
"%2", sColHeader );
970 _rStateSet |= AccessibleStateType::FOCUSABLE;
972 _rStateSet |= AccessibleStateType::FOCUSED;
974 _rStateSet |= AccessibleStateType::ACTIVE;
977 _rStateSet |= AccessibleStateType::ENABLED;
978 _rStateSet |= AccessibleStateType::SENSITIVE;
981 _rStateSet |= AccessibleStateType::VISIBLE;
985 _rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
986 _rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
996 _rStateSet |= AccessibleStateType::VISIBLE;
998 _rStateSet |= AccessibleStateType::ENABLED;
999 _rStateSet |= AccessibleStateType::TRANSIENT;
1006 _rStateSet |= AccessibleStateType::VISIBLE;
1007 _rStateSet |= AccessibleStateType::FOCUSABLE;
1008 _rStateSet |= AccessibleStateType::TRANSIENT;
1010 _rStateSet |= AccessibleStateType::ENABLED;
1020 _rStateSet |= AccessibleStateType::FOCUSABLE;
1021 _rStateSet |= AccessibleStateType::SELECTABLE;
1022 _rStateSet |= AccessibleStateType::TRANSIENT;
1026 _rStateSet |= AccessibleStateType::VISIBLE;
1027 _rStateSet |= AccessibleStateType::ENABLED;
1032 _rStateSet |= AccessibleStateType::ACTIVE;
1034 _rStateSet |= AccessibleStateType::FOCUSED;
1035 _rStateSet |= AccessibleStateType::SELECTED;
1038 _rStateSet |= AccessibleStateType::ENABLED;
1084 DBG_ASSERT( pParent,
"SvHeaderTabListBox::::CreateAccessible - accessible parent not found" );
1086 Reference< XAccessible > xAccessible;
1091 Reference< XAccessible > xAccParent = pParent->
GetAccessible();
1092 if ( xAccParent.is() )
1094 m_pAccessible =
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleTabListBox( xAccParent, *
this );
1110 std::vector< tools::Rectangle > aRects;
AccessibleBrowseBoxObjType
This enumeration contains a constant for each kind of accessible object of a BrowseBox.
@ ColumnHeaderCell
A cell of the row header bar.
@ CheckBoxCell
A cell of the column header bar.
@ Table
The BrowseBox itself.
@ RowHeaderCell
A cell of the data table.
@ RowHeaderBar
The data table.
@ ColumnHeaderBar
The row header bar ("handle column").
@ TableCell
The horizontal column header bar.
OUString GetStock() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
bool GetGlyphBoundRects(const Point &rOrigin, const OUString &rStr, int nIndex, int nLen, std::vector< tools::Rectangle > &rVector) const
void setX(tools::Long nX)
constexpr tools::Long Width() const
const Image & GetBitmap2() const
const Image & GetBitmap1() const
virtual SvLBoxItemType GetType() const =0
const OUString & GetText() const
tools::Long GetPos() const
bool IsSelected(const SvTreeListEntry *pEntry) const
sal_uInt32 GetSelectionCount() const
SvTreeListEntry * NextSelected(SvTreeListEntry *pEntry) const
SvTreeListEntry * FirstSelected() const
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
OUString GetTabEntryText(sal_uInt32 nPos, sal_uInt16 nCol) const
tools::Long GetLogicTab(sal_uInt16 nTab)
virtual OUString GetEntryText(SvTreeListEntry *pEntry) const override
virtual ~SvTabListBox() override
virtual void SetTabs() override
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
void SetTabJustify(sal_uInt16 nTab, SvTabJustify)
virtual void InitEntry(SvTreeListEntry *, const OUString &, const Image &, const Image &) override
static std::u16string_view GetToken(std::u16string_view sStr, sal_Int32 &nIndex)
SvTreeListEntry * GetEntryOnPos(sal_uInt32 _nEntryPos) const
virtual SvTreeListEntry * InsertEntryToColumn(const OUString &, SvTreeListEntry *pParent, sal_uInt32 nPos, sal_uInt16 nCol, void *pUserData=nullptr)
SvTabListBox(vcl::Window *pParent, WinBits)
std::vector< SvLBoxTab > mvTabList
sal_uInt32 GetEntryPos(const SvTreeListEntry *pEntry) const
SvTreeListEntry * GetChildOnPos(SvTreeListEntry *_pParent, sal_uInt32 _nEntryPos, sal_uInt32 &_rPos) const
OUString GetCellText(sal_uInt32 nPos, sal_uInt16 nCol) const
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uInt32 nPos=TREELIST_APPEND, void *pUserData=nullptr) override
void SetTabEditable(sal_uInt16 nTab, bool bEditable)
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uInt32 nPos=TREELIST_APPEND, void *pUserData=nullptr)
void AddTab(tools::Long nPos, SvLBoxTabFlags nFlags)
SvTreeListEntry * FirstChild(SvTreeListEntry *pParent) const
void SetScrolledHdl(const Link< SvTreeListBox *, void > &rLink)
sal_uInt32 GetEntryCount() const
bool GetActivateOnSingleClick() const
virtual void InitEntry(SvTreeListEntry *, const OUString &, const Image &, const Image &)
SvTreeListEntry * Next(SvTreeListEntry *pEntry) const
tools::Rectangle GetBoundingRect(const SvTreeListEntry *pEntry)
Calculate and return the bounding rectangle of an entry.
SvTreeListEntry * GetEntry(SvTreeListEntry *pParent, sal_uInt32 nPos) const
bool Select(SvTreeListEntry *pEntry, bool bSelect=true)
void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff)
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
std::vector< std::unique_ptr< SvLBoxTab > > aTabs
SvTreeListEntry * GetCurEntry() const
SvTreeListEntry * First() const
SvButtonState GetCheckButtonState(SvTreeListEntry *) const
void SelectAll(bool bSelect)
sal_uInt32 GetLevelChildCount(SvTreeListEntry *pParent) const
virtual sal_uInt32 Insert(SvTreeListEntry *pEnt, SvTreeListEntry *pPar, sal_uInt32 nPos=TREELIST_APPEND)
SvTreeList * GetModel() const
SvTreeListEntry * NextSibling() const
const SvLBoxItem * GetFirstItem(SvLBoxItemType eType) const
SvTreeListEntries & GetChildEntries()
const SvLBoxItem & GetItem(size_t nPos) const
void AddItem(std::unique_ptr< SvLBoxItem > pItem)
sal_uInt32 GetAbsPos(const SvTreeListEntry *pEntry) const
virtual css::uno::Reference< css::accessibility::XAccessible > getMyself()=0
returns the XAccessible object itself
virtual css::uno::Reference< css::accessibility::XAccessible > getTable()=0
Returns the accessible object for the table.
virtual css::uno::Reference< css::accessibility::XAccessible > getHeaderBar()=0
returns the accessible object for the column header bar
tools::Rectangle GetWindowExtentsAbsolute() const
bool IsReallyVisible() const
bool HasChildPathFocus(bool bSystemWindow=false) const
bool IsUpdateMode() const
vcl::Window * GetAccessibleParentWindow() const
Size LogicToLogic(const Size &rSzSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
::OutputDevice const * GetOutDev() const
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual OUString GetText() const
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
#define DBG_ASSERT(sCon, aError)
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString VclResId(TranslateId aId)
static void lcl_DumpEntryAndSiblings(tools::JsonWriter &rJsonWriter, SvTreeListEntry *pEntry, SvTabListBox *pTabListBox, bool bCheckButtons)
IMPL_LINK_NOARG(SvHeaderTabListBox, ScrollHdl_Impl, SvTreeListBox *, void)
constexpr SvLBoxTabFlags MYTABMASK
std::vector< std::unique_ptr< SvTreeListEntry > > SvTreeListEntries