From b4f430074cfce0bda32dddfb4d0251ea5aec83ab Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 11 Oct 2012 03:48:33 +0200 Subject: allow ref edit fields that are not direct children of the ScAnyRefDlg Change-Id: I966b67b9f62a8c1c3b9dc3394befe48358cbd34e --- sc/source/ui/inc/anyrefdg.hxx | 1 + sc/source/ui/miscdlgs/anyrefdg.cxx | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'sc/source') diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 7aa3207c5eb7..247edc018a24 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -70,6 +70,7 @@ class ScFormulaReferenceHelper Point aOldEditPos; // Original position of the input field Size aOldEditSize; // Original size of the input field Point aOldButtonPos; // Original position of the button + Window* mpOldEditParent; // Original parent of the edit field and the button sal_Bool bEnableColorRef; sal_Bool bHighLightRef; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 99136b9379be..fa4382304493 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -60,6 +60,7 @@ ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindi , pAccel( NULL ) , pHiddenMarks(NULL) , nRefTab(0) + , mpOldEditParent( NULL ) , bHighLightRef( false ) , bAccInserted( false ) { @@ -365,6 +366,9 @@ void ScFormulaReferenceHelper::RefInputDone( sal_Bool bForced ) bAccInserted = false; } + // restore the parent of the edit field + pRefEdit->SetParent(mpOldEditParent); + // Fenstertitel anpassen m_pWindow->SetText(sOldDialogText); @@ -377,6 +381,7 @@ void ScFormulaReferenceHelper::RefInputDone( sal_Bool bForced ) // set button position and image if( pRefBtn ) { + pRefBtn->SetParent(m_pWindow); pRefBtn->SetPosPixel( aOldButtonPos ); pRefBtn->SetStartImage(); } @@ -408,6 +413,19 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: sNewDialogText = sOldDialogText; sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " )); + mpOldEditParent = pRefEdit->GetParent(); + + // Alte Daten merken + aOldDialogSize = m_pWindow->GetOutputSizePixel(); + aOldEditPos = pRefEdit->GetPosPixel(); + aOldEditSize = pRefEdit->GetSizePixel(); + if (pRefBtn) + aOldButtonPos = pRefBtn->GetPosPixel(); + + pRefEdit->SetParent(m_pWindow); + if(pRefBtn) + pRefBtn->SetParent(m_pWindow); + // Alle Elemente ausser EditCell und Button verstecken sal_uInt16 nChildren = m_pWindow->GetChildCount(); pHiddenMarks = new sal_Bool [nChildren]; @@ -429,13 +447,6 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: } } - // Alte Daten merken - aOldDialogSize = m_pWindow->GetOutputSizePixel(); - aOldEditPos = pRefEdit->GetPosPixel(); - aOldEditSize = pRefEdit->GetSizePixel(); - if (pRefBtn) - aOldButtonPos = pRefBtn->GetPosPixel(); - // Edit-Feld verschieben und anpassen Size aNewDlgSize(aOldDialogSize.Width(), aOldEditSize.Height()); Size aNewEditSize(aNewDlgSize); -- cgit