[Libreoffice-commits] core.git: 4 commits - cui/uiconfig formula/inc formula/source sc/source sfx2/source vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Fri Mar 8 05:42:52 PST 2013


 cui/uiconfig/ui/pageformatpage.ui         |   11 ++++
 formula/inc/formula/funcutl.hxx           |   13 +++-
 formula/source/ui/dlg/formula.cxx         |    2 
 formula/source/ui/dlg/funcutl.cxx         |   26 +++++----
 formula/source/ui/dlg/parawin.cxx         |    2 
 sc/source/ui/condformat/condformatdlg.cxx |    2 
 sc/source/ui/dbgui/consdlg.cxx            |    4 -
 sc/source/ui/dbgui/dbnamdlg.cxx           |    2 
 sc/source/ui/dbgui/filtdlg.cxx            |    2 
 sc/source/ui/dbgui/pvlaydlg.cxx           |    4 -
 sc/source/ui/dbgui/sfiltdlg.cxx           |    4 -
 sc/source/ui/dbgui/validate.cxx           |   74 ++++++++++++++++-----------
 sc/source/ui/inc/anyrefdg.hxx             |    3 +
 sc/source/ui/inc/validate.hxx             |   15 ++++-
 sc/source/ui/miscdlgs/anyrefdg.cxx        |   80 ++++++++++++++++++------------
 sc/source/ui/miscdlgs/crnrdlg.cxx         |    4 -
 sc/source/ui/miscdlgs/highred.cxx         |    2 
 sc/source/ui/miscdlgs/optsolver.cxx       |   22 ++++----
 sc/source/ui/miscdlgs/simpref.cxx         |    2 
 sc/source/ui/miscdlgs/solvrdlg.cxx        |    4 -
 sc/source/ui/miscdlgs/tabopdlg.cxx        |    6 +-
 sc/source/ui/namedlg/namedefdlg.cxx       |    2 
 sc/source/ui/namedlg/namedlg.cxx          |    2 
 sc/source/ui/pagedlg/areasdlg.cxx         |    6 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx   |    2 
 sfx2/source/dialog/tabdlg.cxx             |    4 +
 vcl/inc/vcl/dialog.hxx                    |    7 ++
 vcl/source/window/builder.cxx             |   18 +++++-
 vcl/source/window/dialog.cxx              |   16 +++++-
 29 files changed, 220 insertions(+), 121 deletions(-)

New commits:
commit 213524cf5a2351a2a022495d4988437720401760
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 8 13:41:51 2013 +0000

    make link RefButton and widget for shrunk dialog title explicit
    
    Change-Id: Ia6dd6cc4cf89b067310639bc3da72abbc6fa1ad2

diff --git a/formula/inc/formula/funcutl.hxx b/formula/inc/formula/funcutl.hxx
index b9e3267..76a2287 100644
--- a/formula/inc/formula/funcutl.hxx
+++ b/formula/inc/formula/funcutl.hxx
@@ -62,9 +62,7 @@ public:
     void                StartUpdateData();
 
     void                SetRefDialog( IControlReferenceHandler* pDlg );
-    inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
-    Window*             GetLabelWidgetForShrinkMode() { return m_pLabelWidget; }
-    void                SetLabelWidgetForShrinkMode(Window *pLabel) { m_pLabelWidget = pLabel; }
+    IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
 };
 
 
@@ -79,6 +77,7 @@ private:
     OUString            aExpandQuickHelp;
     IControlReferenceHandler*      pAnyRefDlg;     // parent dialog
     RefEdit*            pRefEdit;       // zugeordnetes Edit-Control
+    Window*             pLabelWidget;
 
 protected:
     virtual void        Click();
@@ -89,13 +88,17 @@ protected:
 public:
                         RefButton(Window* _pParent, const ResId& rResId);
                         RefButton(Window* _pParent, WinBits nStyle = 0);
-                        RefButton(Window* _pParent, const ResId& rResId, RefEdit* pEdit ,IControlReferenceHandler* pDlg);
+                        RefButton(Window* _pParent, const ResId& rResId,
+                                  RefEdit* pEdit, Window* pShrinkModeLabel,
+                                  IControlReferenceHandler* pDlg);
 
-    void                SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit );
+    void                SetReferences( IControlReferenceHandler* pDlg,
+                                       RefEdit* pEdit, Window* pShrinkModeLabel );
 
     void                SetStartImage();
     void                SetEndImage();
-    inline void         DoRef() { Click(); }
+    void                DoRef() { Click(); }
+    Window*             GetLabelWidgetForShrinkMode() { return pLabelWidget; }
 };
 
 } // formula
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 8ae904b..aec7824 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -266,7 +266,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     aBtnForward     ( pParent, ModuleRes( BTN_FORWARD ) ),
     aBtnEnd         ( pParent, ModuleRes( BTN_END ) ),
     aEdRef          ( pParent, _pDlg, ModuleRes( ED_REF) ),
-    aRefBtn         ( pParent, ModuleRes( RB_REF),&aEdRef,_pDlg ),
+    aRefBtn         ( pParent, ModuleRes( RB_REF),&aEdRef,&aFtEditName,_pDlg ),
     aFtFormResult   ( pParent, ModuleRes( FT_FORMULA_RESULT)),
     aWndFormResult  ( pParent, ModuleRes( WND_FORMULA_RESULT)),
     pTheRefEdit     (NULL),
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 64830d5..8d39ea9 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -847,19 +847,17 @@ void EditBox::UpdateOldSel()
 
 #define SC_ENABLE_TIME 100
 
-RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ) :
-    Edit( _pParent, rResId ),
-    pAnyRefDlg( pParent ),
-    m_pLabelWidget(NULL)
+RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId )
+    : Edit( _pParent, rResId )
+    , pAnyRefDlg( pParent )
 {
     aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
     aTimer.SetTimeout( SC_ENABLE_TIME );
 }
 
-RefEdit::RefEdit( Window* _pParent, WinBits nStyle ) :
-    Edit( _pParent, nStyle ),
-    pAnyRefDlg( NULL ),
-    m_pLabelWidget(NULL)
+RefEdit::RefEdit( Window* _pParent, WinBits nStyle )
+    : Edit( _pParent, nStyle )
+    , pAnyRefDlg( NULL )
 {
     aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
     aTimer.SetTimeout( SC_ENABLE_TIME );
@@ -969,7 +967,8 @@ RefButton::RefButton( Window* _pParent, const ResId& rResId) :
     aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ).toString() ),
     aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ).toString() ),
     pAnyRefDlg( NULL ),
-    pRefEdit( NULL )
+    pRefEdit( NULL ),
+    pLabelWidget( NULL )
 {
     SetStartImage();
 }
@@ -981,7 +980,8 @@ RefButton::RefButton( Window* _pParent, WinBits nStyle ) :
     aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ).toString() ),
     aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ).toString() ),
     pAnyRefDlg( NULL ),
-    pRefEdit( NULL )
+    pRefEdit( NULL ),
+    pLabelWidget( NULL )
 {
     SetStartImage();
 }
@@ -991,14 +991,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeRefButton(Window *pParent,
     return new RefButton(pParent, 0);
 }
 
