diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-02 20:33:12 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-03 03:56:11 +0100 |
commit | 06842a8583d3d77de74964cdce4fba811818bf90 (patch) | |
tree | c13e9482ed888608c73f8e62510e95232441cdcf /sc/source/ui/app/scmod.cxx | |
parent | 99e31f6ead140594deb98fa8e794708403b8113d (diff) |
first working version of modal ref input dlgs
The following things still need to be changed:
* don't use virtual method in Window
* Use a WinBits flag for it
* move all the dialogs to it
* fix the ugly hack for range name dlg
* fix all the uncommented code in winproc.cxx
* general clean-up
Change-Id: I2a8cfc1c4abf591878b11aa4829a9ff910540eff
Diffstat (limited to 'sc/source/ui/app/scmod.cxx')
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 2dd115894d5f..d8d350c5af2e 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -42,6 +42,7 @@ #include <sfx2/objface.hxx> #include "IAnyRefDialog.hxx" +#include "anyrefdg.hxx" #include <svtools/ehdl.hxx> #include <svtools/accessibilityoptions.hxx> @@ -1656,12 +1657,17 @@ sal_Bool ScModule::IsModalMode(SfxObjectShell* pDocSh) if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); if ( pChildWnd ) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); bIsModal = pChildWnd->IsVisible() && !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) ); } + else if(pModalDlg) + { + bIsModal = pModalDlg->IsVisible() && !(pModalDlg->IsRefInputMode() && pModalDlg->IsDocAllowed(pDocSh) ); + } else { // in 592 and above, the dialog isn't visible in other views @@ -1695,8 +1701,11 @@ sal_Bool ScModule::IsTableLocked() if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); if ( pChildWnd ) bLocked = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())->IsTableLocked(); + else if( pModalDlg ) + bLocked = pModalDlg->IsTableLocked(); else bLocked = sal_True; // for other views, see IsModalMode } @@ -1714,8 +1723,11 @@ sal_Bool ScModule::IsRefDialogOpen() if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); if ( pChildWnd ) bIsOpen = pChildWnd->IsVisible(); + else if(pModalDlg) + bIsOpen = pModalDlg->IsVisible(); else bIsOpen = sal_True; // for other views, see IsModalMode } @@ -1733,11 +1745,18 @@ sal_Bool ScModule::IsFormulaMode() if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); if ( pChildWnd ) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); bIsFormula = pChildWnd->IsVisible() && pRefDlg->IsRefInputMode(); } + else if(pModalDlg) + { + bIsFormula = pModalDlg->IsVisible() && pModalDlg->IsRefInputMode(); + } + else + bIsFormula = true; } else { @@ -1776,7 +1795,8 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc, if( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); - OSL_ENSURE( pChildWnd, "NoChildWin" ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); + OSL_ENSURE( pChildWnd || pModalDlg, "NoChildWin" ); if ( pChildWnd ) { if ( nCurRefDlgId == SID_OPENDLG_CONSOLIDATE && pMarkData ) @@ -1795,6 +1815,13 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc, pRefDlg->HideReference( false ); pRefDlg->SetReference( aNew, pDoc ); } + else if(pModalDlg) + { + // hide the (color) selection now instead of later from LoseFocus, + // don't abort the ref input that causes this call (bDoneRefMode = sal_False) + pModalDlg->HideReference( false ); + pModalDlg->SetReference( aNew, pDoc ); + } } else { @@ -1816,12 +1843,15 @@ void ScModule::AddRefEntry() // "Mehrfachselektion" if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); - OSL_ENSURE( pChildWnd, "NoChildWin" ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); + OSL_ENSURE( pChildWnd || pModalDlg, "NoChildWin" ); if ( pChildWnd ) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); pRefDlg->AddRefEntry(); } + else if(pModalDlg) + pModalDlg->AddRefEntry(); } else { @@ -1843,12 +1873,15 @@ void ScModule::EndReference() if ( nCurRefDlgId ) { SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); - OSL_ENSURE( pChildWnd, "NoChildWin" ); + ScAnyRefModalDlg* pModalDlg = GetCurrentAnyRefDlg(); + OSL_ENSURE( pChildWnd || pModalDlg, "NoChildWin" ); if ( pChildWnd ) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); pRefDlg->SetActive(); } + else + pModalDlg->SetActive(); } } @@ -2281,4 +2314,22 @@ Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor ) return NULL; } +ScAnyRefModalDlg* ScModule::GetCurrentAnyRefDlg() +{ + if(!maAnyRefDlgStack.empty()) + return maAnyRefDlgStack.top(); + + return NULL; +} + +void ScModule::PushNewAnyRefDlg( ScAnyRefModalDlg* pNewDlg ) +{ + maAnyRefDlgStack.push( pNewDlg ); +} + +void ScModule::PopAnyRefDlg() +{ + maAnyRefDlgStack.pop(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |