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 /include/vcl | |
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 'include/vcl')
-rw-r--r-- | include/vcl/combobox.h | 7 | ||||
-rw-r--r-- | include/vcl/combobox.hxx | 52 | ||||
-rw-r--r-- | include/vcl/field.hxx | 10 | ||||
-rw-r--r-- | include/vcl/lstbox.h | 9 | ||||
-rw-r--r-- | include/vcl/lstbox.hxx | 64 |
5 files changed, 73 insertions, 69 deletions
diff --git a/include/vcl/combobox.h b/include/vcl/combobox.h index 0127b3dee4eb..047a24cd9d41 100644 --- a/include/vcl/combobox.h +++ b/include/vcl/combobox.h @@ -22,9 +22,10 @@ #include <vcl/lstbox.h> -#define COMBOBOX_APPEND ((sal_uInt16)0xFFFF) -#define COMBOBOX_ENTRY_NOTFOUND ((sal_uInt16)0xFFFF) -#define COMBOBOX_ERROR ((sal_uInt16)0xFFFF) +#define COMBOBOX_APPEND (SAL_MAX_INT32) +#define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) +#define COMBOBOX_ERROR (SAL_MAX_INT32) +#define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1) #endif // INCLUDED_VCL_COMBOBOX_H diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 7809188db1bb..b9bde8c2b1bb 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -42,7 +42,7 @@ private: ImplListBox* mpImplLB; ImplBtn* mpBtn; ImplListBoxFloatingWindow* mpFloatWin; - sal_uInt16 mnDDHeight; + sal_uInt16 mnDDHeight; sal_Unicode mcMultiSep; bool mbDDAutoSize : 1; bool mbSyntheticModify : 1; @@ -129,21 +129,21 @@ public: virtual void SetText( const OUString& rStr ); virtual void SetText( const OUString& rStr, const Selection& rNewSelection ); - virtual sal_uInt16 InsertEntry(const OUString& rStr, sal_uInt16 nPos = COMBOBOX_APPEND); - void InsertEntryWithImage( const OUString& rStr, const Image& rImage, sal_uInt16 nPos = COMBOBOX_APPEND ); + virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 nPos = COMBOBOX_APPEND); + void InsertEntryWithImage( const OUString& rStr, const Image& rImage, sal_Int32 nPos = COMBOBOX_APPEND ); void RemoveEntry( const OUString& rStr ); - virtual void RemoveEntryAt(sal_uInt16 nPos); + virtual void RemoveEntryAt(sal_Int32 nPos); void Clear(); - sal_uInt16 GetEntryPos( const OUString& rStr ) const; - Image GetEntryImage( sal_uInt16 nPos ) const; - OUString GetEntry( sal_uInt16 nPos ) const; - sal_uInt16 GetEntryCount() const; + sal_Int32 GetEntryPos( const OUString& rStr ) const; + Image GetEntryImage( sal_Int32 nPos ) const; + OUString GetEntry( sal_Int32 nPos ) const; + sal_Int32 GetEntryCount() const; - bool IsTravelSelect() const; - bool IsInDropDown() const; + bool IsTravelSelect() const; + bool IsInDropDown() const; void ToggleDropDown(); long CalcWindowSizePixel( sal_uInt16 nLines ) const; @@ -154,13 +154,13 @@ public: void DrawEntry( const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos = false ); void SetBorderStyle( sal_uInt16 nBorderStyle ); - void SetSeparatorPos( sal_uInt16 n = LISTBOX_ENTRY_NOTFOUND ); + void SetSeparatorPos( sal_Int32 n = LISTBOX_ENTRY_NOTFOUND ); void EnableAutocomplete( bool bEnable, bool bMatchCase = false ); - bool IsAutocompleteEnabled() const; + bool IsAutocompleteEnabled() const; void EnableMultiSelection( bool bMulti ); - bool IsMultiSelectionEnabled() const; + bool IsMultiSelectionEnabled() const; void SetMultiSelectionSeparator( sal_Unicode cSep ) { mcMultiSep = cSep; } sal_Unicode GetMultiSelectionSeparator() const { return mcMultiSep; } @@ -177,24 +177,24 @@ public: void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep = ';' ); OUString GetMRUEntries( sal_Unicode cSep = ';' ) const; - void SetMaxMRUCount( sal_uInt16 n ); - sal_uInt16 GetMaxMRUCount() const; - sal_uInt16 GetMRUCount() const; - void SetEntryData( sal_uInt16 nPos, void* pNewData ); - void* GetEntryData( sal_uInt16 nPos ) const; + void SetMaxMRUCount( sal_Int32 n ); + sal_Int32 GetMaxMRUCount() const; + sal_Int32 GetMRUCount() const; + void SetEntryData( sal_Int32 nPos, void* pNewData ); + void* GetEntryData( sal_Int32 nPos ) const; - sal_uInt16 GetTopEntry() const; + sal_Int32 GetTopEntry() const; void SetProminentEntryType( ProminentEntry eType ); - sal_uInt16 GetDisplayLineCount() const; + sal_uInt16 GetDisplayLineCount() const; - sal_uInt16 GetSelectEntryCount() const; - sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const; - bool IsEntryPosSelected( sal_uInt16 nPos ) const; - void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true ); + sal_Int32 GetSelectEntryCount() const; + sal_Int32 GetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const; + bool IsEntryPosSelected( sal_Int32 nPos ) const; + void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ); void SetNoSelection(); - Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const; + Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; /** checks whether a certain point lies within the bounds of a list item and returns the item as well as the character position @@ -215,7 +215,7 @@ public: if no item is at that point. */ using Control::GetIndexForPoint; - long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const; + long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const; sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; } void setMaxWidthChars(sal_Int32 nWidth); diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 47b77abda784..e9bd9e5f4440 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -128,7 +128,7 @@ public: const OUString& GetLiteralMask() const { return maLiteralMask; } void SetFormatFlags( sal_uInt16 nFlags ) { mnFormatFlags = nFlags; } - sal_uInt16 GetFormatFlags() const { return mnFormatFlags; } + sal_uInt16 GetFormatFlags() const { return mnFormatFlags; } void SetString( const OUString& rStr ); OUString GetString() const; @@ -732,7 +732,7 @@ public: virtual void ReformatAll(); - void InsertValue( sal_Int64 nValue, sal_uInt16 nPos = COMBOBOX_APPEND ); + void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND ); }; @@ -758,9 +758,9 @@ public: virtual void ReformatAll(); void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE, - sal_uInt16 nPos = COMBOBOX_APPEND ); - sal_Int64 GetValue( sal_uInt16 nPos, FieldUnit eOutUnit = FUNIT_NONE ) const; - sal_uInt16 GetValuePos( sal_Int64 nValue, + sal_Int32 nPos = COMBOBOX_APPEND ); + sal_Int64 GetValue( sal_Int32 nPos, FieldUnit eOutUnit = FUNIT_NONE ) const; + sal_Int32 GetValuePos( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE ) const; // Needed, because GetValue() with nPos hide these functions diff --git a/include/vcl/lstbox.h b/include/vcl/lstbox.h index 80383cfec234..50e121fad6fc 100644 --- a/include/vcl/lstbox.h +++ b/include/vcl/lstbox.h @@ -20,9 +20,12 @@ #ifndef INCLUDED_VCL_LSTBOX_H #define INCLUDED_VCL_LSTBOX_H -#define LISTBOX_APPEND ((sal_uInt16)0xFFFF) -#define LISTBOX_ENTRY_NOTFOUND ((sal_uInt16)0xFFFF) -#define LISTBOX_ERROR ((sal_uInt16)0xFFFF) +#include <sal/types.h> + +#define LISTBOX_APPEND (SAL_MAX_INT32) +#define LISTBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) +#define LISTBOX_ERROR (SAL_MAX_INT32) +#define LISTBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1) diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index bfba165e8466..c81b52a5b916 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -42,8 +42,8 @@ private: ImplWin* mpImplWin; ImplBtn* mpBtn; sal_uInt16 mnDDHeight; - sal_uInt16 mnSaveValue; - sal_Int32 m_nMaxWidthChars; + sal_Int32 mnSaveValue; + sal_Int32 m_nMaxWidthChars; Link maSelectHdl; Link maDoubleClickHdl; sal_uInt16 mnLineCount; @@ -115,32 +115,32 @@ public: void EnableDDAutoWidth( bool b ); - sal_uInt16 InsertEntry( const OUString& rStr, sal_uInt16 nPos = LISTBOX_APPEND ); - sal_uInt16 InsertEntry( const OUString& rStr, const Image& rImage, sal_uInt16 nPos = LISTBOX_APPEND ); + sal_Int32 InsertEntry( const OUString& rStr, sal_Int32 nPos = LISTBOX_APPEND ); + sal_Int32 InsertEntry( const OUString& rStr, const Image& rImage, sal_Int32 nPos = LISTBOX_APPEND ); void RemoveEntry( const OUString& rStr ); - void RemoveEntry( sal_uInt16 nPos ); + void RemoveEntry( sal_Int32 nPos ); void Clear(); - sal_uInt16 GetEntryPos( const OUString& rStr ) const; - sal_uInt16 GetEntryPos( const void* pData ) const; - Image GetEntryImage( sal_uInt16 nPos ) const; - OUString GetEntry( sal_uInt16 nPos ) const; - sal_uInt16 GetEntryCount() const; + sal_Int32 GetEntryPos( const OUString& rStr ) const; + sal_Int32 GetEntryPos( const void* pData ) const; + Image GetEntryImage( sal_Int32 nPos ) const; + OUString GetEntry( sal_Int32 nPos ) const; + sal_Int32 GetEntryCount() const; void SelectEntry( const OUString& rStr, bool bSelect = true ); - void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true ); + void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ); - sal_uInt16 GetSelectEntryCount() const; - OUString GetSelectEntry( sal_uInt16 nSelIndex = 0 ) const; - sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const; + sal_Int32 GetSelectEntryCount() const; + OUString GetSelectEntry( sal_Int32 nSelIndex = 0 ) const; + sal_Int32 GetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const; bool IsEntrySelected(const OUString& rStr) const; - bool IsEntryPosSelected( sal_uInt16 nPos ) const; + bool IsEntryPosSelected( sal_Int32 nPos ) const; void SetNoSelection(); - void SetEntryData( sal_uInt16 nPos, void* pNewData ); - void* GetEntryData( sal_uInt16 nPos ) const; + void SetEntryData( sal_Int32 nPos, void* pNewData ); + void* GetEntryData( sal_Int32 nPos ) const; /** this methods stores a combination of flags from the LISTBOX_ENTRY_FLAG_* defines at the given entry. @@ -150,36 +150,36 @@ public: to change the internal behaviour of the ListBox implementation for specific entries. */ - void SetEntryFlags( sal_uInt16 nPos, long nFlags ); + void SetEntryFlags( sal_Int32 nPos, long nFlags ); /** this methods gets the current combination of flags from the LISTBOX_ENTRY_FLAG_* defines from the given entry. See description of the possible LISTBOX_ENTRY_FLAG_* flags for details. */ - long GetEntryFlags( sal_uInt16 nPos ) const; + long GetEntryFlags( sal_Int32 nPos ) const; - void SetTopEntry( sal_uInt16 nPos ); - sal_uInt16 GetTopEntry() const; + void SetTopEntry( sal_Int32 nPos ); + sal_Int32 GetTopEntry() const; void SaveValue() { mnSaveValue = GetSelectEntryPos(); } - sal_uInt16 GetSavedValue() const { return mnSaveValue; } + sal_Int32 GetSavedValue() const { return mnSaveValue; } - void SetSeparatorPos( sal_uInt16 n = LISTBOX_ENTRY_NOTFOUND ); - sal_uInt16 GetSeparatorPos() const; + void SetSeparatorPos( sal_Int32 n = LISTBOX_ENTRY_NOTFOUND ); + sal_Int32 GetSeparatorPos() const; - bool IsTravelSelect() const; - bool IsInDropDown() const; + bool IsTravelSelect() const; + bool IsInDropDown() const; void ToggleDropDown(); void EnableMultiSelection( bool bMulti, bool bStackSelection ); void EnableMultiSelection( bool bMulti ); - bool IsMultiSelectionEnabled() const; + bool IsMultiSelectionEnabled() const; void SetReadOnly( bool bReadOnly = true ); - bool IsReadOnly() const; + bool IsReadOnly() const; - Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const; + Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; void SetUserItemSize( const Size& rSz ); @@ -199,7 +199,7 @@ public: Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const; - sal_uInt16 GetMRUCount() const; + sal_Int32 GetMRUCount() const; sal_uInt16 GetDisplayLineCount() const; void EnableMirroring(); @@ -226,7 +226,7 @@ public: if no item is at that point. */ using Control::GetIndexForPoint; - long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const; + long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const; sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; } void setMaxWidthChars(sal_Int32 nWidth); @@ -248,7 +248,7 @@ public: private: // Bei MultiListBox nicht erlaubt... void SaveValue(); - sal_uInt16 GetSavedValue(); + sal_Int32 GetSavedValue(); public: explicit MultiListBox( Window* pParent, WinBits nStyle = 0 ); |