-RefButton::RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit, IControlReferenceHandler* _pDlg ) :
+RefButton::RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit, Window* pShrinkModeLabel, IControlReferenceHandler* _pDlg ) :
     ImageButton( _pParent, rResId ),
     aImgRefStart( ModuleRes( RID_BMP_REFBTN1 ) ),
     aImgRefDone( ModuleRes( RID_BMP_REFBTN2 ) ),
     aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ).toString() ),
     aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ).toString() ),
     pAnyRefDlg( _pDlg ),
-    pRefEdit( pEdit )
+    pRefEdit( pEdit ),
+    pLabelWidget( pShrinkModeLabel )
 {
     SetStartImage();
 }
@@ -1015,10 +1016,11 @@ void RefButton::SetEndImage()
     SetQuickHelpText( aExpandQuickHelp );
 }
 
-void RefButton::SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit )
+void RefButton::SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit, Window* pShrinkModeLabel )
 {
     pAnyRefDlg = pDlg;
     pRefEdit = pEdit;
+    pLabelWidget = pShrinkModeLabel;
 }
 
 //----------------------------------------------------------------------------
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index 004dcf0..4c68e6d 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -387,7 +387,7 @@ void ParaWin::InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBt
                         ArgEdit& rEdArg, RefButton& rRefBtn)
 {
 
-    rRefBtn.SetReferences(pMyParent,&rEdArg);
+    rRefBtn.SetReferences(pMyParent, &rEdArg, &rFtArg);
     rEdArg.SetRefDialog(pMyParent);
 
     aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index d3e1bbf..4896f55 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -377,7 +377,7 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond
     maBtnCancel( this, ScResId( BTN_CANCEL ) ),
     maFtRange( this, ScResId( FT_RANGE ) ),
     maEdRange( this, this, ScResId( ED_RANGE ) ),
-    maRbRange( this, ScResId( RB_RANGE ), &maEdRange, this ),
+    maRbRange( this, ScResId( RB_RANGE ), &maEdRange, &maFtRange, this ),
     maCondFormList( this, ScResId( CTRL_LIST ), pDoc, pFormat, rRange, rPos, eType ),
     maPos(rPos),
     mpDoc(pDoc),
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index ce675a2..74673c7 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -78,12 +78,12 @@ ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, Window
         aLbDataArea     ( this, ScResId( LB_DATA_AREA ) ),
         aFtDataArea     ( this, ScResId( FT_DATA_AREA ) ),
         aEdDataArea     ( this, this, ScResId( ED_DATA_AREA ) ),
-        aRbDataArea     ( this, ScResId( RB_DATA_AREA ), &aEdDataArea, this ),
+        aRbDataArea     ( this, ScResId( RB_DATA_AREA ), &aEdDataArea, &aFtDataArea, this ),
 
         aLbDestArea     ( this, ScResId( LB_DEST_AREA ) ),
         aFtDestArea     ( this, ScResId( FT_DEST_AREA ) ),
         aEdDestArea     ( this, this, ScResId( ED_DEST_AREA ) ),
-        aRbDestArea     ( this, ScResId( RB_DEST_AREA ), &aEdDestArea, this),
+        aRbDestArea     ( this, ScResId( RB_DEST_AREA ), &aEdDestArea, &aFtDestArea, this),
 
         aFlConsBy       ( this, ScResId( FL_CONSBY ) ),
         aBtnByRow       ( this, ScResId( BTN_BYROW ) ),
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 95f22f5..d4744c4 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -129,7 +129,7 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
 
         aFlAssign       ( this, ScResId( FL_ASSIGN ) ),
         aEdAssign       ( this, this, ScResId( ED_DBAREA ) ),
-        aRbAssign       ( this, ScResId( RB_DBAREA ), &aEdAssign, this ),
+        aRbAssign       ( this, ScResId( RB_DBAREA ), &aEdAssign, &aFlAssign, this ),
 
         aFlOptions      ( this, ScResId( FL_OPTIONS ) ),
         aBtnHeader      ( this, ScResId( BTN_HEADER ) ),
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 921949c..a5a4526 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -94,7 +94,7 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
         aBtnCopyResult  ( this, ScResId( BTN_COPY_RESULT ) ),
         aLbCopyArea     ( this, ScResId( LB_COPY_AREA ) ),
         aEdCopyArea     ( this, this, ScResId( ED_COPY_AREA ) ),
-        aRbCopyArea     ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, this ),
+        aRbCopyArea     ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, NULL, this ),
         aBtnDestPers    ( this, ScResId( BTN_DEST_PERS ) ),
         aFtDbAreaLabel  ( this, ScResId( FT_DBAREA_LABEL ) ),
         aFtDbArea       ( this, ScResId( FT_DBAREA ) ),
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index cc6f6f6..e232de9 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -102,11 +102,11 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window
     maFlAreas( this, ScResId( FL_OUTPUT ) ),
     maFtInArea( this, ScResId( FT_INAREA) ),
     maEdInPos( this, this, ScResId( ED_INAREA) ),
-    maRbInPos( this, ScResId( RB_INAREA ), &maEdInPos, this ),
+    maRbInPos( this, ScResId( RB_INAREA ), &maEdInPos, &maFtInArea, this ),
     maLbOutPos( this, ScResId( LB_OUTAREA ) ),
     maFtOutArea( this, ScResId( FT_OUTAREA ) ),
     maEdOutPos( this, this, ScResId( ED_OUTAREA ) ),
-    maRbOutPos( this, ScResId( RB_OUTAREA ), &maEdOutPos, this ),
+    maRbOutPos( this, ScResId( RB_OUTAREA ), &maEdOutPos, &maFtOutArea, this ),
     maBtnIgnEmptyRows( this, ScResId( BTN_IGNEMPTYROWS ) ),
     maBtnDetectCat( this, ScResId( BTN_DETECTCAT ) ),
     maBtnTotalCol( this, ScResId( BTN_TOTALCOL ) ),
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index a7c9107..19f72ec 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -57,7 +57,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi
         aFtFilterArea   ( this, ScResId( FT_CRITERIA_AREA ) ),
         aLbFilterArea   ( this, ScResId( LB_CRITERIA_AREA ) ),
         aEdFilterArea   ( this, this, ScResId( ED_CRITERIA_AREA ) ),
-        aRbFilterArea   ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ),
+        aRbFilterArea   ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, &aFtFilterArea, this ),
         //
         aFlOptions      ( this, ScResId( FL_OPTIONS ) ),
         aBtnCase        ( this, ScResId( BTN_CASE ) ),
@@ -67,7 +67,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi
         aBtnCopyResult  ( this, ScResId( BTN_COPY_RESULT ) ),
         aLbCopyArea     ( this, ScResId( LB_COPY_AREA ) ),
         aEdCopyArea     ( this, this, ScResId( ED_COPY_AREA ) ),
