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 #pragma once
20 
21 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
22 #error "don't use this in new code"
23 #endif
24 
25 #include <vcl/dllapi.h>
26 #include <vcl/treelistbox.hxx>
28 
29 #include <tools/debug.hxx>
30 
31 #include <memory>
32 #include <vector>
33 
34 enum class SvTabJustify
35 {
36  AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
37  AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
39 };
40 
42 {
43 private:
44  std::vector<SvLBoxTab> mvTabList;
45  OUString aCurEntry;
46 
47 protected:
48  static OUString GetToken( const OUString &sStr, sal_Int32 &nIndex );
49 
50  virtual void SetTabs() override;
51  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override;
52 
53  OUString GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const;
54  SvTreeListEntry* GetEntryOnPos( sal_uLong _nEntryPos ) const;
55  SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const;
56 
57 public:
58  SvTabListBox( vcl::Window* pParent, WinBits );
59  virtual ~SvTabListBox() override;
60  virtual void dispose() override;
61  void SetTabs(sal_uInt16 nTabs, long const pTabPositions[], MapUnit = MapUnit::MapAppFont);
63  long GetLogicTab( sal_uInt16 nTab );
64 
65  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
66  bool bChildrenOnDemand = false,
67  sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr ) override;
68 
69  virtual SvTreeListEntry* InsertEntry( const OUString& rText,
70  const Image& rExpandedEntryBmp,
71  const Image& rCollapsedEntryBmp,
72  SvTreeListEntry* pParent = nullptr,
73  bool bChildrenOnDemand = false,
74  sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr ) override;
75 
76  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
77  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr );
78  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
79  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
80  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr );
81 
82  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override;
83  static OUString GetEntryText( SvTreeListEntry*, sal_uInt16 nCol );
84  OUString GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const;
86  OUString GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const;
87  sal_uLong GetEntryPos( const SvTreeListEntry* pEntry ) const;
88 
89  void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
90  void SetTabEditable( sal_uInt16 nTab, bool bEditable );
91 };
92 
93 // class SvHeaderTabListBox ---------------------------------------------------
94 
95 class HeaderBar;
96 namespace vcl {
97  struct SvHeaderTabListBoxImpl;
98 }
99 
101 {
102 private:
103  typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
104 
106  std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
108  AccessibleChildren m_aAccessibleChildren;
109 
110  DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
111  DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );
112 
113  void RecalculateAccessibleChildren();
114 
115 public:
116  SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
117  virtual ~SvHeaderTabListBox() override;
118  virtual void dispose() override;
119 
120  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
121 
122  void InitHeaderBar(HeaderBar* pHeaderBar);
123  HeaderBar* GetHeaderBar();
124  static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
125 
126  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
127  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override;
128  virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
129  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent,
130  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr ) override;
131  virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND) override;
132  virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = TREELIST_APPEND ) override;
133 
134  // Accessible -------------------------------------------------------------
135 
136  bool IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState );
137 
139  virtual long GetRowCount() const override;
141  virtual sal_uInt16 GetColumnCount() const override;
142 
144  virtual sal_Int32 GetCurrRow() const override;
146  virtual sal_uInt16 GetCurrColumn() const override;
147 
150  virtual OUString GetRowDescription( sal_Int32 _nRow ) const override;
153  virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
154 
156  virtual bool HasRowHeader() const override; //GetColumnId
158  virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
159 
160  virtual void SetNoSelection() override;
162  virtual void SelectAll() override;
163  virtual void SelectRow( long _nRow, bool _bSelect = true, bool bExpand = true ) override;
164  virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
165  virtual sal_Int32 GetSelectedRowCount() const override;
166  virtual sal_Int32 GetSelectedColumnCount() const override;
168  virtual bool IsRowSelected( long _nRow ) const override;
169  virtual bool IsColumnSelected( long _nColumn ) const override;
170  virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
171  virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
172 
174  virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
175  virtual OUString GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const override;
176 
177  virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override;
178  virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override;
179  virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) override;
180 
181  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
182  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
183  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
184 
185  virtual sal_Int32 GetAccessibleControlCount() const override;
186  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
187  virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
188 
189  virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override;
190  virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override;
191  virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override;
192 
193  virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
194  virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;
195  virtual vcl::Window* GetWindowInstance() override;
196 
197  virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::vcl::AccessibleBrowseBoxObjType _eType ) const override;
198  virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
199  virtual void GrabTableFocus() override;
200 
201  // OutputDevice
202  virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
203 
204  // Window
205  virtual tools::Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override;
206  virtual void GrabFocus() override;
207  virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
209  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
210  virtual vcl::Window* GetAccessibleParentWindow() const override;
211 
212  virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
213  virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
214 };
215 
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< tools::Rectangle > MetricVector
Definition: outdev.hxx:139
SvTabJustify
Definition: svtabbx.hxx:34
OUString aCurEntry
Definition: svtabbx.hxx:45
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
sal_uIntPtr sal_uLong
AccessibleChildren m_aAccessibleChildren
Definition: svtabbx.hxx:108
void SetEntryText(SvTreeListEntry *, const OUString &)
::vcl::IAccessibleTabListBox * m_pAccessible
Definition: svtabbx.hxx:107
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)
std::unique_ptr<::vcl::SvHeaderTabListBoxImpl > m_pImpl
Definition: svtabbx.hxx:106
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:44
::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren
Definition: svtabbx.hxx:103
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()
TriState