diff options
-rw-r--r-- | sc/source/ui/attrdlg/condfrmt.cxx | 77 | ||||
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 37 | ||||
-rw-r--r-- | sc/source/ui/formdlg/formula.cxx | 117 | ||||
-rw-r--r-- | sc/source/ui/formdlg/funcutl.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/anyrefdg.hxx | 180 | ||||
-rw-r--r-- | sc/source/ui/inc/condfrmt.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/crnrdlg.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/formula.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/miscdlgs.hrc | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/solvrdlg.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/tabopdlg.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 303 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/crnrdlg.cxx | 82 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/solvrdlg.cxx | 65 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/tabopdlg.cxx | 49 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/areasdlg.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 68 |
20 files changed, 631 insertions, 466 deletions
diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx index baf2f659b823..f5cebbd58310 100644 --- a/sc/source/ui/attrdlg/condfrmt.cxx +++ b/sc/source/ui/attrdlg/condfrmt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: condfrmt.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-07-05 14:14:57 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:39:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,18 +162,33 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aBtnOk.SetClickHdl ( LINK( this, ScConditionalFormatDlg, BtnHdl ) ); //? aBtnCancel.SetClickHdl( LINK( this, ScConditionalFormatDlg, BtnHdl ) ); - aEdtCond11.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond12.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond21.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond22.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond31.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond32.SetGetFocusHdl ( LINK( this, ScConditionalFormatDlg, EdGetFocusHdl ) ); - aEdtCond11.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); - aEdtCond12.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); - aEdtCond21.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); - aEdtCond22.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); - aEdtCond31.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); - aEdtCond32.SetLoseFocusHdl ( LINK( this, ScConditionalFormatDlg, EdLoseFocusHdl ) ); + Link aLink = LINK( this, ScConditionalFormatDlg, GetFocusHdl ); + aEdtCond11.SetGetFocusHdl( aLink ); + aEdtCond12.SetGetFocusHdl( aLink ); + aEdtCond21.SetGetFocusHdl( aLink ); + aEdtCond22.SetGetFocusHdl( aLink ); + aEdtCond31.SetGetFocusHdl( aLink ); + aEdtCond32.SetGetFocusHdl( aLink ); + aRbCond11.SetGetFocusHdl( aLink ); + aRbCond12.SetGetFocusHdl( aLink ); + aRbCond21.SetGetFocusHdl( aLink ); + aRbCond22.SetGetFocusHdl( aLink ); + aRbCond31.SetGetFocusHdl( aLink ); + aRbCond32.SetGetFocusHdl( aLink ); + + aLink = LINK( this, ScConditionalFormatDlg, LoseFocusHdl ); + aEdtCond11.SetLoseFocusHdl( aLink ); + aEdtCond12.SetLoseFocusHdl( aLink ); + aEdtCond21.SetLoseFocusHdl( aLink ); + aEdtCond22.SetLoseFocusHdl( aLink ); + aEdtCond31.SetLoseFocusHdl( aLink ); + aEdtCond32.SetLoseFocusHdl( aLink ); + aRbCond11.SetLoseFocusHdl( aLink ); + aRbCond12.SetLoseFocusHdl( aLink ); + aRbCond21.SetLoseFocusHdl( aLink ); + aRbCond22.SetLoseFocusHdl( aLink ); + aRbCond31.SetLoseFocusHdl( aLink ); + aRbCond32.SetLoseFocusHdl( aLink ); // Condition 1 aCond1Pos1 = aLbCond12.GetPosPixel(); // Position Edit ohne Listbox @@ -360,6 +375,7 @@ void ScConditionalFormatDlg::SetReference( const ScRange& rRef, ScDocument* pDoc rRef.Format( aStr, SCR_ABS_3D, pDoc ); String aVal( pEdActive->GetText() ); Selection aSel( pEdActive->GetSelection() ); + aSel.Justify(); aVal.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); aVal.Insert( aStr, (xub_StrLen)aSel.Min() ); Selection aNewSel( aSel.Min(), aSel.Min()+aStr.Len() ); @@ -400,7 +416,8 @@ void ScConditionalFormatDlg::SetActive() if ( bDlgLostFocus ) { bDlgLostFocus = FALSE; - pEdActive->GrabFocus(); + if( pEdActive ) + pEdActive->GrabFocus(); } else GrabFocus(); @@ -722,22 +739,36 @@ IMPL_LINK( ScConditionalFormatDlg, ChangeCond32Hdl, void *, EMPTYARG ) //---------------------------------------------------------------------------- -IMPL_LINK( ScConditionalFormatDlg, EdGetFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScConditionalFormatDlg, GetFocusHdl, Control*, pCtrl ) { - pEdActive = pEd; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); - pEd->SetSelection( Selection(0,SELECTION_MAX) ); - return( 0L ); + if( (pCtrl == (Control*)&aEdtCond11) || (pCtrl == (Control*)&aRbCond11) ) + pEdActive = &aEdtCond11; + else if( (pCtrl == (Control*)&aEdtCond12) || (pCtrl == (Control*)&aRbCond12) ) + pEdActive = &aEdtCond12; + else if( (pCtrl == (Control*)&aEdtCond21) || (pCtrl == (Control*)&aRbCond21) ) + pEdActive = &aEdtCond21; + else if( (pCtrl == (Control*)&aEdtCond22) || (pCtrl == (Control*)&aRbCond22) ) + pEdActive = &aEdtCond22; + else if( (pCtrl == (Control*)&aEdtCond31) || (pCtrl == (Control*)&aRbCond31) ) + pEdActive = &aEdtCond31; + else if( (pCtrl == (Control*)&aEdtCond32) || (pCtrl == (Control*)&aRbCond32) ) + pEdActive = &aEdtCond32; + else + pEdActive = NULL; + + if( pEdActive ) + pEdActive->SetSelection( Selection( 0, SELECTION_MAX ) ); + + return 0; } //---------------------------------------------------------------------------- -IMPL_LINK( ScConditionalFormatDlg, EdLoseFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScConditionalFormatDlg, LoseFocusHdl, Control*, pCtrl ) { bDlgLostFocus = !IsActive(); - return( 0L ); + return 0; } diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index db02c0cbf8f8..11385b69aa2b 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filtdlg.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-07-05 14:13:35 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:40:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -731,27 +731,8 @@ IMPL_LINK( ScFilterDlg, TimeOutHdl, Timer*, _pTimer ) { // alle 50ms nachschauen, ob RefInputMode noch stimmt - if ( _pTimer == pTimer && IsActive() ) - { - if ( aEdCopyArea.HasFocus() ) - { - if ( !bRefInputMode ) - { - bRefInputMode = TRUE; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); // Mauseingabe im Tabellenfenster zulassen - } - } - else - { - if ( bRefInputMode ) - { - bRefInputMode = FALSE; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Disable(FALSE); //! allgemeine Methode im ScAnyRefDlg - } - } - } + if( _pTimer == pTimer && IsActive() ) + bRefInputMode = (aEdCopyArea.HasFocus() || aRbCopyArea.HasFocus()); if ( aBtnMore.GetState() ) pTimer->Start(); diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index b9bd0e2d1247..82ce1702bc2d 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sfiltdlg.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-07-05 14:13:35 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:40:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -478,31 +478,22 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pTimer ) { // alle 50ms nachschauen, ob RefInputMode noch stimmt - if ( _pTimer == pTimer && IsActive() ) + if( (_pTimer == pTimer) && IsActive() ) { - if ( aEdCopyArea.HasFocus() || aEdFilterArea.HasFocus() ) + if( aEdCopyArea.HasFocus() || aRbCopyArea.HasFocus() ) { - pRefInputEdit = aEdCopyArea.HasFocus() - ? &aEdCopyArea - : &aEdFilterArea; - - if ( !bRefInputMode ) - { - - bRefInputMode = TRUE; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); // Mauseingabe im Tabellenfenster zulassen - } + pRefInputEdit = &aEdCopyArea; + bRefInputMode = TRUE; } - else + else if( aEdFilterArea.HasFocus() || aRbFilterArea.HasFocus() ) { - if ( bRefInputMode ) - { - pRefInputEdit = NULL; - bRefInputMode = FALSE; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Disable(FALSE); //! allgemeine Methode im ScAnyRefDlg - } + pRefInputEdit = &aEdFilterArea; + bRefInputMode = TRUE; + } + else if( bRefInputMode ) + { + pRefInputEdit = NULL; + bRefInputMode = FALSE; } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 5c1d5434ecae..674306583dfb 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -2,9 +2,9 @@ * * $RCSfile: formula.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-09-28 11:47:09 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:41:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1449,87 +1449,64 @@ void ScFormulaDlg::UpdateSelection() } // virtuelle Methoden von ScAnyRefDlg: -void ScFormulaDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton) +void ScFormulaDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton ) { aEdRef.Show(); - pTheRefEdit=pEdit; - pTheRefButton=pButton; - if(pTheRefEdit!=NULL) - { - aEdRef.SetRefString(pTheRefEdit->GetText()); - aEdRef.SetSelection(pTheRefEdit->GetSelection()); - aEdRef.SetHelpId(pTheRefEdit->GetHelpId()); - aEdRef.SetUniqueId(pTheRefEdit->GetUniqueId()); - - if(pButton!=NULL) - { - aRefBtn.Show(); - ScAnyRefDlg::RefInputStart(&aEdRef,&aRefBtn); - aRefBtn.SetEndImage(); - } - else - { - aRefBtn.Hide(); - ScAnyRefDlg::RefInputStart(&aEdRef); - } + pTheRefEdit = pEdit; + pTheRefButton = pButton; - String aStr=aTitle2; - aStr+=String(' '); - aStr+=aFtEditName.GetText(); + if( pTheRefEdit ) + { + aEdRef.SetRefString( pTheRefEdit->GetText() ); + aEdRef.SetSelection( pTheRefEdit->GetSelection() ); + aEdRef.SetHelpId( pTheRefEdit->GetHelpId() ); + aEdRef.SetUniqueId( pTheRefEdit->GetUniqueId() ); + } - if(aScParaWin.GetActiveLine()>0) - { - aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "(...; " )); - } - else - { - aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "( " )); - } + aRefBtn.Show( pButton != NULL ); + ScAnyRefDlg::RefInputStart( &aEdRef, pButton ? &aRefBtn : NULL ); + aRefBtn.SetEndImage(); - aStr += aScParaWin.GetActiveArgName(); - if(nArgs>1) - aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";...)" )); - else - aStr += ')'; - SetText(aStr); - } - else + if( pTheRefEdit ) { - if(pButton!=NULL) - { - aRefBtn.Show(); - ScAnyRefDlg::RefInputStart(&aEdRef,&aRefBtn); - } - else - { - aRefBtn.Hide(); - ScAnyRefDlg::RefInputStart(&aEdRef); - } + String aStr = aTitle2; + aStr += ' '; + aStr += aFtEditName.GetText(); + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "( " ) ); + if( aScParaWin.GetActiveLine() > 0 ) + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "...; " ) ); + aStr += aScParaWin.GetActiveArgName(); + if( aScParaWin.GetActiveLine() + 1 < nArgs ) + aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; ..." )); + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ) ); + + aStr.EraseAllChars( '~' ); + SetText( aStr ); } } -void ScFormulaDlg::RefInputDone( BOOL bForced) +void ScFormulaDlg::RefInputDone( BOOL bForced ) { - ScAnyRefDlg::RefInputDone(bForced); - if(bForced || !aRefBtn.IsVisible()) + ScAnyRefDlg::RefInputDone( bForced ); + aRefBtn.SetStartImage(); + if( bForced || !aRefBtn.IsVisible() ) { aEdRef.Hide(); aRefBtn.Hide(); - if(pTheRefEdit!=NULL) + if( pTheRefEdit ) { - pTheRefEdit->SetRefString(aEdRef.GetText()); + pTheRefEdit->SetRefString( aEdRef.GetText() ); pTheRefEdit->GrabFocus(); - if(pTheRefButton!=NULL) + if( pTheRefButton ) pTheRefButton->SetStartImage(); - aRefBtn.SetStartImage(); - USHORT nPrivActiv=aScParaWin.GetActiveLine(); - aScParaWin.SetArgument(nPrivActiv,aEdRef.GetText()); - ModifyHdl(&aScParaWin); - pTheRefEdit=NULL; + USHORT nPrivActiv = aScParaWin.GetActiveLine(); + aScParaWin.SetArgument( nPrivActiv, aEdRef.GetText() ); + ModifyHdl( &aScParaWin ); + pTheRefEdit = NULL; } - SetText(aTitle1); + SetText( aTitle1 ); } } @@ -1539,12 +1516,13 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc ) { aScParaWin.SetRefMode(TRUE); - Edit* pEd = aScParaWin.GetActiveEdit(); Selection theSel; String aStrEd; + Edit* pEd = GetCurrRefEdit(); if(pEd!=NULL && pTheRefEdit==NULL) { theSel=pEd->GetSelection(); + theSel.Justify(); aStrEd=pEd->GetText(); aEdRef.SetRefString(aStrEd); aEdRef.SetSelection( theSel ); @@ -1552,6 +1530,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc ) else { theSel=aEdRef.GetSelection(); + theSel.Justify(); aStrEd=aEdRef.GetText(); } String aRefStr; @@ -1625,8 +1604,8 @@ void ScFormulaDlg::SetActive() if(nArgs > 0) { RefInputDone(); - Edit* pEd = aScParaWin.GetActiveEdit(); - if(pEd!=NULL) + Edit* pEd = GetCurrRefEdit()/*aScParaWin.GetActiveEdit()*/; + if( pEd ) { Selection theSel=aEdRef.GetSelection(); // Edit may have the focus -> call ModifyHdl in addition @@ -2097,5 +2076,9 @@ void ScFormulaDlg::SaveLRUEntry(ScFuncDesc* pFuncDesc) } } +ScRefEdit* ScFormulaDlg::GetCurrRefEdit() +{ + return aEdRef.IsVisible() ? &aEdRef : aScParaWin.GetActiveEdit(); +} diff --git a/sc/source/ui/formdlg/funcutl.cxx b/sc/source/ui/formdlg/funcutl.cxx index 5ddf57d497cf..54f0d5135f59 100644 --- a/sc/source/ui/formdlg/funcutl.cxx +++ b/sc/source/ui/formdlg/funcutl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: funcutl.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: nn $ $Date: 2001-09-28 11:47:09 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:41:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -240,7 +240,7 @@ void __EXPORT ArgEdit::KeyInput( const KeyEvent& rKEvt ) Sound::Beep(); } else - Edit::KeyInput( rKEvt ); + ScRefEdit::KeyInput( rKEvt ); } diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index bdaab68f304a..e1f29a087129 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: anyrefdg.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-11-28 11:45:35 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,16 +62,16 @@ #ifndef SC_ANYREFDG_HXX #define SC_ANYREFDG_HXX -#ifndef _IMAGEBTN_HXX //autogen +#ifndef _IMAGEBTN_HXX #include <vcl/imagebtn.hxx> #endif -#ifndef _EDIT_HXX //autogen +#ifndef _EDIT_HXX #include <vcl/edit.hxx> #endif -#ifndef _ACCEL_HXX //autogen +#ifndef _ACCEL_HXX #include <vcl/accel.hxx> #endif -#ifndef _BASEDLGS_HXX //autogen +#ifndef _BASEDLGS_HXX #include <sfx2/basedlgs.hxx> #endif @@ -80,6 +80,7 @@ class ScRange; class ScDocument; class ScTabViewShell; class ScAnyRefDlg; +class ScRefButton; class ScFormulaCell; class ScCompiler; @@ -88,123 +89,134 @@ class ScCompiler; class ScRefEdit : public Edit { private: + Timer aTimer; + ScAnyRefDlg* pAnyRefDlg; // parent dialog + BOOL bSilentFocus; // for SilentGrabFocus() - Timer aTimer; - ScAnyRefDlg* pAnyRefDlg; // Dialog + DECL_LINK( UpdateHdl, Timer* ); - DECL_LINK( UpdateHdl, Timer*); +protected: + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); public: - ScRefEdit( ScAnyRefDlg* pParent, const ResId& rResId); - ScRefEdit( Window *pParent, const ResId& rResId); - ~ScRefEdit(); + ScRefEdit( ScAnyRefDlg* pParent, const ResId& rResId ); + ScRefEdit( Window* pParent, const ResId& rResId ); + virtual ~ScRefEdit(); - void SetRefString( const XubString& rStr ); - virtual void SetText( const XubString& rStr ); + void SetRefString( const XubString& rStr ); + virtual void SetText( const XubString& rStr ); + virtual void Modify(); - virtual void GetFocus(); - virtual void LoseFocus(); - virtual void Modify(); - void StartUpdateData(); + void StartUpdateData(); - void SetRefDialog(ScAnyRefDlg *pDlg); - ScAnyRefDlg* GetRefDialog() {return pAnyRefDlg;} + void SilentGrabFocus(); // does not update any references + void SetRefDialog( ScAnyRefDlg* pDlg ); + inline ScAnyRefDlg* GetRefDialog() { return pAnyRefDlg; } }; +//============================================================================ + class ScRefButton : public ImageButton { -public: - ScRefButton( ScAnyRefDlg* pParent, const ResId& rResId, ScRefEdit* pEdit ); - ScRefButton( Window *pParent, const ResId& rResId); - - void SetReferences( ScAnyRefDlg* pRefDlg,ScRefEdit* pEdit ); +private: + Image aImgRefStart; // Symbol fuer Ref.-Eingabe starten + Image aImgRefDone; // Symbol fuer Ref.-Eingabe beenden + ScAnyRefDlg* pAnyRefDlg; // parent dialog + ScRefEdit* pRefEdit; // zugeordnetes Edit-Control - void SetStartImage(); - void SetEndImage(); - void DoRef() { Click(); } - virtual void GetFocus(); - virtual void LoseFocus(); +protected: + virtual void Click(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); +public: + ScRefButton( ScAnyRefDlg* pParent, const ResId& rResId, ScRefEdit* pEdit ); + ScRefButton( Window* pParent, const ResId& rResId ); -protected: - virtual void Click(); + void SetReferences( ScAnyRefDlg* pDlg, ScRefEdit* pEdit ); -private: - Image aImgRefStart; // Symbol fuer Ref.-Eingabe starten - Image aImgRefDone; // Symbol fuer Ref.-Eingabe beenden - ScAnyRefDlg* pDlg; // Dialog - ScRefEdit* pRefEdit; // zugeordnetes Edit-Control + void SetStartImage(); + void SetEndImage(); + inline void DoRef() { Click(); } }; //============================================================================ + class ScAnyRefDlg : public SfxModelessDialog { -friend ScRefButton; + friend class ScRefButton; + friend class ScRefEdit; private: - SfxBindings* pMyBindings; - Edit* pRefEdit; // aktives Eingabefeld - ScRefButton* pRefBtn; // Button dazu - String sOldDialogText; // Originaltitel des Dialogfensters - Size aOldDialogSize; // Originalgroesse Dialogfenster - Point aOldEditPos; // Originalposition des Eingabefeldes - Size aOldEditSize; // Originalgroesse des Eingabefeldes - Point aOldButtonPos; // Originalpositiuon des Buttons - BOOL* pHiddenMarks; // Merkfeld fuer versteckte Controls - Accelerator* pAccel; // fuer Enter/Escape - BOOL bAccInserted; - BOOL bHighLightRef; - BOOL bEnableColorRef; - ScFormulaCell* pRefCell; - ScCompiler* pRefComp; - Window* pActiveWin; - Timer aTimer; - String aDocName; // document on which the dialog was opened - - DECL_LINK( UpdateFocusHdl, Timer*); - DECL_LINK( AccelSelectHdl, Accelerator * ); + SfxBindings* pMyBindings; + ScRefEdit* pRefEdit; // aktives Eingabefeld + ScRefButton* pRefBtn; // Button dazu + String sOldDialogText; // Originaltitel des Dialogfensters + Size aOldDialogSize; // Originalgroesse Dialogfenster + Point aOldEditPos; // Originalposition des Eingabefeldes + Size aOldEditSize; // Originalgroesse des Eingabefeldes + Point aOldButtonPos; // Originalpositiuon des Buttons + BOOL* pHiddenMarks; // Merkfeld fuer versteckte Controls + Accelerator* pAccel; // fuer Enter/Escape + BOOL bAccInserted; + BOOL bHighLightRef; + BOOL bEnableColorRef; + ScFormulaCell* pRefCell; + ScCompiler* pRefComp; + Window* pActiveWin; + Timer aTimer; + String aDocName; // document on which the dialog was opened + + DECL_LINK( UpdateFocusHdl, Timer* ); + DECL_LINK( AccelSelectHdl, Accelerator* ); protected: - BOOL DoClose( USHORT nId ); + BOOL DoClose( USHORT nId ); - void EnableSpreadsheets(BOOL bFlag=TRUE, BOOL bChilds=TRUE); - void SetDispatcherLock( BOOL bLock ); + void EnableSpreadsheets( BOOL bFlag = TRUE, BOOL bChilds = TRUE ); + void SetDispatcherLock( BOOL bLock ); - virtual long PreNotify( NotifyEvent& rNEvt ); - - virtual void RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton = NULL ); - virtual void RefInputDone( BOOL bForced = FALSE ); - void ShowSimpleReference( const XubString& rStr ); - void ShowFormulaReference( const XubString& rStr ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual void RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton = NULL ); + virtual void RefInputDone( BOOL bForced = FALSE ); + void ShowSimpleReference( const XubString& rStr ); + void ShowFormulaReference( const XubString& rStr ); public: - ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, - Window* pParent, USHORT nResId); - virtual ~ScAnyRefDlg(); + ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, + Window* pParent, USHORT nResId); + virtual ~ScAnyRefDlg(); + + virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) = 0; + virtual void AddRefEntry(); - virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) = 0; - virtual void AddRefEntry(); + virtual BOOL IsRefInputMode() const; + virtual BOOL IsTableLocked() const; + virtual BOOL IsDocAllowed( SfxObjectShell* pDocSh ) const; - virtual BOOL IsRefInputMode() const; - virtual BOOL IsTableLocked() const; - virtual BOOL IsDocAllowed(SfxObjectShell* pDocSh) const; + void ShowReference( const XubString& rStr ); + void HideReference( BOOL bDoneRefMode = TRUE ); - void ShowReference( const XubString& rStr ); - void HideReference( BOOL bDoneRefMode = TRUE ); + void ToggleCollapsed( ScRefEdit* pEdit, ScRefButton* pButton = NULL ); + void ReleaseFocus( ScRefEdit* pEdit, ScRefButton* pButton = NULL ); - void ViewShellChanged(ScTabViewShell* pScViewShell); - void SwitchToDocument(); - SfxBindings& GetBindings(); + void ViewShellChanged( ScTabViewShell* pScViewShell ); + void SwitchToDocument(); + SfxBindings& GetBindings(); - virtual void SetActive() = 0; -// virtual BOOL Close(); - virtual void StateChanged( StateChangedType nStateChange ); + virtual void SetActive() = 0; +// virtual BOOL Close(); + virtual void StateChanged( StateChangedType nStateChange ); }; +//============================================================================ #endif // SC_ANYREFDG_HXX diff --git a/sc/source/ui/inc/condfrmt.hxx b/sc/source/ui/inc/condfrmt.hxx index 1a178734e0af..2d896fc9e128 100644 --- a/sc/source/ui/inc/condfrmt.hxx +++ b/sc/source/ui/inc/condfrmt.hxx @@ -2,9 +2,9 @@ * * $RCSfile: condfrmt.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2001-05-23 15:05:18 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,8 +182,8 @@ private: DECL_LINK( ChangeCond31Hdl, void * ); DECL_LINK( ChangeCond32Hdl, void * ); - DECL_LINK( EdGetFocusHdl, ScRefEdit* ); - DECL_LINK( EdLoseFocusHdl, ScRefEdit* ); + DECL_LINK( GetFocusHdl, Control* ); + DECL_LINK( LoseFocusHdl, Control* ); DECL_LINK( BtnHdl, PushButton* ); #endif // _CONDFRMT_CXX }; diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx index d9e33e763376..d3d091f0615f 100644 --- a/sc/source/ui/inc/crnrdlg.hxx +++ b/sc/source/ui/inc/crnrdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: crnrdlg.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2001-05-23 10:52:56 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -143,8 +143,8 @@ private: DECL_LINK( ColClickHdl, void * ); DECL_LINK( RowClickHdl, void * ); DECL_LINK( Range2DataModifyHdl, void * ); - DECL_LINK( EdGetFocusHdl, ScRefEdit* ); - DECL_LINK( EdLoseFocusHdl, ScRefEdit* ); + DECL_LINK( GetFocusHdl, Control* ); + DECL_LINK( LoseFocusHdl, Control* ); #endif }; diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx index a258eecf0c4d..c9817bca3a63 100644 --- a/sc/source/ui/inc/formula.hxx +++ b/sc/source/ui/inc/formula.hxx @@ -2,9 +2,9 @@ * * $RCSfile: formula.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:58 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -219,7 +219,7 @@ private: Font aFntBold; Font aFntLight; USHORT nEdFocus; - Selection theCurSel; +// Selection theCurSel; BOOL bEditFlag; ScFuncDesc* pFuncDesc; USHORT nArgs; @@ -272,6 +272,8 @@ private: xub_StrLen GetFunctionPos(xub_StrLen nPos); void UpdateTokenArray( const String& rStrExp); + ScRefEdit* GetCurrRefEdit(); + DECL_LINK( ScrollHdl, ScParaWin* ); DECL_LINK( ModifyHdl, ScParaWin* ); DECL_LINK( FxHdl, ScParaWin* ); diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc index 38b27ffe0911..4bed24674a05 100644 --- a/sc/source/ui/inc/miscdlgs.hrc +++ b/sc/source/ui/inc/miscdlgs.hrc @@ -2,9 +2,9 @@ * * $RCSfile: miscdlgs.hrc,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dr $ $Date: 2001-05-30 13:33:54 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,13 +163,13 @@ #define BTN_RIGHT 3 #define BTN_TOP 4 #define BTN_BOTTOM 5 -#define FL_SEP1 10 +#define FL_SEP11 10 #define FL_TYPE 11 #define BTN_ARITHMETIC 12 #define BTN_GEOMETRIC 13 #define BTN_DATE 14 #define BTN_AUTOFILL 15 -#define FL_SEP2 20 +#define FL_SEP12 20 #define FL_TIME_UNIT 21 #define BTN_DAY 22 #define BTN_DAY_OF_WEEK 23 diff --git a/sc/source/ui/inc/solvrdlg.hxx b/sc/source/ui/inc/solvrdlg.hxx index a7c82debfbbe..fe6dfc4f3fcd 100644 --- a/sc/source/ui/inc/solvrdlg.hxx +++ b/sc/source/ui/inc/solvrdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: solvrdlg.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2001-05-23 17:01:30 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,7 +101,7 @@ public: ~ScSolverDlg(); virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); - virtual BOOL IsRefInputMode() const { return bMouseInputMode; } + virtual BOOL IsRefInputMode() const; virtual void SetActive(); virtual BOOL Close(); @@ -129,7 +129,6 @@ private: ScDocument* pDoc; const USHORT nCurTab; ScRefEdit* pEdActive; - BOOL bMouseInputMode; BOOL bDlgLostFocus; const String errMsgInvalidVar; const String errMsgInvalidForm; @@ -143,8 +142,8 @@ private: void RaiseError( ScSolverErr eError ); DECL_LINK( BtnHdl, PushButton* ); - DECL_LINK( EdGetFocusHdl, ScRefEdit* ); - DECL_LINK( EdLoseFocusHdl, ScRefEdit* ); + DECL_LINK( GetFocusHdl, Control* ); + DECL_LINK( LoseFocusHdl, Control* ); #endif // _SOLVERDLG_CXX }; diff --git a/sc/source/ui/inc/tabopdlg.hxx b/sc/source/ui/inc/tabopdlg.hxx index 708fc59dd0b3..5a5b61bba9ef 100644 --- a/sc/source/ui/inc/tabopdlg.hxx +++ b/sc/source/ui/inc/tabopdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tabopdlg.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2001-05-23 17:01:30 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,8 +147,8 @@ private: void RaiseError( ScTabOpErr eError ); DECL_LINK( BtnHdl, PushButton* ); - DECL_LINK( EdGetFocusHdl, ScRefEdit* ); - DECL_LINK( EdLoseFocusHdl, ScRefEdit* ); + DECL_LINK( GetFocusHdl, Control* ); + DECL_LINK( LoseFocusHdl, Control* ); #endif // _TABOPDLG_CXX }; diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 15071f6470fb..7ff46b66b3b7 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tabview.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-10-02 18:32:43 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:43:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -381,6 +381,8 @@ public: void MoveCursorEnter( BOOL bShift ); // Shift fuer Richtung (kein Markieren) + BOOL MoveCursorKeyInput( const KeyEvent& rKeyEvent ); + void FindNextUnprot( BOOL bShift, BOOL bInSelection = TRUE ); void SetTabNo( USHORT nTab, BOOL bNew = FALSE ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 60287646f821..99d5640e82e0 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: anyrefdg.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-11-28 11:46:41 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:44:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -173,40 +173,37 @@ void lcl_InvalidateWindows() #define SC_ENABLE_TIME 100 -ScRefEdit::ScRefEdit( ScAnyRefDlg* pParent, const ResId& rResId): - Edit(pParent,rResId) +ScRefEdit::ScRefEdit( ScAnyRefDlg* pParent, const ResId& rResId ) : + Edit( pParent, rResId ), + pAnyRefDlg( pParent ), + bSilentFocus( FALSE ) { - pAnyRefDlg=pParent; - aTimer.SetTimeoutHdl(LINK( this, ScRefEdit, UpdateHdl) ); - aTimer.SetTimeout(SC_ENABLE_TIME); + aTimer.SetTimeoutHdl( LINK( this, ScRefEdit, UpdateHdl ) ); + aTimer.SetTimeout( SC_ENABLE_TIME ); } -ScRefEdit::ScRefEdit( Window *pParent, const ResId& rResId): - Edit(pParent,rResId) +ScRefEdit::ScRefEdit( Window* pParent, const ResId& rResId ) : + Edit( pParent, rResId ), + pAnyRefDlg( NULL ), + bSilentFocus( FALSE ) { - pAnyRefDlg=NULL; } ScRefEdit::~ScRefEdit() { - aTimer.SetTimeoutHdl(Link()); + aTimer.SetTimeoutHdl( Link() ); aTimer.Stop(); } -void ScRefEdit::SetRefDialog(ScAnyRefDlg *pDlg) +void ScRefEdit::SetRefString( const XubString& rStr ) { - pAnyRefDlg=pDlg; + Edit::SetText( rStr ); +} - if(pDlg!=NULL) - { - aTimer.SetTimeoutHdl(LINK( this, ScRefEdit, UpdateHdl) ); - aTimer.SetTimeout(SC_ENABLE_TIME); - } - else - { - aTimer.SetTimeoutHdl(Link()); - aTimer.Stop(); - } +void ScRefEdit::SetText( const XubString& rStr ) +{ + Edit::SetText( rStr ); + UpdateHdl( &aTimer ); } void ScRefEdit::StartUpdateData() @@ -214,50 +211,63 @@ void ScRefEdit::StartUpdateData() aTimer.Start(); } -void ScRefEdit::SetText( const XubString& rStr ) +void ScRefEdit::SilentGrabFocus() { - Edit::SetText(rStr); - UpdateHdl(&aTimer); + bSilentFocus = TRUE; + GrabFocus(); + bSilentFocus = FALSE; } -void ScRefEdit::SetRefString( const XubString& rStr ) +void ScRefEdit::SetRefDialog( ScAnyRefDlg* pDlg ) { - Edit::SetText(rStr); -} + pAnyRefDlg = pDlg; -void ScRefEdit::GetFocus() -{ - Edit::GetFocus(); - StartUpdateData(); + if( pDlg ) + { + aTimer.SetTimeoutHdl( LINK( this, ScRefEdit, UpdateHdl ) ); + aTimer.SetTimeout( SC_ENABLE_TIME ); + } + else + { + aTimer.SetTimeoutHdl( Link() ); + aTimer.Stop(); + } } void ScRefEdit::Modify() { Edit::Modify(); - if(pAnyRefDlg!=NULL) - { + if( pAnyRefDlg ) pAnyRefDlg->HideReference(); - } } +void ScRefEdit::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode& rKeyCode = rKEvt.GetKeyCode(); + if( pAnyRefDlg && !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) + pAnyRefDlg->ReleaseFocus( this ); + else + Edit::KeyInput( rKEvt ); +} + +void ScRefEdit::GetFocus() +{ + Edit::GetFocus(); + if( !bSilentFocus ) + StartUpdateData(); +} void ScRefEdit::LoseFocus() { Edit::LoseFocus(); - - if(pAnyRefDlg!=NULL) - { + if( pAnyRefDlg ) pAnyRefDlg->HideReference(); - } } -IMPL_LINK( ScRefEdit, UpdateHdl, Timer*, pTi) +IMPL_LINK( ScRefEdit, UpdateHdl, Timer*, pTi ) { - if(pAnyRefDlg!=NULL) - { - pAnyRefDlg->ShowReference(GetText()); - } - + if( pAnyRefDlg ) + pAnyRefDlg->ShowReference( GetText() ); return 0; } @@ -266,81 +276,75 @@ IMPL_LINK( ScRefEdit, UpdateHdl, Timer*, pTi) // class ScRefButton //---------------------------------------------------------------------------- -ScRefButton::ScRefButton( ScAnyRefDlg* pParent, const ResId& rResId, ScRefEdit* pEdit ) - : ImageButton ( pParent, rResId ), - aImgRefStart(ScResId( RID_BMP_REFBTN1 )), - aImgRefDone (ScResId( RID_BMP_REFBTN2 )), - pDlg ( pParent ), - pRefEdit ( pEdit ) +ScRefButton::ScRefButton( ScAnyRefDlg* pParent, const ResId& rResId, ScRefEdit* pEdit ) : + ImageButton ( pParent, rResId ), + aImgRefStart( ScResId( RID_BMP_REFBTN1 ) ), + aImgRefDone ( ScResId( RID_BMP_REFBTN2 ) ), + pAnyRefDlg ( pParent ), + pRefEdit ( pEdit ) { - SetImage(aImgRefStart); + SetStartImage(); } -ScRefButton::ScRefButton( Window *pParent, const ResId& rResId) - : ImageButton ( pParent, rResId ), - aImgRefStart( ScResId( RID_BMP_REFBTN1 )), - aImgRefDone ( ScResId( RID_BMP_REFBTN2 )), - pDlg ( NULL), - pRefEdit ( NULL) +ScRefButton::ScRefButton( Window *pParent, const ResId& rResId ) : + ImageButton ( pParent, rResId ), + aImgRefStart( ScResId( RID_BMP_REFBTN1 ) ), + aImgRefDone ( ScResId( RID_BMP_REFBTN2 ) ), + pAnyRefDlg ( NULL ), + pRefEdit ( NULL ) { - SetImage(aImgRefStart); + SetStartImage(); } -void ScRefButton::SetReferences( ScAnyRefDlg* pRefDlg,ScRefEdit* pEdit ) +void ScRefButton::SetReferences( ScAnyRefDlg* pDlg, ScRefEdit* pEdit ) { - pDlg =pRefDlg; - pRefEdit=pEdit; + pAnyRefDlg = pDlg; + pRefEdit = pEdit; } //---------------------------------------------------------------------------- -// wenn der Button reingedrueckt erscheinen soll, -// Check(FALSE/TRUE) statt SetImage - void ScRefButton::Click() { - if(pDlg!=NULL && pRefEdit!=NULL) - { - if (pDlg->pRefEdit == pRefEdit) // Ref.-Input aktiv auf Edit? - { - SetImage(aImgRefStart); // Image aendern - pDlg->RefInputDone(TRUE); // Ref.-Eingabe beenden - } - else - { - pDlg->RefInputDone(TRUE); // sicherheitshalber - pDlg->RefInputStart(pRefEdit, this); // Ref.-Eingabe starten - pRefEdit->GrabFocus(); // Focus auf Edit - SetImage(aImgRefDone); // Image aendern - } - } -} - -void ScRefButton::SetStartImage() // fuer Aufruf von aussen -{ - SetImage(aImgRefStart); + if( pAnyRefDlg ) + pAnyRefDlg->ToggleCollapsed( pRefEdit, this ); } -void ScRefButton::SetEndImage() +void ScRefButton::KeyInput( const KeyEvent& rKEvt ) { - SetImage(aImgRefDone); + const KeyCode& rKeyCode = rKEvt.GetKeyCode(); + if( pAnyRefDlg && !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) + pAnyRefDlg->ReleaseFocus( pRefEdit ); + else + ImageButton::KeyInput( rKEvt ); } void ScRefButton::GetFocus() { ImageButton::GetFocus(); - if(pRefEdit!=NULL) pRefEdit->StartUpdateData(); + if( pRefEdit ) + pRefEdit->StartUpdateData(); } - void ScRefButton::LoseFocus() { ImageButton::LoseFocus(); + if( pRefEdit ) + pRefEdit->Modify(); +} - if(pRefEdit!=NULL) pRefEdit->Modify(); +void ScRefButton::SetStartImage() +{ + SetImage( aImgRefStart ); +} + +void ScRefButton::SetEndImage() +{ + SetImage( aImgRefDone ); } + //---------------------------------------------------------------------------- void lcl_HideAllReferences() @@ -379,11 +383,9 @@ ScAnyRefDlg::ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW, aTimer.SetTimeoutHdl(LINK( this, ScAnyRefDlg, UpdateFocusHdl)); SC_MOD()->InputEnterHandler(); - ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); - if ( pScViewShell ) - { + ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); + if( pScViewShell ) pScViewShell->UpdateInputHandler(TRUE); - } // title has to be from the view that opened the dialog, // even if it's not the current view @@ -453,11 +455,9 @@ ScAnyRefDlg::~ScAnyRefDlg() delete pRefComp; delete pRefCell; - ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); - if ( pScViewShell ) - { + ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); + if( pScViewShell ) pScViewShell->UpdateInputHandler(TRUE); - } if (bAccInserted) Application::RemoveAccel( pAccel ); delete pAccel; @@ -566,7 +566,7 @@ BOOL __EXPORT ScAnyRefDlg::DoClose( USHORT nId ) pSfxApp->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW ) ); - ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); if ( pScViewShell ) pScViewShell->UpdateInputHandler(TRUE); @@ -645,7 +645,7 @@ void ScAnyRefDlg::ViewShellChanged(ScTabViewShell* pScViewShell) void ScAnyRefDlg::ShowReference( const XubString& rStr ) { - if(pRefEdit==NULL && bEnableColorRef) + if( /*!pRefEdit &&*/ bEnableColorRef ) { if( rStr.Search('(')!=STRING_NOTFOUND || rStr.Search('+')!=STRING_NOTFOUND || @@ -669,7 +669,7 @@ void ScAnyRefDlg::ShowReference( const XubString& rStr ) void ScAnyRefDlg::ShowSimpleReference( const XubString& rStr ) { - if(pRefEdit==NULL && bEnableColorRef) + if( /*!pRefEdit &&*/ bEnableColorRef ) { bHighLightRef=TRUE; ScViewData* pViewData=ScDocShell::GetViewData(); @@ -702,7 +702,7 @@ void ScAnyRefDlg::ShowSimpleReference( const XubString& rStr ) void ScAnyRefDlg::ShowFormulaReference( const XubString& rStr ) { - if(pRefEdit==NULL && bEnableColorRef) + if( /*!pRefEdit &&*/ bEnableColorRef) { bHighLightRef=TRUE; ScViewData* pViewData=ScDocShell::GetViewData(); @@ -766,8 +766,7 @@ void ScAnyRefDlg::HideReference( BOOL bDoneRefMode ) { ScViewData* pViewData=ScDocShell::GetViewData(); - if(pViewData!=NULL && pRefEdit==NULL && - bHighLightRef && bEnableColorRef) + if( pViewData && /*!pRefEdit &&*/ bHighLightRef && bEnableColorRef) { ScTabViewShell* pTabViewShell=pViewData->GetViewShell(); @@ -858,9 +857,12 @@ void ScAnyRefDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton ) } pRefEdit->SetPosSizePixel(Point(0, 0), aNewEditSize); - // Button verschieben - if (pRefBtn) - pRefBtn->SetPosPixel(Point(aOldDialogSize.Width()-pRefBtn->GetSizePixel().Width(), 0)); + // set button position and image + if( pRefBtn ) + { + pRefBtn->SetPosPixel( Point( aOldDialogSize.Width() - pRefBtn->GetSizePixel().Width(), 0 ) ); + pRefBtn->SetEndImage(); + } // Fenster verkleinern SetOutputSizePixel(aNewDlgSize); @@ -869,8 +871,8 @@ void ScAnyRefDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton ) sNewDialogText.EraseAllChars('~'); SetText(sNewDialogText); - if ( pButton ) // ueber den Button: Enter und Escape abfangen - { +// if ( pButton ) // ueber den Button: Enter und Escape abfangen +// { if (!pAccel) { pAccel = new Accelerator; @@ -880,7 +882,7 @@ void ScAnyRefDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton ) } Application::InsertAccel( pAccel ); bAccInserted = TRUE; - } +// } } } @@ -904,8 +906,13 @@ void ScAnyRefDlg::RefInputDone( BOOL bForced ) // pEditCell an alte Position pRefEdit->SetPosSizePixel(aOldEditPos, aOldEditSize); - if (pRefBtn) - pRefBtn->SetPosPixel(aOldButtonPos); + + // set button position and image + if( pRefBtn ) + { + pRefBtn->SetPosPixel( aOldButtonPos ); + pRefBtn->SetStartImage(); + } // Alle anderen: Show(); USHORT nChildren = GetChildCount(); @@ -917,6 +924,62 @@ void ScAnyRefDlg::RefInputDone( BOOL bForced ) delete [] pHiddenMarks; pRefEdit = NULL; + pRefBtn = NULL; + } +} + +void ScAnyRefDlg::ToggleCollapsed( ScRefEdit* pEdit, ScRefButton* pButton ) +{ + if( pEdit ) + { + if( pRefEdit == pEdit ) // is this the active ref edit field? + { + pRefEdit->GrabFocus(); // before RefInputDone() + RefInputDone( TRUE ); // finish ref input + } + else + { + RefInputDone( TRUE ); // another active ref edit? + RefInputStart( pEdit, pButton ); // start ref input + // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg) + if( pRefEdit ) + pRefEdit->GrabFocus(); + } + } +} + +void ScAnyRefDlg::ReleaseFocus( ScRefEdit* pEdit, ScRefButton* pButton ) +{ + if( !pRefEdit && pEdit ) + { + RefInputStart( pEdit, pButton ); +// if( pRefEdit ) +// pRefEdit->SilentGrabFocus(); + } + + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + if( pViewShell ) + { + pViewShell->ActiveGrabFocus(); + if( pRefEdit ) + { + const ScViewData* pViewData = pViewShell->GetViewData(); + ScDocument* pDoc = pViewData->GetDocument(); + ScRangeList aRangeList; + if( aRangeList.Parse( pRefEdit->GetText(), pDoc ) ) + { + const ScRange* pRange = aRangeList.GetObject( 0 ); + if( pRange ) + { + pViewShell->SetTabNo( pRange->aStart.Tab() ); + pViewShell->MoveCursorAbs( pRange->aStart.Col(), + pRange->aStart.Row(), SC_FOLLOW_JUMP, FALSE, FALSE ); + pViewShell->MoveCursorAbs( pRange->aEnd.Col(), + pRange->aEnd.Row(), SC_FOLLOW_JUMP, TRUE, FALSE ); + SetReference( *pRange, pDoc ); + } + } + } } } @@ -971,19 +1034,11 @@ IMPL_LINK( ScAnyRefDlg, AccelSelectHdl, Accelerator *, pAccel ) { case KEY_RETURN: case KEY_ESCAPE: - // #57383# der SimpleRefDlg loescht sich bei RefInputDone, - // darum Button umschalten vorher... - if (pRefBtn) - pRefBtn->SetStartImage(); // Image aendern - RefInputDone(TRUE); // Ref.-Eingabe beenden - break; - - default: + if( pRefEdit ) + pRefEdit->GrabFocus(); + RefInputDone( TRUE ); break; } return TRUE; } - - - diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 65072a6557fe..b340e71bc5b1 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: crnrdlg.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dr $ $Date: 2001-05-23 10:50:15 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:44:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -211,10 +211,17 @@ void ScColRowNameRangesDlg::Init() aBtnRowHead.SetClickHdl ( LINK( this, ScColRowNameRangesDlg, RowClickHdl ) ); aEdAssign2.SetModifyHdl ( LINK( this, ScColRowNameRangesDlg, Range2DataModifyHdl ) ); - aEdAssign.SetGetFocusHdl ( LINK( this, ScColRowNameRangesDlg, EdGetFocusHdl ) ); - aEdAssign2.SetGetFocusHdl ( LINK( this, ScColRowNameRangesDlg, EdGetFocusHdl ) ); - aEdAssign.SetLoseFocusHdl ( LINK( this, ScColRowNameRangesDlg, EdLoseFocusHdl ) ); - aEdAssign2.SetLoseFocusHdl ( LINK( this, ScColRowNameRangesDlg, EdLoseFocusHdl ) ); + Link aLink = LINK( this, ScColRowNameRangesDlg, GetFocusHdl ); + aEdAssign.SetGetFocusHdl( aLink ); + aRbAssign.SetGetFocusHdl( aLink ); + aEdAssign2.SetGetFocusHdl( aLink ); + aRbAssign2.SetGetFocusHdl( aLink ); + + aLink = LINK( this, ScColRowNameRangesDlg, LoseFocusHdl ); + aEdAssign.SetLoseFocusHdl( aLink ); + aRbAssign.SetLoseFocusHdl( aLink ); + aEdAssign2.SetLoseFocusHdl( aLink ); + aRbAssign2.SetLoseFocusHdl( aLink ); pEdActive = &aEdAssign; @@ -240,6 +247,7 @@ void ScColRowNameRangesDlg::Init() aBtnRowHead.Enable(); aEdAssign.Enable(); aEdAssign.GrabFocus(); + aRbAssign.Enable(); //@BugID 54702 Enablen/Disablen nur noch in Basisklasse //SFX_APPWINDOW->Enable(); // Ref-Feld hat Focus @@ -342,6 +350,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange,BOOL bRef) aBtnColHead.Disable(); aBtnRowHead.Disable(); aEdAssign2.Disable(); + aRbAssign2.Disable(); } } @@ -498,14 +507,17 @@ void ScColRowNameRangesDlg::SetActive() if ( bDlgLostFocus ) { bDlgLostFocus = FALSE; - pEdActive->GrabFocus(); + if( pEdActive ) + pEdActive->GrabFocus(); } else GrabFocus(); - if ( pEdActive == &aEdAssign ) + + if( pEdActive == &aEdAssign ) Range1DataModifyHdl( 0 ); - else + else if( pEdActive == &aEdAssign2 ) Range2DataModifyHdl( 0 ); + RefInputDone(); } @@ -698,6 +710,7 @@ void ScColRowNameRangesDlg::UpdateRangeData( const String& rRangeStr, BOOL bColN aBtnColHead.Enable(); aBtnRowHead.Enable(); aEdAssign2.Enable(); + aRbAssign2.Enable(); } @@ -1004,6 +1017,7 @@ IMPL_LINK( ScColRowNameRangesDlg, Range1SelectHdl, void *, EMPTYARG ) aBtnColHead.Enable(); aBtnRowHead.Enable(); aEdAssign2.Enable(); + aRbAssign2.Enable(); } else { @@ -1011,6 +1025,7 @@ IMPL_LINK( ScColRowNameRangesDlg, Range1SelectHdl, void *, EMPTYARG ) aBtnColHead.Disable(); aBtnRowHead.Disable(); aEdAssign2.Disable(); + aRbAssign2.Disable(); } aBtnRemove.Disable(); aEdAssign.GrabFocus(); @@ -1059,6 +1074,7 @@ IMPL_LINK( ScColRowNameRangesDlg, Range1DataModifyHdl, void *, EMPTYARG ) aBtnColHead.Enable(); aBtnRowHead.Enable(); aEdAssign2.Enable(); + aRbAssign2.Enable(); } else { @@ -1066,6 +1082,7 @@ IMPL_LINK( ScColRowNameRangesDlg, Range1DataModifyHdl, void *, EMPTYARG ) aBtnColHead.Disable(); aBtnRowHead.Disable(); aEdAssign2.Disable(); + aRbAssign2.Disable(); } aBtnRemove.Disable(); return 0; @@ -1185,46 +1202,23 @@ IMPL_LINK( ScColRowNameRangesDlg, RowClickHdl, void *, EMPTYARG ) } -/************************************************************************* -#* Handler: EdGetFocusHdl Datum:04.09.97 -#*------------------------------------------------------------------------ -#* -#* Klasse: ScColRowNameRangesDlg -#* -#* Funktion: Wird ausgeloest, wenn das Fenster einen Focus -#* erhaelt. -#* Input: --- -#* -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( ScColRowNameRangesDlg, EdGetFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScColRowNameRangesDlg, GetFocusHdl, Control*, pCtrl ) { - pEdActive = pEd; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); - pEd->SetSelection( Selection(0,SELECTION_MAX) ); + if( (pCtrl == (Control*)&aEdAssign) || (pCtrl == (Control*)&aRbAssign) ) + pEdActive = &aEdAssign; + else if( (pCtrl == (Control*)&aEdAssign2) || (pCtrl == (Control*)&aRbAssign2) ) + pEdActive = &aEdAssign2; + else + pEdActive = NULL; + + if( pEdActive ) + pEdActive->SetSelection( Selection( 0, SELECTION_MAX ) ); + return 0; } -/************************************************************************* -#* Handler: EdLoseFocusHdl Datum:04.09.97 -#*------------------------------------------------------------------------ -#* -#* Klasse: ScColRowNameRangesDlg -#* -#* Funktion: Wird ausgeloest, wenn das Fenster seinen Focus -#* verliert. -#* -#* Input: --- -#* -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( ScColRowNameRangesDlg, EdLoseFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScColRowNameRangesDlg, LoseFocusHdl, Control*, pCtrl ) { bDlgLostFocus = !IsActive(); return 0; diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index a2edfe0d0197..845fb6e82e32 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: solvrdlg.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: nn $ $Date: 2001-07-30 15:49:01 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:44:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,21 +139,25 @@ void __EXPORT ScSolverDlg::Init() aBtnOk. SetClickHdl ( LINK( this, ScSolverDlg, BtnHdl ) ); aBtnCancel. SetClickHdl ( LINK( this, ScSolverDlg, BtnHdl ) ); - aEdFormulaCell. SetGetFocusHdl ( LINK( this, ScSolverDlg, EdGetFocusHdl ) ); - aEdVariableCell.SetGetFocusHdl ( LINK( this, ScSolverDlg, EdGetFocusHdl ) ); - aEdTargetVal. SetGetFocusHdl ( LINK( this, ScSolverDlg, EdGetFocusHdl ) ); - aEdFormulaCell. SetLoseFocusHdl ( LINK( this, ScSolverDlg, EdLoseFocusHdl ) ); - aEdVariableCell.SetLoseFocusHdl ( LINK( this, ScSolverDlg, EdLoseFocusHdl ) ); + + Link aLink = LINK( this, ScSolverDlg, GetFocusHdl ); + aEdFormulaCell. SetGetFocusHdl ( aLink ); + aRBFormulaCell. SetGetFocusHdl ( aLink ); + aEdVariableCell.SetGetFocusHdl ( aLink ); + aRBVariableCell.SetGetFocusHdl ( aLink ); + aEdTargetVal. SetGetFocusHdl ( aLink ); + + aLink = LINK( this, ScSolverDlg, LoseFocusHdl ); + aEdFormulaCell. SetLoseFocusHdl ( aLink ); + aRBFormulaCell. SetLoseFocusHdl ( aLink ); + aEdVariableCell.SetLoseFocusHdl ( aLink ); + aRBVariableCell.SetLoseFocusHdl ( aLink ); theFormulaCell.Format( aStr, SCA_ABS ); aEdFormulaCell.SetText( aStr ); aEdFormulaCell.GrabFocus(); pEdActive = &aEdFormulaCell; - bMouseInputMode = TRUE; - - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); } //---------------------------------------------------------------------------- @@ -167,10 +171,11 @@ BOOL __EXPORT ScSolverDlg::Close() void ScSolverDlg::SetActive() { - if ( bDlgLostFocus && bMouseInputMode ) + if ( bDlgLostFocus ) { bDlgLostFocus = FALSE; - pEdActive->GrabFocus(); + if( pEdActive ) + pEdActive->GrabFocus(); } else { @@ -183,7 +188,7 @@ void ScSolverDlg::SetActive() void ScSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDoc ) { - if ( bMouseInputMode && pEdActive ) + if( pEdActive ) { if ( rRef.aStart != rRef.aEnd ) RefInputStart(pEdActive); @@ -234,6 +239,13 @@ void ScSolverDlg::RaiseError( ScSolverErr eError ) //---------------------------------------------------------------------------- +BOOL ScSolverDlg::IsRefInputMode() const +{ + return pEdActive != NULL; +} + +//---------------------------------------------------------------------------- + BOOL __EXPORT ScSolverDlg::CheckTargetValue( String& rStrVal ) { ULONG n1 = 0; @@ -304,26 +316,27 @@ IMPL_LINK( ScSolverDlg, BtnHdl, PushButton*, pBtn ) //---------------------------------------------------------------------------- -IMPL_LINK( ScSolverDlg, EdGetFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScSolverDlg, GetFocusHdl, Control*, pCtrl ) { - pEdActive = pEd; - bMouseInputMode = ( pEd != &aEdTargetVal ); + Edit* pEdit = NULL; + pEdActive = NULL; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - /* - if ( bMouseInputMode ) - SFX_APPWINDOW->Enable(); - else - SFX_APPWINDOW->Disable(FALSE); //! allgemeine Methode im ScAnyRefDlg - */ - pEd->SetSelection( Selection(0,SELECTION_MAX) ); + if( (pCtrl == (Control*)&aEdFormulaCell) || (pCtrl == (Control*)&aRBFormulaCell) ) + pEdit = pEdActive = &aEdFormulaCell; + else if( (pCtrl == (Control*)&aEdVariableCell) || (pCtrl == (Control*)&aRBVariableCell) ) + pEdit = pEdActive = &aEdVariableCell; + else if( pCtrl == (Control*)&aEdTargetVal ) + pEdit = &aEdTargetVal; + + if( pEdit ) + pEdit->SetSelection( Selection( 0, SELECTION_MAX ) ); return NULL; } //---------------------------------------------------------------------------- -IMPL_LINK( ScSolverDlg, EdLoseFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScSolverDlg, LoseFocusHdl, Control*, pCtrl ) { bDlgLostFocus = !IsActive(); return NULL; diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index 798ce4bdccad..16cfddd0ef35 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabopdlg.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-07-05 14:12:33 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:44:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,12 +136,22 @@ void __EXPORT ScTabOpDlg::Init() { aBtnOk. SetClickHdl ( LINK( this, ScTabOpDlg, BtnHdl ) ); aBtnCancel. SetClickHdl ( LINK( this, ScTabOpDlg, BtnHdl ) ); - aEdFormulaRange.SetGetFocusHdl ( LINK( this, ScTabOpDlg, EdGetFocusHdl ) ); - aEdRowCell. SetGetFocusHdl ( LINK( this, ScTabOpDlg, EdGetFocusHdl ) ); - aEdColCell. SetGetFocusHdl ( LINK( this, ScTabOpDlg, EdGetFocusHdl ) ); - aEdFormulaRange.SetLoseFocusHdl ( LINK( this, ScTabOpDlg, EdLoseFocusHdl ) ); - aEdRowCell. SetLoseFocusHdl ( LINK( this, ScTabOpDlg, EdLoseFocusHdl ) ); - aEdColCell. SetLoseFocusHdl ( LINK( this, ScTabOpDlg, EdLoseFocusHdl ) ); + + Link aLink = LINK( this, ScTabOpDlg, GetFocusHdl ); + aEdFormulaRange.SetGetFocusHdl( aLink ); + aRBFormulaRange.SetGetFocusHdl( aLink ); + aEdRowCell. SetGetFocusHdl( aLink ); + aRBRowCell. SetGetFocusHdl( aLink ); + aEdColCell. SetGetFocusHdl( aLink ); + aRBColCell. SetGetFocusHdl( aLink ); + + aLink = LINK( this, ScTabOpDlg, LoseFocusHdl ); + aEdFormulaRange.SetLoseFocusHdl( aLink ); + aRBFormulaRange.SetLoseFocusHdl( aLink ); + aEdRowCell. SetLoseFocusHdl( aLink ); + aRBRowCell. SetLoseFocusHdl( aLink ); + aEdColCell. SetLoseFocusHdl( aLink ); + aRBColCell. SetLoseFocusHdl( aLink ); aEdFormulaRange.GrabFocus(); pEdActive = &aEdFormulaRange; @@ -164,7 +174,8 @@ void ScTabOpDlg::SetActive() if ( bDlgLostFocus ) { bDlgLostFocus = FALSE; - pEdActive->GrabFocus(); + if( pEdActive ) + pEdActive->GrabFocus(); } else GrabFocus(); @@ -366,18 +377,26 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, PushButton*, pBtn ) //---------------------------------------------------------------------------- -IMPL_LINK( ScTabOpDlg, EdGetFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScTabOpDlg, GetFocusHdl, Control*, pCtrl ) { - pEdActive = pEd; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); - pEd->SetSelection( Selection(0,SELECTION_MAX) ); + if( (pCtrl == (Control*)&aEdFormulaRange) || (pCtrl == (Control*)&aRBFormulaRange) ) + pEdActive = &aEdFormulaRange; + else if( (pCtrl == (Control*)&aEdRowCell) || (pCtrl == (Control*)&aRBRowCell) ) + pEdActive = &aEdRowCell; + else if( (pCtrl == (Control*)&aEdColCell) || (pCtrl == (Control*)&aRBColCell) ) + pEdActive = &aEdColCell; + else + pEdActive == NULL; + + if( pEdActive ) + pEdActive->SetSelection( Selection( 0, SELECTION_MAX ) ); + return 0; } //---------------------------------------------------------------------------- -IMPL_LINK( ScTabOpDlg, EdLoseFocusHdl, ScRefEdit*, pEd ) +IMPL_LINK( ScTabOpDlg, LoseFocusHdl, Control*, pCtrl ) { bDlgLostFocus = !IsActive(); return 0; diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index c530c0d0f66e..6763305e1b76 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: areasdlg.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: nn $ $Date: 2001-07-05 14:15:31 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:44:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -227,6 +227,7 @@ void ScPrintAreasDlg::SetReference( const ScRange& rRef, ScDocument* pDoc ) String aVal = aEdPrintArea.GetText(); Selection aSel = aEdPrintArea.GetSelection(); + aSel.Justify(); aVal.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); aVal.Insert( aStr, (xub_StrLen)aSel.Min() ); Selection aNewSel( aSel.Min(), aSel.Min()+aStr.Len() ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index ccc5903261da..404fe585137d 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: gridwin.cxx,v $ * - * $Revision: 1.28 $ + * $Revision: 1.29 $ * - * last change: $Author: nn $ $Date: 2002-01-22 17:46:45 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:45:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2362,8 +2362,26 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt ) void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt) { + // #96965# Cursor control for ref input dialog + if( SC_MOD()->IsRefDialogOpen() ) + { + const KeyCode& rKeyCode = rKEvt.GetKeyCode(); + if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) + { + SC_MOD()->EndReference(); + return; + } + else if( pViewData->GetViewShell()->MoveCursorKeyInput( rKEvt ) ) + { + ScRange aRef( + pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(), + pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() ); + SC_MOD()->SetReference( aRef, pViewData->GetDocument() ); + return; + } + } // wenn semi-Modeless-SfxChildWindow-Dialog oben, keine KeyInputs: - if ( !SC_MOD()->IsRefDialogOpen() && !pViewData->IsAnyFillMode() ) + else if( !pViewData->IsAnyFillMode() ) { ScTabViewShell* pViewSh = pViewData->GetViewShell(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 1189fd807736..e2c487b7c088 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabview3.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: sab $ $Date: 2002-03-12 09:28:58 $ + * last change: $Author: dr $ $Date: 2002-03-13 11:45:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1257,6 +1257,70 @@ void ScTabView::MoveCursorEnter( BOOL bShift ) // bShift -> hoch/runter } } + +BOOL ScTabView::MoveCursorKeyInput( const KeyEvent& rKeyEvent ) +{ + const KeyCode& rKCode = rKeyEvent.GetKeyCode(); + + enum { MOD_NONE, MOD_CTRL, MOD_ALT, MOD_BOTH } eModifier = + rKCode.IsMod1() ? + (rKCode.IsMod2() ? MOD_BOTH : MOD_CTRL) : + (rKCode.IsMod2() ? MOD_ALT : MOD_NONE); + + BOOL bSel = rKCode.IsShift(); + USHORT nCode = rKCode.GetCode(); + + // CURSOR keys + short nDX = 0; + short nDY = 0; + switch( nCode ) + { + case KEY_LEFT: nDX = -1; break; + case KEY_RIGHT: nDX = 1; break; + case KEY_UP: nDY = -1; break; + case KEY_DOWN: nDY = 1; break; + } + if( nDX || nDY ) + { + switch( eModifier ) + { + case MOD_NONE: MoveCursorRel( nDX, nDY, SC_FOLLOW_LINE, bSel ); break; + case MOD_CTRL: MoveCursorArea( nDX, nDY, SC_FOLLOW_JUMP, bSel ); break; + } + // always TRUE to suppress changes of col/row size (ALT+CURSOR) + return TRUE; + } + + // PAGEUP/PAGEDOWN + if( (nCode == KEY_PAGEUP) || (nCode == KEY_PAGEDOWN) ) + { + nDX = (nCode == KEY_PAGEUP) ? -1 : 1; + switch( eModifier ) + { + case MOD_NONE: MoveCursorPage( 0, nDX, SC_FOLLOW_FIX, bSel ); break; + case MOD_ALT: MoveCursorPage( nDX, 0, SC_FOLLOW_FIX, bSel ); break; + case MOD_CTRL: SelectNextTab( nDX ); break; + } + return TRUE; + } + + // HOME/END + if( (nCode == KEY_HOME) || (nCode == KEY_END) ) + { + nDX = (nCode == KEY_HOME) ? -1 : 1; + ScFollowMode eMode = (nCode == KEY_HOME) ? SC_FOLLOW_LINE : SC_FOLLOW_JUMP; + switch( eModifier ) + { + case MOD_NONE: MoveCursorEnd( nDX, 0, eMode, bSel ); break; + case MOD_CTRL: MoveCursorEnd( nDX, nDX, eMode, bSel ); break; + } + return TRUE; + } + + return FALSE; +} + + // naechste/vorherige nicht geschuetzte Zelle void ScTabView::FindNextUnprot( BOOL bShift, BOOL bInSelection ) { |