-        aRbCopyArea     ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, this ),
+        aRbCopyArea     ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, NULL, this ),
         aBtnDestPers    ( this, ScResId( BTN_DEST_PERS ) ),
         aFtDbAreaLabel  ( this, ScResId( FT_DBAREA_LABEL ) ),
         aFtDbArea       ( this, ScResId( FT_DBAREA ) ),
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 48cf1ab..23f6a60 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -112,11 +112,6 @@ void            ScTPValidationValue::RefInputStartPreHdl( formula::RefEdit* pEdi
         Window *pNewParent = pValidationDlg->get_refinput_shrink_parent();
         if( pEdit == m_pRefEdit )
         {
-            if( Window *pPreWnd = pEdit==&maEdMax?&maFtMax:(pEdit==&maEdMin?&maFtMin:NULL) )
-            {
-                m_pRefEdit->SetLabelWidgetForShrinkMode(pPreWnd);
-            }
-
             maRefEditPos = m_pRefEdit->GetPosPixel();
             maRefEditSize = m_pRefEdit->GetSizePixel();
             m_pRefEdit->SetParent(pNewParent);
@@ -485,6 +480,7 @@ ScValidationDlg * ScTPValidationValue::GetValidationDlg()
 void ScTPValidationValue::SetupRefDlg()
 {
     if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
+    {
         if( pValidationDlg->SetupRefDlg() )
         {
             pValidationDlg->SetHandler( this );
@@ -493,19 +489,34 @@ void ScTPValidationValue::SetupRefDlg()
             pValidationDlg->SetRefInputStartPreHdl( (ScRefHandlerHelper::PINPUTSTARTDLTYPE)( &ScTPValidationValue::RefInputStartPreHdl ) );
             pValidationDlg->SetRefInputDonePostHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::RefInputDonePostHdl ) );
 
-            if ( maEdMax.IsVisible() ) { m_pRefEdit = &maEdMax; }
-            else if ( maEdMin.IsVisible() ) {  m_pRefEdit = &maEdMin; }
+            Window *pLabel = NULL;
 
-            if( m_pRefEdit && !m_pRefEdit->HasFocus() ) m_pRefEdit->GrabFocus();
+            if ( maEdMax.IsVisible() )
+            {
+                m_pRefEdit = &maEdMax;
+                pLabel = &maFtMax;
+            }
+            else if ( maEdMin.IsVisible() )
+            {
+                m_pRefEdit = &maEdMin;
+                pLabel = &maFtMin;
+            }
 
-            if( m_pRefEdit ) m_pRefEdit->SetRefDialog( pValidationDlg );
-            m_btnRef.SetReferences( pValidationDlg, m_pRefEdit );
+            if( m_pRefEdit && !m_pRefEdit->HasFocus() )
+                m_pRefEdit->GrabFocus();
+
+            if( m_pRefEdit )
+                m_pRefEdit->SetRefDialog( pValidationDlg );
+
+            m_btnRef.SetReferences( pValidationDlg, m_pRefEdit, pLabel );
         }
+    }
 }
 
 void ScTPValidationValue::RemoveRefDlg()
 {
     if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
+    {
         if( pValidationDlg->RemoveRefDlg() )
         {
             pValidationDlg->SetHandler( NULL );
@@ -514,15 +525,17 @@ void ScTPValidationValue::RemoveRefDlg()
             pValidationDlg->SetRefInputStartPreHdl( NULL );
             pValidationDlg->SetRefInputDonePostHdl( NULL );
 
-            if( m_pRefEdit ) m_pRefEdit->SetRefDialog( NULL );
+            if( m_pRefEdit )
+                m_pRefEdit->SetRefDialog( NULL );
             m_pRefEdit = NULL;
 
-            m_btnRef.SetReferences( NULL, NULL );
+            m_btnRef.SetReferences( NULL, NULL, NULL );
 
 #if ! defined( WNT ) && !defined( _MSC_VER )
             TidyListBoxes();
 #endif
         }
+    }
 }
 
 void ScTPValidationValue::TidyListBoxes()
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 353f715..6527bb4 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -227,7 +227,11 @@ private:
     {
         void Click();
     public:
-        ScRefButtonEx( Window* pParent, const ResId& rResId, formula::RefEdit* pEdit = NULL, ScRefHandler *pRefHdlr = NULL ): ::formula::RefButton( pParent, rResId, pEdit, pRefHdlr ){}
+        ScRefButtonEx( Window* pParent, const ResId& rResId, formula::RefEdit* pEdit = NULL,
+            Window* pShrinkLabel = NULL, ScRefHandler *pRefHdlr = NULL )
+            : ::formula::RefButton( pParent, rResId, pEdit, pShrinkLabel, pRefHdlr )
+        {
+        }
     }m_btnRef;
     friend class ScRefButtonEx;
     void            SetReferenceHdl( const ScRange& , ScDocument* );
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 8098336..e1b60ba 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -479,32 +479,23 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
                 pRefBtn->SetParent(m_pWindow);
         }
 
-        OUString sLabel;
-        if (Window *pLabel = pRefEdit->GetLabelWidgetForShrinkMode())
-        {
-            sLabel = pLabel->GetText();
-        }
-        else
+        // Fenstertitel anpassen
+        sOldDialogText = m_pWindow->GetText();
+        if (pRefBtn)
         {
-            //find last widget before the edit widget to use as title bar contents
-            for (Window* pChild = firstLogicalChildOfParent(m_pWindow); pChild; pChild = nextLogicalChildOfParent(m_pWindow, pChild))
+            if (Window *pLabel = pRefBtn->GetLabelWidgetForShrinkMode())
             {
-                Window *pWin = pChild->GetWindow(WINDOW_CLIENT);
-                if (pWin == (Window*)pRefEdit || pWin == (Window*)pRefBtn)
-                    break;
-                if (pWin->GetType() == WINDOW_EDIT || pWin->GetType() == WINDOW_FIXEDTEXT)
-                    sLabel = pWin->GetText();
+                OUString sLabel = pLabel->GetText();
+                if (!sLabel.isEmpty())
+                {
+                    String sNewDialogText = sOldDialogText;
+                    sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
+                    sNewDialogText += sLabel;
+                    m_pWindow->SetText( MnemonicGenerator::EraseAllMnemonicChars( sNewDialogText ) );
+                }
             }
         }
 
-        sOldDialogText = m_pWindow->GetText();
-        String sNewDialogText = sOldDialogText;
-        if (!sLabel.isEmpty())
-        {
-            sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
-            sNewDialogText += sLabel;
-        }
-
         Dialog* pResizeDialog = NULL;
 
         if (!mbOldDlgLayoutEnabled)
@@ -583,9 +574,6 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
         if( pRefBtn )
             pRefBtn->SetEndImage();
 
