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 
35 enum class SvTabJustify
36 {
37  AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
38  AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
40 };
41 
43 {
44 private:
45  std::vector<SvLBoxTab> mvTabList;
46  OUString aCurEntry;
47 
48 protected:
49  static OUString GetToken( const OUString &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 
58 public:
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* InsertEntry( const OUString& rText,
71  const Image& rExpandedEntryBmp,
72  const Image& rCollapsedEntryBmp,
73  SvTreeListEntry* pParent = nullptr,
74  bool bChildrenOnDemand = false,
75  sal_uInt32 nPos = TREELIST_APPEND, void* pUserData = nullptr ) override;
76 
77  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
78  sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr );
79  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
80  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
81  sal_uInt32 nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr );
82 
83  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override;
84  static OUString GetEntryText( const SvTreeListEntry*, sal_uInt16 nCol );
85  OUString GetEntryText( sal_uInt32 nPos, sal_uInt16 nCol = 0xffff ) const;
87  OUString GetCellText( sal_uInt32 nPos, sal_uInt16 nCol ) const;
88  sal_uInt32 GetEntryPos( const SvTreeListEntry* pEntry ) const;
89 
90  void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
91  void SetTabEditable( sal_uInt16 nTab, bool bEditable );
92 
93  virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
94 };
95 
96 // class SvHeaderTabListBox ---------------------------------------------------
97 
98 class HeaderBar;
99 namespace vcl {
100  struct SvHeaderTabListBoxImpl;
101 }
102 
104 {
105 private:
106  typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
107 
109  std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
111  AccessibleChildren m_aAccessibleChildren;
112 
113  DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
114  DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );
115 
116  void RecalculateAccessibleChildren();
117 
118 public:
119  SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
120  virtual ~SvHeaderTabListBox() override;
121  virtual void dispose() override;
122 
123  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
124 
125  void InitHeaderBar(HeaderBar* pHeaderBar);
126  HeaderBar* GetHeaderBar();
127  static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
128 
129  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
130  sal_uInt32 nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override;
131  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
132  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
133  sal_uInt32 nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr ) override;
134  virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND) override;
135  virtual sal_uInt32 Insert( SvTreeListEntry* pEntry, sal_uInt32 nRootPos = TREELIST_APPEND ) override;
136 
137  // Accessible -------------------------------------------------------------
138 
139  bool IsCellCheckBox( sal_Int32 _nRow, sal_uInt16 _nColumn, TriState& _rState );
140 
142  virtual sal_Int32 GetRowCount() const override;
144  virtual sal_uInt16 GetColumnCount() const override;
145 
147  virtual sal_Int32 GetCurrRow() const override;
149  virtual sal_uInt16 GetCurrColumn() const override;
150 
153  virtual OUString GetRowDescription( sal_Int32 _nRow ) const override;
156  virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
157 
159  virtual bool HasRowHeader() const override; //GetColumnId
161  virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
162 
163  virtual void SetNoSelection() override;
165  virtual void SelectAll() override;
166  virtual void SelectRow( sal_Int32 _nRow, bool _bSelect = true, bool bExpand = true ) override;
167  virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
168  virtual sal_Int32 GetSelectedRowCount() const override;
169  virtual sal_Int32 GetSelectedColumnCount() const override;
171  virtual bool IsRowSelected( sal_Int32 _nRow ) const override;
172  virtual bool IsColumnSelected( sal_Int32 _nColumn ) const override;
173  virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
174  virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
175 
177  virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
178  virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override;
179 
180  virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override;
181  virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override;
182  virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) override;
183 
184  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
185  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
186  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
187 
188  virtual sal_Int32 GetAccessibleControlCount() const override;
189  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
190  virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
191 
192  virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override;
193  virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override;
194  virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override;
195 
196  virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
197  virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
198  virtual vcl::Window* GetWindowInstance() override;
199 
200  virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, AccessibleBrowseBoxObjType _eType ) const override;
201  virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
202  virtual void GrabTableFocus() override;
203 
204  // OutputDevice
205  virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
206 
207  // Window
208  virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
209  virtual void GrabFocus() override;
210  virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
212  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
213  virtual vcl::Window* GetAccessibleParentWindow() const override;
214 
215  virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
216  virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
217 
218  virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
219 };
220 
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvTabJustify
Definition: svtabbx.hxx:35
OUString aCurEntry
Definition: svtabbx.hxx:46
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
AccessibleChildren m_aAccessibleChildren
Definition: svtabbx.hxx:111
void SetEntryText(SvTreeListEntry *, const OUString &)
::vcl::IAccessibleTabListBox * m_pAccessible
Definition: svtabbx.hxx:110
This abstract class provides methods to implement an accessible table object.
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:168
sal_Int64 WinBits
std::unique_ptr<::vcl::SvHeaderTabListBoxImpl > m_pImpl
Definition: svtabbx.hxx:109
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:167
std::vector< SvLBoxTab > mvTabList
Definition: svtabbx.hxx:45
void SelectAll(bool bSelect)
::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren
Definition: svtabbx.hxx:106
interface for an implementation of a table control's Accessible component
SvLBoxTab * GetTab(SvTreeListEntry const *, SvLBoxItem const *) const
Definition: image.hxx:39
AccessibleBrowseBoxObjType
This enumeration contains a constant for each kind of accessible object of a BrowseBox.
MapUnit
SwLayoutFrame * GetCurrColumn(const SwLayoutFrame *pLayFrame)
void dispose()
TriState