diff options
author | Eike Rathke <erack@redhat.com> | 2014-03-01 03:13:28 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-03-05 07:31:19 -0600 |
commit | 68ec95b3f80408ae50897b043eed69a07d084df9 (patch) | |
tree | 5d32076e843fae44f28e3c8d9dbbacf7648fecbc /accessibility | |
parent | c3403ac888c2e62edaf8befe7982f5f8cc95c16f (diff) |
made ListBox handle more than 64k elements, fdo#61520 related
ListBox and related now handle up to sal_Int32 elements correctly.
sal_Int32 instead of sal_Size or size_t because of UNO and a11y API.
Also disentangled some of the mess of SvTreeList and other containers
regarding sal_uInt16, sal_uLong, long, size_t, ... type mixtures.
Change-Id: Idb6e0ae689dc5bc2cf980721972b57b0261e688a
Reviewed-on: https://gerrit.libreoffice.org/8460
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'accessibility')
5 files changed, 36 insertions, 34 deletions
diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx index 59443696c46b..ce591813c6ab 100644 --- a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx +++ b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx @@ -38,28 +38,28 @@ namespace accessibility public: virtual ~IComboListBoxHelper() = 0; - virtual OUString GetEntry( sal_uInt16 nPos ) const = 0; + virtual OUString GetEntry( sal_Int32 nPos ) const = 0; virtual Rectangle GetDropDownPosSizePixel( ) const = 0; virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) = 0; virtual bool IsActive() const = 0; virtual bool IsEnabled() const = 0; - virtual bool IsEntryVisible( sal_uInt16 nPos ) const = 0; + virtual bool IsEntryVisible( sal_Int32 nPos ) const = 0; virtual sal_uInt16 GetDisplayLineCount() const = 0; virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0; virtual WinBits GetStyle() const = 0; virtual bool IsMultiSelectionEnabled() const = 0; - virtual sal_uInt16 GetTopEntry() const = 0; - virtual bool IsEntryPosSelected( sal_uInt16 nPos ) const = 0; - virtual sal_uInt16 GetEntryCount() const = 0; + virtual sal_Int32 GetTopEntry() const = 0; + virtual bool IsEntryPosSelected( sal_Int32 nPos ) const = 0; + virtual sal_Int32 GetEntryCount() const = 0; virtual void Select() = 0; - virtual void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true ) = 0; - virtual sal_uInt16 GetSelectEntryCount() const = 0; + virtual void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ) = 0; + virtual sal_Int32 GetSelectEntryCount() const = 0; virtual void SetNoSelection() = 0; - virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const = 0; + virtual sal_Int32 GetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const = 0; virtual bool IsInDropDown() const = 0; virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; - virtual long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const = 0; + virtual long GetIndexForPoint( const Point& rPoint, sal_Int32 & nPos ) const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard() = 0; }; diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx index a95acf6df1cd..84e9d5459ffb 100644 --- a/accessibility/inc/accessibility/helper/listboxhelper.hxx +++ b/accessibility/inc/accessibility/helper/listboxhelper.hxx @@ -46,7 +46,7 @@ public: m_aComboListBox( _pListBox ){} - virtual OUString GetEntry( sal_uInt16 nPos ) const + virtual OUString GetEntry( sal_Int32 nPos ) const { return m_aComboListBox.GetEntry( nPos ); } @@ -91,9 +91,9 @@ public: return m_aComboListBox.IsEnabled(); } - virtual bool IsEntryVisible( sal_uInt16 nPos ) const + virtual bool IsEntryVisible( sal_Int32 nPos ) const { - sal_uInt16 nTopEntry = m_aComboListBox.GetTopEntry(); + sal_Int32 nTopEntry = m_aComboListBox.GetTopEntry(); sal_uInt16 nLines = m_aComboListBox.GetDisplayLineCount(); return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) ); } @@ -118,17 +118,17 @@ public: return m_aComboListBox.IsMultiSelectionEnabled(); } - virtual sal_uInt16 GetTopEntry() const + virtual sal_Int32 GetTopEntry() const { return m_aComboListBox.GetTopEntry(); } - virtual bool IsEntryPosSelected( sal_uInt16 nPos ) const + virtual bool IsEntryPosSelected( sal_Int32 nPos ) const { return m_aComboListBox.IsEntryPosSelected(nPos); } - virtual sal_uInt16 GetEntryCount() const + virtual sal_Int32 GetEntryCount() const { return m_aComboListBox.GetEntryCount(); } @@ -138,12 +138,12 @@ public: m_aComboListBox.Select(); } - virtual void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true ) + virtual void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ) { m_aComboListBox.SelectEntryPos(nPos,bSelect); } - virtual sal_uInt16 GetSelectEntryCount() const + virtual sal_Int32 GetSelectEntryCount() const { return m_aComboListBox.GetSelectEntryCount(); } @@ -153,7 +153,7 @@ public: m_aComboListBox.SetNoSelection(); } - virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const + virtual sal_Int32 GetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const { return m_aComboListBox.GetSelectEntryPos(nSelIndex); } @@ -176,7 +176,7 @@ public: return aRect; } - long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const + long GetIndexForPoint( const Point& rPoint, sal_Int32& nPos ) const { return m_aComboListBox.GetIndexForPoint( rPoint, nPos ); } diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx index d9fd0a50a71a..d5a5eaa82499 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx @@ -152,10 +152,10 @@ protected: /// Index in parent. This is settable from the outside. sal_Int32 m_nIndexInParent; sal_Int32 m_nLastTopEntry; - sal_uInt16 m_nLastSelectedPos; + sal_Int32 m_nLastSelectedPos; bool m_bDisableProcessEvent; bool m_bVisible; - sal_uInt16 m_nCurSelectedPos; + sal_Int32 m_nCurSelectedPos; /// The currently selected item. diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx index 75fec91622a5..2db7e9bd08d6 100644 --- a/accessibility/source/standard/vclxaccessiblelist.cxx +++ b/accessibility/source/standard/vclxaccessiblelist.cxx @@ -62,7 +62,7 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), m_bDisableProcessEvent ( false ), m_bVisible ( true ), - m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), + m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), m_xParent ( _xParent ) { // Because combo boxes and list boxes don't have a common interface for @@ -192,12 +192,14 @@ void VCLXAccessibleList::UpdateSelection_Acc (::rtl::OUString sTextOfSelectedIte ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); if ( pBox != NULL ) { - // Find the index of the selected item inside the VCL control... - sal_uInt16 nIndex = pBox->GetEntryPos(sTextOfSelectedItem); - // ...and then find the associated accessibility object. - if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) - nIndex = 0; - UpdateSelection_Impl_Acc(b_IsDropDownList); + // Find the index of the selected item inside the VCL control... + sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem); + // ...and then find the associated accessibility object. + if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) + nIndex = 0; + /* FIXME: is there something missing here? nIndex is unused. Looks + * like copy-paste from VCLXAccessibleList::UpdateSelection() */ + UpdateSelection_Impl_Acc(b_IsDropDownList); } } } @@ -213,7 +215,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList) Reference< XAccessible > xNewAcc; if ( m_pListBoxHelper ) { - sal_uInt16 i=0; + sal_uInt32 i=0; m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND; for ( ListItems::iterator aIter = m_aAccessibleChildren.begin(); aIter != m_aAccessibleChildren.end(); ++aIter,++i) @@ -372,7 +374,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve { uno::Any aOldValue, aNewValue; - sal_uInt16 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos(); + sal_Int32 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos(); if ( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = m_pListBoxHelper->GetTopEntry(); @@ -447,7 +449,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve { uno::Any aOldValue, aNewValue; - sal_uInt16 nPos = m_nCurSelectedPos; + sal_Int32 nPos = m_nCurSelectedPos; if ( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = m_pListBoxHelper->GetTopEntry(); @@ -497,7 +499,7 @@ void VCLXAccessibleList::UpdateSelection (OUString sTextOfSelectedItem) if ( pBox != NULL ) { // Find the index of the selected item inside the VCL control... - sal_uInt16 nIndex = pBox->GetEntryPos(sTextOfSelectedItem); + sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem); // ...and then find the associated accessibility object. if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) nIndex = 0; diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx index f829093a2652..fb507bec6b6c 100644 --- a/accessibility/source/standard/vclxaccessiblelistitem.cxx +++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx @@ -486,12 +486,12 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aP sal_Int32 nIndex = -1; if ( m_pListBoxHelper ) { - sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; + sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND; Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ); Point aPnt( VCLPoint( aPoint ) ); aPnt += aItemRect.TopLeft(); sal_Int32 nI = m_pListBoxHelper->GetIndexForPoint( aPnt, nPos ); - if ( nI != -1 && (sal_uInt16)m_nIndexInParent == nPos ) + if ( nI != -1 && m_nIndexInParent == nPos ) nIndex = nI; } return nIndex; |