-        // Fenstertitel anpassen
-        m_pWindow->SetText( MnemonicGenerator::EraseAllMnemonicChars( sNewDialogText ) );
-
         if (!pAccel.get())
         {
             pAccel.reset( new Accelerator );
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index de5545e..cb54ef3d 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -74,12 +74,12 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB,
         aLbRange        ( this, ScResId( LB_RANGE ) ),
 
         aEdAssign       ( this, this, ScResId( ED_AREA ) ),
-        aRbAssign       ( this, ScResId( RB_AREA ), &aEdAssign, this ),
+        aRbAssign       ( this, ScResId( RB_AREA ), &aEdAssign, &aFlAssign, this ),
         aBtnColHead     ( this, ScResId( BTN_COLHEAD ) ),
         aBtnRowHead     ( this, ScResId( BTN_ROWHEAD ) ),
         aFtAssign2      ( this, ScResId( FT_DATA_LABEL ) ),
         aEdAssign2      ( this, this, ScResId( ED_DATA ) ),
-        aRbAssign2      ( this, ScResId( RB_DATA ), &aEdAssign2, this ),
+        aRbAssign2      ( this, ScResId( RB_DATA ), &aEdAssign2, &aFtAssign2, this ),
 
         aBtnOk          ( this, ScResId( BTN_OK ) ),
         aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index 2e7ae0f..6b0a227 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -68,7 +68,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Wind
         aCancelButton   ( this, ScResId( BTN_CANCEL ) ),
         aHelpButton     ( this, ScResId( BTN_HELP ) ),
         aEdAssign       ( this, this, ScResId( ED_ASSIGN ) ),
-        aRbAssign       ( this, ScResId( RB_ASSIGN ), &aEdAssign, this ),
+        aRbAssign       ( this, ScResId( RB_ASSIGN ), &aEdAssign, NULL, this ),
         //
         pViewData       ( ptrViewData ),
         pDoc            ( ptrViewData->GetDocument() ),
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index dbe3526..d5d9739 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -172,43 +172,43 @@ ScOptSolverDlg::ScOptSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pP
         //
         maFtObjectiveCell   ( this, ScResId( FT_OBJECTIVECELL ) ),
         maEdObjectiveCell   ( this, this, ScResId( ED_OBJECTIVECELL ) ),
-        maRBObjectiveCell   ( this, ScResId( IB_OBJECTIVECELL ), &maEdObjectiveCell, this ),
+        maRBObjectiveCell   ( this, ScResId( IB_OBJECTIVECELL ), &maEdObjectiveCell, &maFtObjectiveCell, this ),
         maFtDirection       ( this, ScResId( FT_DIRECTION ) ),
         maRbMax             ( this, ScResId( RB_MAX ) ),
         maRbMin             ( this, ScResId( RB_MIN ) ),
         maRbValue           ( this, ScResId( RB_VALUE ) ),
         maEdTargetValue     ( this, this, ScResId( ED_TARGET ) ),
-        maRBTargetValue     ( this, ScResId( IB_TARGET ), &maEdTargetValue, this ),
+        maRBTargetValue     ( this, ScResId( IB_TARGET ), &maEdTargetValue, NULL, this ),
         maFtVariableCells   ( this, ScResId( FT_VARIABLECELLS ) ),
         maEdVariableCells   ( this, this, ScResId( ED_VARIABLECELLS ) ),
-        maRBVariableCells   ( this, ScResId( IB_VARIABLECELLS ), &maEdVariableCells, this),
+        maRBVariableCells   ( this, ScResId( IB_VARIABLECELLS ), &maEdVariableCells, &maFtVariableCells, this),
         maFlConditions      ( this, ScResId( FL_CONDITIONS ) ),
         maFtCellRef         ( this, ScResId( FT_CELLREF ) ),
         maEdLeft1           ( this, ScResId( ED_LEFT1 ) ),
-        maRBLeft1           ( this, ScResId( IB_LEFT1 ), &maEdLeft1, this ),
+        maRBLeft1           ( this, ScResId( IB_LEFT1 ), &maEdLeft1, NULL, this ),
         maFtOperator        ( this, ScResId( FT_OPERATOR ) ),
         maLbOp1             ( this, ScResId( LB_OP1 ) ),
         maFtConstraint      ( this, ScResId( FT_CONSTRAINT ) ),
         maEdRight1          ( this, ScResId( ED_RIGHT1 ) ),
-        maRBRight1          ( this, ScResId( IB_RIGHT1 ), &maEdRight1, this ),
+        maRBRight1          ( this, ScResId( IB_RIGHT1 ), &maEdRight1, NULL, this ),
         maBtnDel1           ( this, ScResId( IB_DELETE1 ) ),
         maEdLeft2           ( this, ScResId( ED_LEFT2 ) ),
-        maRBLeft2           ( this, ScResId( IB_LEFT2 ), &maEdLeft2, this ),
+        maRBLeft2           ( this, ScResId( IB_LEFT2 ), &maEdLeft2, NULL, this ),
         maLbOp2             ( this, ScResId( LB_OP2 ) ),
         maEdRight2          ( this, ScResId( ED_RIGHT2 ) ),
-        maRBRight2          ( this, ScResId( IB_RIGHT2 ), &maEdRight2, this ),
+        maRBRight2          ( this, ScResId( IB_RIGHT2 ), &maEdRight2, NULL, this ),
         maBtnDel2           ( this, ScResId( IB_DELETE2 ) ),
         maEdLeft3           ( this, ScResId( ED_LEFT3 ) ),
-        maRBLeft3           ( this, ScResId( IB_LEFT3 ), &maEdLeft3, this ),
+        maRBLeft3           ( this, ScResId( IB_LEFT3 ), &maEdLeft3, NULL, this ),
         maLbOp3             ( this, ScResId( LB_OP3 ) ),
         maEdRight3          ( this, ScResId( ED_RIGHT3 ) ),
-        maRBRight3          ( this, ScResId( IB_RIGHT3 ), &maEdRight3, this ),
+        maRBRight3          ( this, ScResId( IB_RIGHT3 ), &maEdRight3, NULL, this ),
         maBtnDel3           ( this, ScResId( IB_DELETE3 ) ),
         maEdLeft4           ( this, ScResId( ED_LEFT4 ) ),
-        maRBLeft4           ( this, ScResId( IB_LEFT4 ), &maEdLeft4, this ),
+        maRBLeft4           ( this, ScResId( IB_LEFT4 ), &maEdLeft4, NULL, this ),
         maLbOp4             ( this, ScResId( LB_OP4 ) ),
         maEdRight4          ( this, ScResId( ED_RIGHT4 ) ),
-        maRBRight4          ( this, ScResId( IB_RIGHT4 ), &maEdRight4, this ),
+        maRBRight4          ( this, ScResId( IB_RIGHT4 ), &maEdRight4, NULL, this ),
         maBtnDel4           ( this, ScResId( IB_DELETE4 ) ),
         maScrollBar         ( this, ScResId( SB_SCROLL ) ),
         maFlButtons         ( this, ScResId( FL_BUTTONS ) ),
diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx
index 8a96e0e..60bc8ea 100644
--- a/sc/source/ui/miscdlgs/simpref.cxx
+++ b/sc/source/ui/miscdlgs/simpref.cxx
@@ -54,7 +54,7 @@ ScSimpleRefDlg::ScSimpleRefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pP
         //
         aFtAssign       ( this, ScResId( FT_ASSIGN ) ),
         aEdAssign       ( this, this, ScResId( ED_ASSIGN ) ),
-        aRbAssign       ( this, ScResId( RB_ASSIGN ), &aEdAssign, this ),
+        aRbAssign       ( this, ScResId( RB_ASSIGN ), &aEdAssign, &aFtAssign, this ),
 
         aBtnOk          ( this, ScResId( BTN_OK ) ),
         aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx
index 248a054..1c210a3 100644
--- a/sc/source/ui/miscdlgs/solvrdlg.cxx
+++ b/sc/source/ui/miscdlgs/solvrdlg.cxx
@@ -50,12 +50,12 @@ ScSolverDlg::ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
         aFlVariables        ( this, ScResId( FL_VARIABLES ) ),
         aFtFormulaCell      ( this, ScResId( FT_FORMULACELL ) ),
         aEdFormulaCell      ( this, this, ScResId( ED_FORMULACELL ) ),
-        aRBFormulaCell      ( this, ScResId( RB_FORMULACELL ), &aEdFormulaCell, this ),
+        aRBFormulaCell      ( this, ScResId( RB_FORMULACELL ), &aEdFormulaCell, &aFtFormulaCell, this ),
         aFtTargetVal        ( this, ScResId( FT_TARGETVAL ) ),
         aEdTargetVal        ( this, ScResId( ED_TARGETVAL ) ),
         aFtVariableCell     ( this, ScResId( FT_VARCELL ) ),
         aEdVariableCell     ( this, this, ScResId( ED_VARCELL ) ),
-        aRBVariableCell     ( this, ScResId( RB_VARCELL ), &aEdVariableCell, this ),
+        aRBVariableCell     ( this, ScResId( RB_VARCELL ), &aEdVariableCell, &aFtVariableCell, this ),
         aBtnOk              ( this, ScResId( BTN_OK ) ),
         aBtnCancel          ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp            ( this, ScResId( BTN_HELP ) ),
diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx
index b5d051e..cce3d59 100644
--- a/sc/source/ui/miscdlgs/tabopdlg.cxx
+++ b/sc/source/ui/miscdlgs/tabopdlg.cxx
@@ -46,13 +46,13 @@ ScTabOpDlg::ScTabOpDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
         aFlVariables        ( this, ScResId( FL_VARIABLES ) ),
         aFtFormulaRange     ( this, ScResId( FT_FORMULARANGE ) ),
         aEdFormulaRange     ( this, this, ScResId( ED_FORMULARANGE ) ),
-        aRBFormulaRange     ( this, ScResId( RB_FORMULARANGE ), &aEdFormulaRange, this ),
+        aRBFormulaRange     ( this, ScResId( RB_FORMULARANGE ), &aEdFormulaRange, &aFtFormulaRange, this ),
         aFtRowCell          ( this, ScResId( FT_ROWCELL ) ),
         aEdRowCell          ( this, this, ScResId( ED_ROWCELL ) ),
-        aRBRowCell          ( this, ScResId( RB_ROWCELL ), &aEdRowCell, this ),
+        aRBRowCell          ( this, ScResId( RB_ROWCELL ), &aEdRowCell, &aFtRowCell, this ),
         aFtColCell          ( this, ScResId( FT_COLCELL ) ),
         aEdColCell          ( this, this, ScResId( ED_COLCELL ) ),
-        aRBColCell          ( this, ScResId( RB_COLCELL ), &aEdColCell, this ),
+        aRBColCell          ( this, ScResId( RB_COLCELL ), &aEdColCell, &aFtColCell, this ),
         aBtnOk              ( this, ScResId( BTN_OK ) ),
         aBtnCancel          ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp            ( this, ScResId( BTN_HELP ) ),
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 2743c3d..67758d5 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -68,8 +68,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
     get(m_pEdName, "edit");
     get(m_pEdRange, "range");
     get(m_pRbRange, "refbutton");
-    m_pRbRange->SetReferences(this, m_pEdRange);
-    m_pEdRange->SetLabelWidgetForShrinkMode(m_pEdName);
+    m_pRbRange->SetReferences(this, m_pEdRange, m_pEdName);
     get(m_pLbScope, "scope");
     get(m_pBtnRowHeader, "rowheader");
     get(m_pBtnColHeader, "colheader");
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index ec102ae..5ce90f0 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -56,7 +56,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
     //
     maEdName         ( this, ScResId( ED_NAME2 ) ),
     maEdAssign       ( this, this, ScResId( ED_ASSIGN ) ),
-    aRbAssign       ( this, ScResId( RB_ASSIGN ), &maEdAssign, this ),
+    aRbAssign       ( this, ScResId( RB_ASSIGN ), &maEdAssign, &maEdName, this ),
     maLbScope( this, ScResId(LB_SCOPE) ),
     //
     maBtnMore        ( this, ScResId( BTN_MORE ) ),
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index cc1b78b..85e8c44 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -112,17 +112,17 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, Window*
         aFlPrintArea    ( this, ScResId( FL_PRINTAREA ) ),
         aLbPrintArea    ( this, ScResId( LB_PRINTAREA ) ),
         aEdPrintArea    ( this, this, ScResId( ED_PRINTAREA ) ),
-        aRbPrintArea    ( this, ScResId( RB_PRINTAREA ), &aEdPrintArea, this ),
+        aRbPrintArea    ( this, ScResId( RB_PRINTAREA ), &aEdPrintArea, &aFlPrintArea, this ),
         //
         aFlRepeatRow    ( this, ScResId( FL_REPEATROW ) ),
         aLbRepeatRow    ( this, ScResId( LB_REPEATROW ) ),
         aEdRepeatRow    ( this, this, ScResId( ED_REPEATROW ) ),
-        aRbRepeatRow    ( this, ScResId( RB_REPEATROW ), &aEdRepeatRow, this ),
+        aRbRepeatRow    ( this, ScResId( RB_REPEATROW ), &aEdRepeatRow, &aFlRepeatRow, this ),
         //
         aFlRepeatCol    ( this, ScResId( FL_REPEATCOL ) ),
         aLbRepeatCol    ( this, ScResId( LB_REPEATCOL ) ),
         aEdRepeatCol    ( this, this, ScResId( ED_REPEATCOL ) ),
-        aRbRepeatCol    ( this, ScResId( RB_REPEATCOL ), &aEdRepeatCol, this ),
+        aRbRepeatCol    ( this, ScResId( RB_REPEATCOL ), &aEdRepeatCol, &aFlRepeatCol, this ),
         //
         aBtnOk          ( this, ScResId( BTN_OK ) ),
         aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 838b7d1..64d6173 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -80,7 +80,7 @@ ScXMLSourceDlg::ScXMLSourceDlg(
     maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
     maLbTree(this, ScResId(LB_SOURCE_TREE)),
     maRefEdit(this, this, ScResId(ED_MAPPED_CELL)),
-    maRefBtn(this, ScResId(BTN_MAPPED_CELL), &maRefEdit, this),
+    maRefBtn(this, ScResId(BTN_MAPPED_CELL), &maRefEdit, NULL, this),
     maBtnOk(this, ScResId(BTN_OK)),
     maBtnCancel(this, ScResId(BTN_CANCEL)),
     maImgFileOpen(ScResId(IMG_FILE_OPEN)),
commit 4e0c6a0ac78d3c68922e032eec7f9c05cc39023a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 8 09:23:53 2013 +0000

    Resolves: fdo#58630 crash with refEdit button in SfxTabDialog
    
    Change-Id: I11d6a0f1d4852aab1fe08671fd9c2a0dac0825a7

diff --git a/formula/inc/formula/funcutl.hxx b/formula/inc/formula/funcutl.hxx
index 1dc10e8..b9e3267 100644
--- a/formula/inc/formula/funcutl.hxx
+++ b/formula/inc/formula/funcutl.hxx
@@ -63,6 +63,8 @@ public:
 
     void                SetRefDialog( IControlReferenceHandler* pDlg );
     inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
+    Window*             GetLabelWidgetForShrinkMode() { return m_pLabelWidget; }
+    void                SetLabelWidgetForShrinkMode(Window *pLabel) { m_pLabelWidget = pLabel; }
 };
 
 
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 4b047d3..64830d5 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -849,7 +849,8 @@ void EditBox::UpdateOldSel()
 
 RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ) :
     Edit( _pParent, rResId ),
