From 02179ab7e771fae9d012724b8ff1397f4265cfc1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 16 Apr 2013 20:41:34 +0100 Subject: stash the label widget for shrink mode in the edit, not the button because we always have we a refedit, but sometimes not a refbutton, so set the label widget to use for the dialog shrink mode on the refedit instead of the refbutton. This way we get the shrunken dialog title bar updated with the label contents regardless of using the shrink button or clicking in the editbox and dragging the mouse around the spreadsheet triggering the shrink mode Change-Id: Ifdff01a30d5c65aa964d4bf544017a2927757d67 --- formula/inc/formula/funcutl.hxx | 17 +++++++++-------- formula/source/ui/dlg/formula.cxx | 4 ++-- formula/source/ui/dlg/funcutl.cxx | 28 ++++++++++++++-------------- formula/source/ui/dlg/parawin.cxx | 4 ++-- 4 files changed, 27 insertions(+), 26 deletions(-) (limited to 'formula') diff --git a/formula/inc/formula/funcutl.hxx b/formula/inc/formula/funcutl.hxx index 76a2287ed45c..6676117cdf20 100644 --- a/formula/inc/formula/funcutl.hxx +++ b/formula/inc/formula/funcutl.hxx @@ -34,6 +34,7 @@ class FORMULA_DLLPUBLIC RefEdit : public Edit private: Timer aTimer; IControlReferenceHandler* pAnyRefDlg; // parent dialog + Window* pLabelWidget; DECL_LINK( UpdateHdl, void* ); @@ -43,8 +44,10 @@ protected: virtual void LoseFocus(); public: - RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ); - RefEdit( Window* _pParent, WinBits nStyle = WB_BORDER ); + RefEdit( Window* _pParent,IControlReferenceHandler* pParent, + Window* pShrinkModeLabel, const ResId& rResId ); + RefEdit( Window* _pParent, Window* pShrinkModeLabel, + WinBits nStyle = WB_BORDER ); virtual ~RefEdit(); void SetRefString( const XubString& rStr ); @@ -61,8 +64,9 @@ public: void StartUpdateData(); - void SetRefDialog( IControlReferenceHandler* pDlg ); + void SetReferences( IControlReferenceHandler* pDlg, Window *pLabelWidget ); IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; } + Window* GetLabelWidgetForShrinkMode() { return pLabelWidget; } }; @@ -77,7 +81,6 @@ private: OUString aExpandQuickHelp; IControlReferenceHandler* pAnyRefDlg; // parent dialog RefEdit* pRefEdit; // zugeordnetes Edit-Control - Window* pLabelWidget; protected: virtual void Click(); @@ -89,16 +92,14 @@ public: RefButton(Window* _pParent, const ResId& rResId); RefButton(Window* _pParent, WinBits nStyle = 0); RefButton(Window* _pParent, const ResId& rResId, - RefEdit* pEdit, Window* pShrinkModeLabel, - IControlReferenceHandler* pDlg); + RefEdit* pEdit, IControlReferenceHandler* pDlg); void SetReferences( IControlReferenceHandler* pDlg, - RefEdit* pEdit, Window* pShrinkModeLabel ); + RefEdit* pEdit ); void SetStartImage(); void SetEndImage(); 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 df893f624b8c..6f98e56b31aa 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -265,8 +265,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent aBtnBackward ( pParent, ModuleRes( BTN_BACKWARD ) ), aBtnForward ( pParent, ModuleRes( BTN_FORWARD ) ), aBtnEnd ( pParent, ModuleRes( BTN_END ) ), - aEdRef ( pParent, _pDlg, ModuleRes( ED_REF) ), - aRefBtn ( pParent, ModuleRes( RB_REF),&aEdRef,&aFtEditName,_pDlg ), + aEdRef ( pParent, _pDlg, &aFtEditName, ModuleRes( ED_REF) ), + aRefBtn ( pParent, ModuleRes( RB_REF), &aEdRef, _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 8d39ea91f556..01fc78b45d92 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -87,7 +87,7 @@ void ValWnd::SetValue( const String& rStrVal ) //---------------------------------------------------------------------------- ArgEdit::ArgEdit( Window* pParent, const ResId& rResId ) - : RefEdit( pParent, NULL, rResId ), + : RefEdit( pParent, NULL, NULL, rResId ), pEdPrev ( NULL ), pEdNext ( NULL ), pSlider ( NULL ), @@ -847,17 +847,20 @@ void EditBox::UpdateOldSel() #define SC_ENABLE_TIME 100 -RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ) +RefEdit::RefEdit( Window* _pParent,IControlReferenceHandler* pParent, + Window* pShrinkModeLabel, const ResId& rResId ) : Edit( _pParent, rResId ) , pAnyRefDlg( pParent ) + , pLabelWidget(pShrinkModeLabel) { aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) ); aTimer.SetTimeout( SC_ENABLE_TIME ); } -RefEdit::RefEdit( Window* _pParent, WinBits nStyle ) +RefEdit::RefEdit( Window* _pParent, Window* pShrinkModeLabel, WinBits nStyle ) : Edit( _pParent, nStyle ) , pAnyRefDlg( NULL ) + , pLabelWidget(pShrinkModeLabel) { aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) ); aTimer.SetTimeout( SC_ENABLE_TIME ); @@ -865,7 +868,7 @@ RefEdit::RefEdit( Window* _pParent, WinBits nStyle ) extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeRefEdit(Window *pParent, VclBuilder::stringmap &) { - return new RefEdit(pParent, WB_BORDER); + return new RefEdit(pParent, NULL, WB_BORDER); } RefEdit::~RefEdit() @@ -904,9 +907,10 @@ void RefEdit::StartUpdateData() aTimer.Start(); } -void RefEdit::SetRefDialog( IControlReferenceHandler* pDlg ) +void RefEdit::SetReferences( IControlReferenceHandler* pDlg, Window* pLabel ) { pAnyRefDlg = pDlg; + pLabelWidget = pLabel; if( pDlg ) { @@ -967,8 +971,7 @@ RefButton::RefButton( Window* _pParent, const ResId& rResId) : aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ).toString() ), aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ).toString() ), pAnyRefDlg( NULL ), - pRefEdit( NULL ), - pLabelWidget( NULL ) + pRefEdit( NULL ) { SetStartImage(); } @@ -980,8 +983,7 @@ RefButton::RefButton( Window* _pParent, WinBits nStyle ) : aShrinkQuickHelp( ModuleRes( RID_STR_SHRINK ).toString() ), aExpandQuickHelp( ModuleRes( RID_STR_EXPAND ).toString() ), pAnyRefDlg( NULL ), - pRefEdit( NULL ), - pLabelWidget( NULL ) + pRefEdit( NULL ) { SetStartImage(); } @@ -991,15 +993,14 @@ 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, Window* pShrinkModeLabel, IControlReferenceHandler* _pDlg ) : +RefButton::RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit, 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 ), - pLabelWidget( pShrinkModeLabel ) + pRefEdit( pEdit ) { SetStartImage(); } @@ -1016,11 +1017,10 @@ void RefButton::SetEndImage() SetQuickHelpText( aExpandQuickHelp ); } -void RefButton::SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit, Window* pShrinkModeLabel ) +void RefButton::SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit ) { pAnyRefDlg = pDlg; pRefEdit = pEdit; - pLabelWidget = pShrinkModeLabel; } //---------------------------------------------------------------------------- diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx index 50a2d0ded967..77e8935b118b 100644 --- a/formula/source/ui/dlg/parawin.cxx +++ b/formula/source/ui/dlg/parawin.cxx @@ -387,8 +387,8 @@ void ParaWin::InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBt ArgEdit& rEdArg, RefButton& rRefBtn) { - rRefBtn.SetReferences(pMyParent, &rEdArg, &rFtArg); - rEdArg.SetRefDialog(pMyParent); + rRefBtn.SetReferences(pMyParent, &rEdArg); + rEdArg.SetReferences(pMyParent, &rFtArg); aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn); -- cgit