Fixing prefs crasher bug 118322. r=sdagley, sr=shaver.

git-svn-id: svn://10.0.0.236/trunk@111433 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%netscape.com
2002-01-05 23:51:04 +00:00
parent 02941169ac
commit d126626bbc
4 changed files with 50 additions and 126 deletions

View File

@@ -615,99 +615,43 @@ nsOutlinerContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval)
NS_IMETHODIMP
nsOutlinerContentView::Select(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::SelectAll()
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(0, mRows.Count() - 1, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(0, mRows.Count() - 1, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::Deselect(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectAll()
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(0, mRows.Count() - 1, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(0, mRows.Count() - 1, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::SelectRange(PRInt32 aStart, PRInt32 aEnd)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aStart, aEnd, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectRange(PRInt32 aStart, PRInt32 aEnd)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aStart, aEnd, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectAllBut(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_TRUE,
PR_TRUE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_TRUE);
}
NS_IMETHODIMP

View File

@@ -184,6 +184,24 @@ class nsOutlinerContentView : public nsIOutlinerView,
nsresult ParseProperties(nsIContent* aContent, Property** aProperty);
void GetSelectElement();
inline nsresult SetOptionsSelected(PRInt32 aStart, PRInt32 aEnd,
PRBool aSelect, PRBool aClear)
{
nsresult rv = NS_OK;
if (!mHasCheckedSelect)
GetSelectElement();
if (mSelectElement) {
mIgnoreOptionSelected = PR_TRUE;
rv = mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, aSelect,
aClear, PR_FALSE, nsnull);
}
return rv;
}
private:
nsCOMPtr<nsIOutlinerBoxObject> mBoxObject;
nsCOMPtr<nsIOutlinerSelection> mSelection;

View File

@@ -615,99 +615,43 @@ nsOutlinerContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval)
NS_IMETHODIMP
nsOutlinerContentView::Select(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::SelectAll()
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(0, mRows.Count() - 1, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(0, mRows.Count() - 1, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::Deselect(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectAll()
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(0, mRows.Count() - 1, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(0, mRows.Count() - 1, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::SelectRange(PRInt32 aStart, PRInt32 aEnd)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, PR_TRUE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aStart, aEnd, PR_TRUE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectRange(PRInt32 aStart, PRInt32 aEnd)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, PR_FALSE,
PR_FALSE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aStart, aEnd, PR_FALSE, PR_FALSE);
}
NS_IMETHODIMP
nsOutlinerContentView::DeselectAllBut(PRInt32 aIndex)
{
if (!mHasCheckedSelect)
GetSelectElement();
mIgnoreOptionSelected = PR_TRUE;
mSelectElement->SetOptionsSelectedByIndex(aIndex, aIndex, PR_TRUE,
PR_TRUE, PR_FALSE, nsnull);
mIgnoreOptionSelected = PR_FALSE;
return NS_OK;
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_TRUE);
}
NS_IMETHODIMP

View File

@@ -184,6 +184,24 @@ class nsOutlinerContentView : public nsIOutlinerView,
nsresult ParseProperties(nsIContent* aContent, Property** aProperty);
void GetSelectElement();
inline nsresult SetOptionsSelected(PRInt32 aStart, PRInt32 aEnd,
PRBool aSelect, PRBool aClear)
{
nsresult rv = NS_OK;
if (!mHasCheckedSelect)
GetSelectElement();
if (mSelectElement) {
mIgnoreOptionSelected = PR_TRUE;
rv = mSelectElement->SetOptionsSelectedByIndex(aStart, aEnd, aSelect,
aClear, PR_FALSE, nsnull);
}
return rv;
}
private:
nsCOMPtr<nsIOutlinerBoxObject> mBoxObject;
nsCOMPtr<nsIOutlinerSelection> mSelection;