-    pAnyRefDlg( pParent )
+    pAnyRefDlg( pParent ),
+    m_pLabelWidget(NULL)
 {
     aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
     aTimer.SetTimeout( SC_ENABLE_TIME );
@@ -857,7 +858,8 @@ RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResI
 
 RefEdit::RefEdit( Window* _pParent, WinBits nStyle ) :
     Edit( _pParent, nStyle ),
-    pAnyRefDlg( NULL )
+    pAnyRefDlg( NULL ),
+    m_pLabelWidget(NULL)
 {
     aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
     aTimer.SetTimeout( SC_ENABLE_TIME );
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index ecce534..48cf1ab 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -75,6 +75,8 @@ ScValidationDlg::ScValidationDlg( Window*           pParent,
     AddTabPage( TP_VALIDATION_INPUTHELP, ScTPValidationHelp::Create,  0 );
     AddTabPage( TP_VALIDATION_ERROR,     ScTPValidationError::Create, 0 );
     FreeResource();
+    //temp hack until converted to .ui
+    mpHBox = new VclHBox(get_content_area());
 }
 
 void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pDoc )
@@ -107,43 +109,43 @@ void            ScTPValidationValue::RefInputStartPreHdl( formula::RefEdit* pEdi
 {
     if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
     {
+        Window *pNewParent = pValidationDlg->get_refinput_shrink_parent();
         if( pEdit == m_pRefEdit )
         {
             if( Window *pPreWnd = pEdit==&maEdMax?&maFtMax:(pEdit==&maEdMin?&maFtMin:NULL) )
             {
-                pPreWnd->SetParent( pValidationDlg );
-                pPreWnd->Hide();
+                m_pRefEdit->SetLabelWidgetForShrinkMode(pPreWnd);
             }
 
-            m_pRefEdit->SetParent( pValidationDlg );
+            maRefEditPos = m_pRefEdit->GetPosPixel();
+            maRefEditSize = m_pRefEdit->GetSizePixel();
+            m_pRefEdit->SetParent(pNewParent);
         }
 
-        if( pButton == &m_btnRef )m_btnRef.SetParent( pValidationDlg );
+        if( pButton == &m_btnRef )
+        {
+            maBtnRefPos = m_btnRef.GetPosPixel();
+            maBtnRefSize = m_btnRef.GetSizePixel();
+            m_btnRef.SetParent(pNewParent);
+        }
+        pNewParent->Show();
     }
 }
 
-void            ScTPValidationValue::RefInputDonePreHdl()
+void            ScTPValidationValue::RefInputDonePostHdl()
 {
-
     if( m_pRefEdit && m_pRefEdit->GetParent()!= this )
     {
-        if( Window *pPreWnd = m_pRefEdit==&maEdMax?&maFtMax:(m_pRefEdit==&maEdMin?&maFtMin:NULL) )
-        {
-            pPreWnd->SetParent( this );
-            pPreWnd->Show();
-        }
-
         m_pRefEdit->SetParent( this );
+        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
+        m_btnRef.SetPosSizePixel( maBtnRefPos, maBtnRefSize );
     }
 
     if( m_btnRef.GetParent()!=this ) m_btnRef.SetParent( this );
-}
-
-void            ScTPValidationValue::RefInputDonePostHdl()
-{
-
+    if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
+        pValidationDlg->get_refinput_shrink_parent()->Hide();
 
     if( m_pRefEdit && !m_pRefEdit->HasFocus() )
         m_pRefEdit->GrabFocus();
@@ -164,6 +166,7 @@ ScValidationDlg::~ScValidationDlg()
 {
     if( m_bOwnRefHdlr )
         RemoveRefDlg( false );
+    delete mpHBox;
 }
 
 
@@ -488,7 +491,6 @@ void ScTPValidationValue::SetupRefDlg()
             pValidationDlg->SetSetRefHdl( (ScRefHandlerHelper::PFUNCSETREFHDLTYPE)( &ScTPValidationValue::SetReferenceHdl ) );
             pValidationDlg->SetSetActHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::SetActiveHdl ) );
             pValidationDlg->SetRefInputStartPreHdl( (ScRefHandlerHelper::PINPUTSTARTDLTYPE)( &ScTPValidationValue::RefInputStartPreHdl ) );
-            pValidationDlg->SetRefInputDonePreHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::RefInputDonePreHdl ) );
             pValidationDlg->SetRefInputDonePostHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::RefInputDonePostHdl ) );
 
             if ( maEdMax.IsVisible() ) { m_pRefEdit = &maEdMax; }
