summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-01 03:13:28 +0100
committerEike Rathke <erack@redhat.com>2014-03-05 07:31:19 -0600
commit68ec95b3f80408ae50897b043eed69a07d084df9 (patch)
tree5d32076e843fae44f28e3c8d9dbbacf7648fecbc /formula
parentc3403ac888c2e62edaf8befe7982f5f8cc95c16f (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 'formula')
-rw-r--r--formula/source/ui/dlg/formula.cxx13
-rw-r--r--formula/source/ui/dlg/funcpage.cxx18
-rw-r--r--formula/source/ui/dlg/funcpage.hxx14
-rw-r--r--formula/source/ui/dlg/structpg.hxx2
4 files changed, 24 insertions, 23 deletions
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index d30397300fe6..4bef88ed534c 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -788,10 +788,11 @@ void FormulaDlg_Impl::FillListboxes()
// 1. Page: select function
if ( pFuncDesc && pFuncDesc->getCategory() )
{
- if( pFuncPage->GetCategory() != pFuncDesc->getCategory()->getNumber() + 1 )
- pFuncPage->SetCategory(static_cast<sal_uInt16>(pFuncDesc->getCategory()->getNumber() + 1));
+ // We'll never have more than int32 max categories so this is safe ...
+ if( pFuncPage->GetCategory() != static_cast<sal_Int32>(pFuncDesc->getCategory()->getNumber() + 1) )
+ pFuncPage->SetCategory(pFuncDesc->getCategory()->getNumber() + 1);
- sal_uInt16 nPos=pFuncPage->GetFuncPos(pFuncDesc);
+ sal_Int32 nPos=pFuncPage->GetFuncPos(pFuncDesc);
pFuncPage->SetFunction(nPos);
}
@@ -1026,7 +1027,7 @@ IMPL_LINK( FormulaDlg_Impl, BtnHdl, PushButton*, pBtn )
IMPL_LINK_NOARG(FormulaDlg_Impl, DblClkHdl)
{
- sal_uInt16 nFunc = pFuncPage->GetFunction();
+ sal_Int32 nFunc = pFuncPage->GetFunction();
// ex-UpdateLRUList
const IFunctionDescription* pDesc = pFuncPage->GetFuncDesc(nFunc);
@@ -1542,9 +1543,9 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, MatrixHdl)
IMPL_LINK_NOARG(FormulaDlg_Impl, FuncSelHdl)
{
- sal_uInt16 nCat = pFuncPage->GetCategory();
+ sal_Int32 nCat = pFuncPage->GetCategory();
if ( nCat == LISTBOX_ENTRY_NOTFOUND ) nCat = 0;
- sal_uInt16 nFunc = pFuncPage->GetFunction();
+ sal_Int32 nFunc = pFuncPage->GetFunction();
if ( nFunc == LISTBOX_ENTRY_NOTFOUND ) nFunc = 0;
if ( (pFuncPage->GetFunctionEntryCount() > 0)
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index f38d110b98d5..dd21c15b743b 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -113,9 +113,9 @@ void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
void FuncPage::UpdateFunctionList()
{
- sal_uInt16 nSelPos = aLbCategory.GetSelectEntryPos();
+ sal_Int32 nSelPos = aLbCategory.GetSelectEntryPos();
const IFunctionCategory* pCategory = static_cast<const IFunctionCategory*>(aLbCategory.GetEntryData(nSelPos));
- sal_uInt16 nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ sal_Int32 nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
? Lb2Cat( nSelPos ) : 0;
(void)nCategory;
@@ -189,16 +189,16 @@ IMPL_LINK_NOARG(FuncPage, DblClkHdl)
return 0;
}
-void FuncPage::SetCategory(sal_uInt16 nCat)
+void FuncPage::SetCategory(sal_Int32 nCat)
{
aLbCategory.SelectEntryPos(nCat);
UpdateFunctionList();
}
-sal_uInt16 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc)
+sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc)
{
return aLbFunction.GetEntryPos(_pDesc);
}
-void FuncPage::SetFunction(sal_uInt16 nFunc)
+void FuncPage::SetFunction(sal_Int32 nFunc)
{
aLbFunction.SelectEntryPos(nFunc);
}
@@ -208,17 +208,17 @@ void FuncPage::SetFocus()
aLbFunction.GrabFocus();
}
-sal_uInt16 FuncPage::GetCategory()
+sal_Int32 FuncPage::GetCategory()
{
return aLbCategory.GetSelectEntryPos();
}
-sal_uInt16 FuncPage::GetFunction()
+sal_Int32 FuncPage::GetFunction()
{
return aLbFunction.GetSelectEntryPos();
}
-sal_uInt16 FuncPage::GetFunctionEntryCount()
+sal_Int32 FuncPage::GetFunctionEntryCount()
{
return aLbFunction.GetSelectEntryCount();
}
@@ -227,7 +227,7 @@ OUString FuncPage::GetSelFunctionName() const
{
return aLbFunction.GetSelectEntry();
}
-const IFunctionDescription* FuncPage::GetFuncDesc( sal_uInt16 nPos ) const
+const IFunctionDescription* FuncPage::GetFuncDesc( sal_Int32 nPos ) const
{
// not pretty, but hopefully rare
return (const IFunctionDescription*) aLbFunction.GetEntryData(nPos);
diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx
index 9c4efbca498e..0ace168d4256 100644
--- a/formula/source/ui/dlg/funcpage.hxx
+++ b/formula/source/ui/dlg/funcpage.hxx
@@ -89,15 +89,15 @@ public:
FuncPage( Window* pParent,const IFunctionManager* _pFunctionManager);
- void SetCategory(sal_uInt16 nCat);
- void SetFunction(sal_uInt16 nFunc);
+ void SetCategory(sal_Int32 nCat);
+ void SetFunction(sal_Int32 nFunc);
void SetFocus();
- sal_uInt16 GetCategory();
- sal_uInt16 GetFunction();
- sal_uInt16 GetFunctionEntryCount();
+ sal_Int32 GetCategory();
+ sal_Int32 GetFunction();
+ sal_Int32 GetFunctionEntryCount();
- sal_uInt16 GetFuncPos(const IFunctionDescription* _pDesc);
- const IFunctionDescription* GetFuncDesc( sal_uInt16 nPos ) const;
+ sal_Int32 GetFuncPos(const IFunctionDescription* _pDesc);
+ const IFunctionDescription* GetFuncDesc( sal_Int32 nPos ) const;
OUString GetSelFunctionName() const;
void SetDoubleClickHdl( const Link& rLink ) { aDoubleClickLink = rLink; }
diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx
index 1dea99e40913..4988f47b509f 100644
--- a/formula/source/ui/dlg/structpg.hxx
+++ b/formula/source/ui/dlg/structpg.hxx
@@ -55,7 +55,7 @@ public:
const OUString& rText,
const Image& rEntryImg,
SvTreeListEntry* pParent = NULL,
- sal_uLong nPos = LIST_APPEND,
+ sal_uLong nPos = TREELIST_APPEND,
IFormulaToken* pToken = NULL );
void SetActiveFlag(sal_Bool bFlag=sal_True);