From 21d6c1022aa528836d20ae1b8be9ea1b84bd61aa Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 5 Apr 2013 11:36:34 +0100 Subject: Related: fdo#61948 data->validity crashes calc There are two scenarios with the cell range thing here, data->validity->allow->cell range scenario a), click the shrink icon, dialog shrinks, click the expand icon, dialog expands again scenario b), click inside the edit box, now you can select cells in the spreadsheet, and the dialog autoshrinks, and autoexpands on mouse release in scenario a there is an expand button in the shrunked dialog, in scenario b the shrink/expand button is hidden Change-Id: I8efe76536feeae10ac70fb7b7e95c70c69b057b5 --- sc/source/ui/dbgui/validate.cxx | 11 ++++++++--- sc/source/ui/miscdlgs/anyrefdg.cxx | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'sc/source/ui') diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index d04e361d9972..33f3ff737ff3 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -110,19 +110,20 @@ void ScTPValidationValue::RefInputStartPreHdl( formula::RefEdit* pEdi if ( ScValidationDlg *pValidationDlg = GetValidationDlg() ) { Window *pNewParent = pValidationDlg->get_refinput_shrink_parent(); - if( pEdit == m_pRefEdit ) + if( pEdit == m_pRefEdit && m_pRefEdit->GetParent() != pNewParent ) { maRefEditPos = m_pRefEdit->GetPosPixel(); maRefEditSize = m_pRefEdit->GetSizePixel(); m_pRefEdit->SetParent(pNewParent); } - if( pButton == &m_btnRef ) + if( pButton == &m_btnRef && m_btnRef.GetParent() != pNewParent ) { maBtnRefPos = m_btnRef.GetPosPixel(); maBtnRefSize = m_btnRef.GetSizePixel(); m_btnRef.SetParent(pNewParent); } + pNewParent->Show(); } } @@ -135,10 +136,14 @@ void ScTPValidationValue::RefInputDonePostHdl() m_pRefEdit->SetPosSizePixel( maRefEditPos, maRefEditSize ); m_btnRef.SetParent( m_pRefEdit ); //if Edit SetParent but button not, the tab order will be incorrect, need button to setparent to anthor window and restore parent later in order to restore the tab order + } + + if( m_btnRef.GetParent()!=this ) + { + m_btnRef.SetParent( this ); m_btnRef.SetPosSizePixel( maBtnRefPos, maBtnRefSize ); } - if( m_btnRef.GetParent()!=this ) m_btnRef.SetParent( this ); if ( ScValidationDlg *pValidationDlg = GetValidationDlg() ) pValidationDlg->get_refinput_shrink_parent()->Hide(); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index e6d9aec151fd..4db0490d43e0 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -520,7 +520,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: pResizeDialog = pRefEdit->GetParentDialog(); Window *pContentArea = pResizeDialog->get_content_area(); for (Window *pCandidate = pRefEdit; - pCandidate != pContentArea && pCandidate->IsVisible(); + pCandidate && (pCandidate != pContentArea && pCandidate->IsVisible()); pCandidate = pCandidate->GetWindow(WINDOW_REALPARENT)) { m_aVisibleWidgets.insert(pCandidate); @@ -528,7 +528,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: //same again with pRefBtn, except stop if there's a //shared parent in the existing widgets for (Window *pCandidate = pRefBtn; - pCandidate != pContentArea && pCandidate->IsVisible(); + pCandidate && (pCandidate != pContentArea && pCandidate->IsVisible()); pCandidate = pCandidate->GetWindow(WINDOW_REALPARENT)) { if (m_aVisibleWidgets.insert(pCandidate).second) -- cgit