@@ -510,7 +512,6 @@ void ScTPValidationValue::RemoveRefDlg()
             pValidationDlg->SetSetRefHdl( NULL );
             pValidationDlg->SetSetActHdl( NULL );
             pValidationDlg->SetRefInputStartPreHdl( NULL );
-            pValidationDlg->SetRefInputDonePreHdl( NULL );
             pValidationDlg->SetRefInputDonePostHdl( NULL );
 
             if( m_pRefEdit ) m_pRefEdit->SetRefDialog( NULL );
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 0e847ac..760879a 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -61,8 +61,11 @@ class ScFormulaReferenceHelper
     Size                aOldDialogSize;         // Original size of the dialog window
     Point               aOldEditPos;            // Original position of the input field
     Size                aOldEditSize;           // Original size of the input field
+    long                mnOldEditWidthReq;
     Point               aOldButtonPos;          // Original position of the button
     Window*             mpOldEditParent;        // Original parent of the edit field and the button
+    bool                mbOldDlgLayoutEnabled;  // Original layout state of parent dialog
+    bool                mbOldEditParentLayoutEnabled;  // Original layout state of edit widget parent
 
     bool                bEnableColorRef;
     bool                bHighLightRef;
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 726681e..353f715 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -23,6 +23,7 @@
 #include <sfx2/tabdlg.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/lstbox.hxx>
 #include <svtools/svmedit.hxx>
 
@@ -87,6 +88,7 @@ class ScValidationDlg :public ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false
     bool    m_bOwnRefHdlr:1;
 
     ScTabViewShell *m_pTabVwSh;
