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 #ifndef INCLUDED_VCL_SVTABBX_HXX
20 #define INCLUDED_VCL_SVTABBX_HXX
21 
22 #include <vcl/dllapi.h>
23 #include <vcl/treelistbox.hxx>
25 
26 #include <tools/debug.hxx>
27 
28 #include <memory>
29 #include <vector>
30 
31 enum class SvTabJustify
32 {
33  AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
34  AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
36 };
37 
39 {
41  sal_uInt16 const m_nColumn;
42  OUString const m_sOldText;
43 
44  TabListBoxEventData( SvTreeListEntry* pEntry, sal_uInt16 nColumn, const OUString& rOldText ) :
45  m_pEntry( pEntry ), m_nColumn( nColumn ), m_sOldText( rOldText ) {}
46 };
47 
49 {
50 private:
51  std::vector<SvLBoxTab> mvTabList;
52  OUString aCurEntry;
53 
54 protected:
55  static OUString GetToken( const OUString &sStr, sal_Int32 &nIndex );
56 
57  virtual void SetTabs() override;
58  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override;
59 
60  OUString GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const;
61  SvTreeListEntry* GetEntryOnPos( sal_uLong _nEntryPos ) const;
62  SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const;
63 
64 public:
65  SvTabListBox( vcl::Window* pParent, WinBits );
66  virtual ~SvTabListBox() override;
67  virtual void dispose() override;
68  void SetTabs(sal_uInt16 nTabs, long const pTabPositions[], MapUnit = MapUnit::MapAppFont);
70  void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MapUnit::MapAppFont );
71  long GetLogicTab( sal_uInt16 nTab );
72 
73  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
74  bool bChildrenOnDemand = false,
75  sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr ) override;
76 
77  virtual SvTreeListEntry* InsertEntry( const OUString& rText,
78  const Image& rExpandedEntryBmp,
79  const Image& rCollapsedEntryBmp,
80  SvTreeListEntry* pParent = nullptr,
81  bool bChildrenOnDemand = false,
82  sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr ) override;
83 
84  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
85  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr );
86  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
87  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
88  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr );
89 
90  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override;
91  static OUString GetEntryText( SvTreeListEntry*, sal_uInt16 nCol );
92  OUString GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const;
94  void SetEntryText(const OUString&, SvTreeListEntry*, sal_uInt16 nCol=0xffff);
95  OUString GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const;
96  sal_uLong GetEntryPos( const SvTreeListEntry* pEntry ) const;
97 
98  void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
99 };
100 
101 // class SvHeaderTabListBox ---------------------------------------------------
102 
103 class HeaderBar;
104 namespace vcl {
105  struct SvHeaderTabListBoxImpl;
106 }
107 
109 {
110 private:
111  typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
112 
114  std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
116  AccessibleChildren m_aAccessibleChildren;
117 
118  DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
119  DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );
120 
121  void RecalculateAccessibleChildren();
122 
123 public:
124  SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
125  virtual ~SvHeaderTabListBox() override;
126  virtual void dispose() override;
127 
128  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
129 
130  void InitHeaderBar(HeaderBar* pHeaderBar);
131  HeaderBar* GetHeaderBar();
132  static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
133 
134  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
135  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override;
136  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
137  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
138  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr ) override;
139  virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND) override;
140  virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = TREELIST_APPEND ) override;
141 
142  // Accessible -------------------------------------------------------------
143 
144  bool IsTransientChildrenDisabled() const { return !AreChildrenTransient(); }
145 
146  bool IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState );
147 
149  virtual long GetRowCount() const override;
151  virtual sal_uInt16 GetColumnCount() const override;
152 
154  virtual sal_Int32 GetCurrRow() const override;
156  virtual sal_uInt16 GetCurrColumn() const override;
157 
160  virtual OUString GetRowDescription( sal_Int32 _nRow ) const override;
163  virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
164 
166  virtual bool HasRowHeader() const override; //GetColumnId
168  virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
169 
170  virtual void SetNoSelection() override;
172  virtual void SelectAll() override;
173  virtual void SelectRow( long _nRow, bool _bSelect = true, bool bExpand = true ) override;
174  virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
175  virtual sal_Int32 GetSelectedRowCount() const override;
176  virtual sal_Int32 GetSelectedColumnCount() const override;
178  virtual bool IsRowSelected( long _nRow ) const override;
179  virtual bool IsColumnSelected( long _nColumn ) const override;
180  virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
181  virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
182 
184  virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
185  virtual OUString GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const override;
186 
187  virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override;
188  virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override;
189  virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) override;
190 
191  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
192  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
193  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
194 
195  virtual sal_Int32 GetAccessibleControlCount() const override;
196  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
197  virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
198 
199  virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override;
200  virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override;
201  virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override;
202 
203  virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
204  virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
205  virtual vcl::Window* GetWindowInstance() override;
206 
207  virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::vcl::AccessibleBrowseBoxObjType _eType ) const override;
208  virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
209  virtual void GrabTableFocus() override;
210 
211  // OutputDevice
212  virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
213 
214  // Window
215  virtual tools::Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override;
216  virtual void GrabFocus() override;
217  virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
219  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
220  virtual vcl::Window* GetAccessibleParentWindow() const override;
221 
222  virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
223  virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
224 };
225 
226 #endif // INCLUDED_VCL_SVTABBX_HXX
227 
228 
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< tools::Rectangle > MetricVector
Definition: outdev.hxx:139
SvTabJustify
Definition: svtabbx.hxx:31
OUString aCurEntry
Definition: svtabbx.hxx:52
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
sal_uIntPtr sal_uLong
AccessibleChildren m_aAccessibleChildren
Definition: svtabbx.hxx:116
void SetEntryText(SvTreeListEntry *, const OUString &)
bool IsTransientChildrenDisabled() const
Definition: svtabbx.hxx:144
OUString const m_sOldText
Definition: svtabbx.hxx:42
::vcl::IAccessibleTabListBox * m_pAccessible
Definition: svtabbx.hxx:115
TabListBoxEventData(SvTreeListEntry *pEntry, sal_uInt16 nColumn, const OUString &rOldText)
Definition: svtabbx.hxx:44
This abstract class provides methods to implement an accessible table object.
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:168
sal_Int64 WinBits
void SelectAll(bool bSelect, bool bPaint=true)
sal_uInt16 const m_nColumn
Definition: svtabbx.hxx:41
std::unique_ptr<::vcl::SvHeaderTabListBoxImpl > m_pImpl
Definition: svtabbx.hxx:114
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
std::vector< SvLBoxTab > mvTabList
Definition: svtabbx.hxx:51
::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren
Definition: svtabbx.hxx:111
interface for an implementation of a table control's Accessible component
SvLBoxTab * GetTab(SvTreeListEntry const *, SvLBoxItem const *) const
Definition: image.hxx:40
AccessibleBrowseBoxObjType
This enumeration contains a constant for each kind of accessible object of a BrowseBox.
MapUnit
SwLayoutFrame * GetCurrColumn(const SwLayoutFrame *pLayFrame)
void dispose()
SvTreeListEntry *const m_pEntry
Definition: svtabbx.hxx:40
TriState