+    VclHBox* mpHBox;
     bool    m_bRefInputting:1;
     bool    EnterRefStatus();
     bool    LeaveRefStatus();
@@ -126,6 +128,7 @@ public:
     }
 
     bool IsRefInputting(){  return m_bRefInputting; }
+    Window*             get_refinput_shrink_parent() { return mpHBox; }
 
     virtual void        RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL )
     {
@@ -211,6 +214,11 @@ private:
     String                      maStrList;
     sal_Unicode                 mcFmlaSep;      /// List separator in formulas.
 
+    Point                       maRefEditPos;
+    Point                       maBtnRefPos;
+    Size                        maRefEditSize;
+    Size                        maBtnRefSize;
+
     DECL_LINK(EditSetFocusHdl, void *);
     DECL_LINK( KillFocusHdl, Window *);
     void    OnClick( Button *pBtn );
@@ -225,7 +233,6 @@ private:
     void            SetReferenceHdl( const ScRange& , ScDocument* );
     void            SetActiveHdl();
     void            RefInputStartPreHdl( formula::RefEdit* pEdit, formula::RefButton* pButton );
-    void            RefInputDonePreHdl();
     void            RefInputDonePostHdl();
     ScValidationDlg * GetValidationDlg();
 
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 6af81de..8098336 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -50,7 +50,10 @@ ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindi
  , m_pBindings(_pBindings)
  , pAccel( NULL )
  , nRefTab(0)
+ , mnOldEditWidthReq( -1 )
  , mpOldEditParent( NULL )
+ , mbOldDlgLayoutEnabled( false )
+ , mbOldEditParentLayoutEnabled( false )
  , bHighLightRef( false )
  , bAccInserted( false )
 {
@@ -358,9 +361,8 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced )
             bAccInserted = false;
         }
 
-        bool bLayoutEnabled = isLayoutEnabled(m_pWindow);
         //get rid of all this junk when we can
-        if (!bLayoutEnabled)
+        if (!mbOldDlgLayoutEnabled)
         {
             m_pWindow->SetOutputSizePixel(aOldDialogSize);
 
@@ -370,13 +372,21 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced )
             // Fenster wieder gross
             m_pWindow->SetOutputSizePixel(aOldDialogSize);
 
+            // set button parent
+            if( pRefBtn )
+            {
+                pRefBtn->SetParent(m_pWindow);
+            }
+        }
+
+        if (!mbOldEditParentLayoutEnabled)
+        {
             // pEditCell an alte Position
             pRefEdit->SetPosSizePixel(aOldEditPos, aOldEditSize);
 
             // set button position
             if( pRefBtn )
             {
-                pRefBtn->SetParent(m_pWindow);
                 pRefBtn->SetPosPixel( aOldButtonPos );
             }
         }
@@ -396,11 +406,13 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced )
         }
         m_aHiddenWidgets.clear();
 
-        if (bLayoutEnabled)
+        if (mbOldDlgLayoutEnabled)
         {
+            pRefEdit->set_width_request(mnOldEditWidthReq);
             Dialog* pResizeDialog = pRefEdit->GetParentDialog();
             pResizeDialog->set_border_width(m_nOldBorderWidth);
-            pResizeDialog->get_action_area()->Show();
+            if (Window *pActionArea = pResizeDialog->get_action_area())
+                pActionArea->Show();
             pResizeDialog->setOptimalLayoutSize();
         }
 
@@ -442,44 +454,60 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
         pRefEdit = pEdit;
         pRefBtn  = pButton;
 
-        // Neuen Fenstertitel basteln
-        String sNewDialogText;
-        sOldDialogText = m_pWindow->GetText();
-        sNewDialogText  = sOldDialogText;
-        sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
+        mbOldDlgLayoutEnabled = isLayoutEnabled(m_pWindow);
+        aOldEditSize = pRefEdit->GetSizePixel();
+        mnOldEditWidthReq = pRefEdit->get_width_request();
+        mpOldEditParent = pRefEdit->GetParent();
+        mbOldEditParentLayoutEnabled = isContainerWindow(mpOldEditParent);
 
-        bool bLayoutEnabled = isLayoutEnabled(m_pWindow);
-        //get rid of all the !bLayoutEnabled junk when we can
-        //after the last user of this is widget-layout-ified
-        if (!bLayoutEnabled)
+        //get rid of all the !mbOldDlgLayoutEnabled and
+        //mbOldEditParentLayoutEnabled junk when we can after the last user of
+        //this is widget-layout-ified
+        if (!mbOldEditParentLayoutEnabled)
         {
-            mpOldEditParent = pRefEdit->GetParent();
-
             // Alte Daten merken
             aOldDialogSize = m_pWindow->GetOutputSizePixel();
             aOldEditPos = pRefEdit->GetPosPixel();
-            aOldEditSize = pRefEdit->GetSizePixel();
             if (pRefBtn)
                 aOldButtonPos = pRefBtn->GetPosPixel();
+        }
 
+        if (!mbOldDlgLayoutEnabled)
+        {
             pRefEdit->SetParent(m_pWindow);
             if(pRefBtn)
                 pRefBtn->SetParent(m_pWindow);
         }
 
-        //collect up edit window contents to use for the title bar
-        for (Window* pChild = firstLogicalChildOfParent(m_pWindow); pChild; pChild = nextLogicalChildOfParent(m_pWindow, pChild))
+        OUString sLabel;
+        if (Window *pLabel = pRefEdit->GetLabelWidgetForShrinkMode())
+        {
+            sLabel = pLabel->GetText();
+        }
+        else
+        {
+            //find last widget before the edit widget to use as title bar contents
+            for (Window* pChild = firstLogicalChildOfParent(m_pWindow); pChild; pChild = nextLogicalChildOfParent(m_pWindow, pChild))
+            {
+                Window *pWin = pChild->GetWindow(WINDOW_CLIENT);
+                if (pWin == (Window*)pRefEdit || pWin == (Window*)pRefBtn)
+                    break;
+                if (pWin->GetType() == WINDOW_EDIT || pWin->GetType() == WINDOW_FIXEDTEXT)
+                    sLabel = pWin->GetText();
+            }
+        }
+
+        sOldDialogText = m_pWindow->GetText();
+        String sNewDialogText = sOldDialogText;
+        if (!sLabel.isEmpty())
         {
-            Window *pWin = pChild->GetWindow(WINDOW_CLIENT);
-            if (pWin == (Window*)pRefEdit || pWin == (Window*)pRefBtn)
-                continue; // do nothing
-            if (pChild->IsVisible() && pWin->GetType() == WINDOW_EDIT)
-                sNewDialogText += pWin->GetText();
+            sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
+            sNewDialogText += sLabel;
         }
 
         Dialog* pResizeDialog = NULL;
 
-        if (!bLayoutEnabled)
+        if (!mbOldDlgLayoutEnabled)
         {
             for (Window* pChild = m_pWindow->GetWindow(WINDOW_FIRSTCHILD); pChild;
                 pChild = pChild->GetWindow(WINDOW_NEXT))
@@ -522,7 +550,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
             hideUnless(pContentArea, m_aVisibleWidgets, m_aHiddenWidgets);
         }
 
-        if (!bLayoutEnabled)
+        if (!mbOldDlgLayoutEnabled)
         {
             // Edit-Feld verschieben und anpassen
             Size aNewDlgSize(aOldDialogSize.Width(), aOldEditSize.Height());
@@ -568,11 +596,13 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::
         Application::InsertAccel( pAccel.get() );
         bAccInserted = true;
 
-        if (bLayoutEnabled)
+        if (mbOldDlgLayoutEnabled)
         {
+            pRefEdit->set_width_request(aOldEditSize.Width());
             m_nOldBorderWidth = pResizeDialog->get_border_width();
             pResizeDialog->set_border_width(0);
-            pResizeDialog->get_action_area()->Hide();
+            if (Window *pActionArea = pResizeDialog->get_action_area())
+                pActionArea->Hide();
             pResizeDialog->setOptimalLayoutSize();
         }
     }
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index bb61ecc..2743c3d 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -69,6 +69,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
     get(m_pEdRange, "range");
     get(m_pRbRange, "refbutton");
     m_pRbRange->SetReferences(this, m_pEdRange);
+    m_pEdRange->SetLabelWidgetForShrinkMode(m_pEdName);
     get(m_pLbScope, "scope");
     get(m_pBtnRowHeader, "rowheader");
     get(m_pBtnColHeader, "colheader");
commit 6df8417b98a74f58638b5fce7459c64f18ddedb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 7 21:18:52 2013 +0000

    set action and content area via their internal-child ids
    
    rather than based on their names, which changes if
    there are more than one dialog in a .ui
    
    set them explicitly in the manual-build-dialog
    case of the SfxTabDialogs
    
    Change-Id: I293c77df05d9e11e3f1cf3b358a9dd27fe668b0f

diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 4ec5a76..adb3e68 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -584,6 +584,7 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText,
     {
         m_pBox = new VclVBox(this, false, 7);
         m_pBox->set_expand(true);
+        set_content_area(m_pBox);
     }
 
     m_pTabCtrl = m_pUIBuilder ? m_pUIBuilder->get<TabControl>("tabcontrol") : NULL;
@@ -597,7 +598,10 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText,
     m_pActionArea = get_action_area();
     m_bOwnsActionArea = m_pActionArea == NULL;
     if (m_bOwnsActionArea)
+    {
         m_pActionArea = new VclHButtonBox(m_pBox);
+        set_action_area(m_pActionArea);
+    }
 
     m_pOKBtn = m_pUIBuilder ? m_pUIBuilder->get<OKButton>("ok") : NULL;
     m_bOwnsOKBtn = m_pOKBtn == NULL;
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 1f14ae1..4c7149a 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -54,6 +54,8 @@ private:
     bool            mbIsDefferedInit;
     bool            mbIsCalculatingInitialLayoutSize;
     Timer           maLayoutTimer;
+    VclButtonBox*   mpActionArea;
+    VclBox*         mpContentArea;
 
     SAL_DLLPRIVATE void    ImplInitDialogData();
     SAL_DLLPRIVATE void    ImplInitSettings();
@@ -83,6 +85,11 @@ protected:
                     Dialog( Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, WindowType nType );
     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
 
+protected:
+    friend class VclBuilder;
+    void set_action_area(VclButtonBox *pBox);
+    void set_content_area(VclBox *pBox);
+
 public:
                     Dialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
                     Dialog( Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription );
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 9355c9e..d466f42 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1448,11 +1448,10 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con
 void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
 {
     Window *pCurrentChild = NULL;
-    bool bIsInternalChild = false;
 
     xmlreader::Span name;
     int nsId;
-    OString sType;
+    OString sType, sInternalChild;
 
     while (reader.nextAttribute(&nsId, &name))
     {
@@ -1463,7 +1462,8 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
         }
         else if (name.equals("internal-child"))
         {
-            bIsInternalChild = true;
+            name = reader.getAttributeValue(false);
+            sInternalChild = OString(name.begin, name.length);
         }
     }
 
@@ -1491,7 +1491,7 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
                 {
                     //Internal-children default in glade to not having their visible bits set
                     //even though they are visible (generally anyway)
-                    if (bIsInternalChild)
+                    if (!sInternalChild.isEmpty())
                         pCurrentChild->Show();
 
                     //Select the first page if its a notebook
@@ -1512,6 +1512,16 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
                             if (VclFrame *pFrameParent = dynamic_cast<VclFrame*>(pParent))
                                 pFrameParent->designate_label(pCurrentChild);
                         }
+                        if (sInternalChild.equals("vbox"))
+                        {
+                            if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pParent))
+                                pBoxParent->set_content_area(static_cast<VclBox*>(pCurrentChild));
+                        }
+                        else if (sInternalChild.equals("action_area"))
+                        {
+                            if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pParent))
+                                pBoxParent->set_action_area(static_cast<VclButtonBox*>(pCurrentChild));
+                        }
 
                         //To-Do make reorder a virtual in Window, move this foo
                         //there and see above
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a756b27..30e7571 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -354,6 +354,8 @@ void Dialog::ImplInitDialogData()
     mbOldSaveBack           = sal_False;
     mbInClose               = sal_False;
     mbModalMode             = sal_False;
+    mpContentArea           = NULL;
+    mpActionArea            = NULL;
     mbIsCalculatingInitialLayoutSize = false;
     mnMousePositioned       = 0;
     mpDialogImpl            = new DialogImpl;
@@ -559,12 +561,22 @@ WinBits Dialog::init(Window *pParent, const ResId& rResId)
 
 VclButtonBox* Dialog::get_action_area()
 {
-    return m_pUIBuilder ? m_pUIBuilder->get<VclButtonBox>("dialog-action_area1") : NULL;
+    return mpActionArea;
+}
+
+void Dialog::set_action_area(VclButtonBox* pActionArea)
+{
+    mpActionArea = pActionArea;
 }
 
 VclBox* Dialog::get_content_area()
 {
-    return m_pUIBuilder ? m_pUIBuilder->get<VclBox>("dialog-vbox1") : NULL;
+    return mpContentArea;
+}
+
+void Dialog::set_content_area(VclBox* pContentArea)
+{
+    mpContentArea = pContentArea;
 }
 
 // -----------------------------------------------------------------------
commit 3e3dc223e0337f974123ba687cddb7e2e6df2b28
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 8 09:29:29 2013 +0000

    update sizegroup
    
    Change-Id: I4b89859c6898071209bd3864a32487f5bf8e728c

diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui
index a3fe196..770866f 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -958,5 +958,16 @@ Do you still want to apply these settings?</property>
   </object>
   <object class="GtkSizeGroup" id="sizegroup6">
     <property name="ignore_hidden">True</property>
+    <widgets>
+      <widget name="labelFormat"/>
+      <widget name="labelWidth"/>
+      <widget name="labelHeight"/>
+      <widget name="labelOrientation"/>
+      <widget name="labelTextFlow"/>
+      <widget name="labelTopMargin"/>
+      <widget name="labelBottomMargin"/>
+      <widget name="box2"/>
+      <widget name="box3"/>
+    </widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list