summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-12-02 20:33:12 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-12-03 03:56:11 +0100
commit06842a8583d3d77de74964cdce4fba811818bf90 (patch)
treec13e9482ed888608c73f8e62510e95232441cdcf /sc
parent99e31f6ead140594deb98fa8e794708403b8113d (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')
-rw-r--r--sc/inc/scmod.hxx7
-rw-r--r--sc/source/ui/app/scdll.cxx3
-rw-r--r--sc/source/ui/app/scmod.cxx57
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx26
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx5
-rw-r--r--sc/source/ui/formdlg/formula.cxx4
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx27
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx4
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx2
-rw-r--r--sc/source/ui/inc/formula.hxx2
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/inc/reffact.hxx3
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx23
-rw-r--r--sc/source/ui/src/condformatdlg.src2
-rw-r--r--sc/source/ui/view/cellsh1.cxx66
-rw-r--r--sc/source/ui/view/gridwin.cxx10
-rw-r--r--sc/source/ui/view/reffact.cxx21
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh.cxx3
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx2
-rw-r--r--sc/source/ui/view/tabvwshc.cxx53
21 files changed, 190 insertions, 134 deletions
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 521d8219412a..2e7584a8d56f 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -41,6 +41,7 @@
#include <map>
#include <list>
#include <algorithm>
+#include <stack>
class KeyEvent;
@@ -81,6 +82,7 @@ class ScFormEditData;
class ScMarkData;
struct ScDragData;
struct ScClipData;
+class ScAnyRefModalDlg;
//==================================================================
@@ -124,6 +126,7 @@ class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
bool mbIsInSharedDocSaving:1;
std::map<sal_uInt16, std::list<Window*> > m_mapRefWindow;
+ std::stack<ScAnyRefModalDlg*> maAnyRefDlgStack;
public:
SFX_DECL_INTERFACE(SCID_APP)
@@ -262,6 +265,10 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
SC_DLLPUBLIC sal_Bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
SC_DLLPUBLIC sal_Bool IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd );
SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor );
+
+ ScAnyRefModalDlg* GetCurrentAnyRefDlg();
+ void PushNewAnyRefDlg( ScAnyRefModalDlg* pDlg );
+ void PopAnyRefDlg();
};
#define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 9c06371b567b..44b0e309cb98 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -260,9 +260,6 @@ void ScDLL::Init()
ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
- ScCondFormatConditionDlgWrapper ::RegisterChildWindow(false, pMod);
- ScCondFormatColorScaleDlgWrapper ::RegisterChildWindow(false, pMod);
- ScCondFormatDataBarDlgWrapper ::RegisterChildWindow(false, pMod);
ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod);
ScTabOpDlgWrapper ::RegisterChildWindow(false, pMod);
ScFilterDlgWrapper ::RegisterChildWindow(false, pMod);
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: */
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 8780647c9c6b..78214aabb0f3 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -355,9 +355,9 @@ IMPL_LINK_NOARG( ScCondFormatList, ScrollHdl )
//ScCondFormatDlg
//---------------------------------------------------
-ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange,
+ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange,
const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType):
- ScAnyRefDlg(pB, pCW, pParent, RID_SCDLG_CONDFORMAT ),
+ ScAnyRefModalDlg(pParent, ScResId(RID_SCDLG_CONDFORMAT) ),
maBtnAdd( this, ScResId( BTN_ADD ) ),
maBtnRemove( this, ScResId( BTN_REMOVE ) ),
maBtnOk( this, ScResId( BTN_OK ) ),
@@ -388,10 +388,13 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* p
FreeResource();
maEdRange.SetText(aRangeString);
+
+ SC_MOD()->PushNewAnyRefDlg(this);
}
ScCondFormatDlg::~ScCondFormatDlg()
{
+ SC_MOD()->PopAnyRefDlg();
}
void ScCondFormatDlg::SetActive()
@@ -406,7 +409,7 @@ void ScCondFormatDlg::SetActive()
void ScCondFormatDlg::RefInputDone( sal_Bool bForced )
{
- ScAnyRefDlg::RefInputDone(bForced);
+ ScAnyRefModalDlg::RefInputDone(bForced);
}
sal_Bool ScCondFormatDlg::IsTableLocked() const
@@ -483,21 +486,8 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit )
sal_Bool ScCondFormatDlg::Close()
{
- sal_uInt16 nId = 0;
- switch(meType)
- {
- case condformat::dialog::NONE:
- case condformat::dialog::CONDITION:
- nId = ScCondFormatConditionDlgWrapper::GetChildWindowId();
- break;
- case condformat::dialog::COLORSCALE:
- nId = ScCondFormatColorScaleDlgWrapper::GetChildWindowId();
- break;
- case condformat::dialog::DATABAR:
- nId = ScCondFormatDataBarDlgWrapper::GetChildWindowId();
- break;
- }
-
+ sal_uInt16 nId = 1;
+ EndDialog();
return DoClose(nId);
}
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 8039738e61cf..b8fb97231ff3 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -193,6 +193,11 @@ ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
delete mpFormatList;
}
+bool ScCondFormatManagerDlg::IsInRefMode() const
+{
+ return true;
+}
+
ScConditionalFormatList* ScCondFormatManagerDlg::GetConditionalFormatList()
{
ScConditionalFormatList* pList = mpFormatList;
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 4c01577df640..b8682d055482 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -526,9 +526,9 @@ void ScFormulaDlg::HideReference( sal_Bool bDoneRefMode )
{
m_aHelper.HideReference(bDoneRefMode);
}
-void ScFormulaDlg::ViewShellChanged( ScTabViewShell* pScViewShell )
+void ScFormulaDlg::ViewShellChanged()
{
- m_aHelper.ViewShellChanged( pScViewShell );
+ m_aHelper.ViewShellChanged();
}
void ScFormulaDlg::AddRefEntry( )
{
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 8b66f68f2a05..b95aa084a26f 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -190,8 +190,21 @@ public:
//============================================================================
+
+class ScRefHdlModalImpl : public ModalDialog, public ScRefHandler
+{
+public:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+protected:
+ ScRefHdlModalImpl( Window* pParent, ResId& rResId );
+
+private:
+};
+
template< class TWindow, bool bBindRef = true >
-class ScRefHdlrImplBase:public TWindow, public ScRefHandler
+class ScRefHdlrImplBase: public TWindow, public ScRefHandler
{
public:
//Overwrite TWindow
@@ -238,14 +251,20 @@ void ScRefHdlrImplBase<TWindow, bBindRef>::StateChanged( StateChangedType nState
ScRefHandler::stateChanged( nStateChange, bBindRef );
}
+class ScAnyRefModalDlg : public ScRefHdlModalImpl
+{
+public:
+ ScAnyRefModalDlg(Window* pParent, ResId rResId);
+};
+
//============================================================================
template<class TDerived, class TBase, bool bBindRef = true>
-struct ScRefHdlrImpl: ScRefHdlrImplBase<TBase, bBindRef >
+struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef >
{
enum { UNKNOWN_SLOTID = 0U, SLOTID = UNKNOWN_SLOTID };
template<class T1, class T2, class T3, class T4>
- ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3 & rt3, const T4 & rt4 ):ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4 )
+ ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ):ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4 )
{
SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( static_cast<TDerived*>(this)->SLOTID ), this );
}
@@ -259,7 +278,7 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase<TBase, bBindRef >
struct ScAnyRefDlg : ::ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>
{
template<class T1, class T2, class T3, class T4>
- ScAnyRefDlg( const T1 & rt1, const T2 & rt2, const T3 & rt3, const T4 & rt4 ):ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>(rt1, rt2, rt3, rt4){}
+ ScAnyRefDlg( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ):ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>(rt1, rt2, rt3, rt4){}
};
//============================================================================
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 194d60caca6b..f5c3e253c0d9 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -96,7 +96,7 @@ public:
DECL_LINK( ColFormatTypeHdl, ListBox*);
};
-class ScCondFormatDlg : public ScAnyRefDlg
+class ScCondFormatDlg : public ScAnyRefModalDlg
{
private:
PushButton maBtnAdd;
@@ -129,7 +129,7 @@ protected:
public:
- ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pSW, Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
+ ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
virtual ~ScCondFormatDlg();
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index cb41d20b0900..c13ff6b60917 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -87,6 +87,8 @@ public:
bool CondFormatsChanged();
+ virtual bool IsInRefMode() const;
+
private:
PushButton maBtnAdd;
PushButton maBtnRemove;
diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx
index 8fcc1048d434..04c2ba5e4017 100644
--- a/sc/source/ui/inc/formula.hxx
+++ b/sc/source/ui/inc/formula.hxx
@@ -110,7 +110,7 @@ public:
virtual sal_Bool IsDocAllowed( SfxObjectShell* pDocSh ) const;
virtual void AddRefEntry();
virtual void SetActive();
- virtual void ViewShellChanged( ScTabViewShell* pScViewShell );
+ virtual void ViewShellChanged();
protected:
virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index fdd7b2e689a0..8c5833a180aa 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -392,6 +392,8 @@ public:
void UpdateShrinkOverlay();
void UpdateAllOverlays();
+ virtual bool IsInRefMode() const { return true; }
+
protected:
// #114409#
void ImpCreateOverlayObjects();
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index 447383bace73..19a08c514bb5 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -45,9 +45,6 @@
DECL_WRAPPER_WITHID(ScNameDlgWrapper)
DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
-DECL_WRAPPER_WITHID(ScCondFormatConditionDlgWrapper)
-DECL_WRAPPER_WITHID(ScCondFormatColorScaleDlgWrapper)
-DECL_WRAPPER_WITHID(ScCondFormatDataBarDlgWrapper)
DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 3b4e9a485ac6..9595cf37b08c 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -831,7 +831,7 @@ void ScRefHandler::SetDispatcherLock( bool bLock )
//----------------------------------------------------------------------------
-void ScRefHandler::ViewShellChanged(ScTabViewShell* pScViewShell )
+void ScRefHandler::ViewShellChanged()
{
m_aHelper.ViewShellChanged(pScViewShell);
}
@@ -937,4 +937,25 @@ void ScRefHandler::RefInputDone( sal_Bool bForced )
m_aHelper.RefInputDone( bForced );
}
+//-------------------------------------------------------------------------------
+
+ScRefHdlModalImpl::ScRefHdlModalImpl( Window* pParent, ResId& rResId ):
+ ModalDialog( pParent, rResId ),
+ ScRefHandler(dynamic_cast<Window&>(*this), NULL, true) {}
+
+long ScRefHdlModalImpl::PreNotify( NotifyEvent& rNEvt )
+{
+ ScRefHandler::preNotify( rNEvt, true );
+ return ModalDialog::PreNotify( rNEvt );
+}
+
+void ScRefHdlModalImpl::StateChanged( StateChangedType nStateChange )
+{
+ ModalDialog::StateChanged( nStateChange );
+ ScRefHandler::stateChanged( nStateChange, true );
+}
+
+ScAnyRefModalDlg::ScAnyRefModalDlg( Window* pParent, ResId aResId ):
+ ScRefHdlModalImpl( pParent, aResId ) {}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index e0a5f25905ed..22ca8fee43ba 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -28,7 +28,7 @@
#include "condformatdlg.hrc"
-ModelessDialog RID_SCDLG_CONDFORMAT
+ModalDialog RID_SCDLG_CONDFORMAT
{
OutputSize = TRUE;
Hide = TRUE;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 426e8033c68e..e8122b3b3063 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -83,6 +83,7 @@
#include "cliputil.hxx"
#include "markdata.hxx"
#include "docpool.hxx"
+#include "condformatdlg.hxx"
#include "globstr.hrc"
#include "scui_def.hxx"
@@ -1769,25 +1770,58 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_OPENDLG_COLORSCALE:
case SID_OPENDLG_DATABAR:
{
- sal_uInt16 nId = 0;
- switch( nSlot )
+ sal_uInt16 nId = 1;
+
+ pScMod->SetRefDialog( nId, true );
+
+ ScRangeList aRangeList;
+ ScViewData* pData = GetViewData();
+ pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false);
+
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ if(pDoc->IsTabProtected(pData->GetTabNo()))
{
- case SID_OPENDLG_CONDFRMT:
- nId = ScCondFormatConditionDlgWrapper::GetChildWindowId();
- break;
- case SID_OPENDLG_COLORSCALE:
- nId = ScCondFormatColorScaleDlgWrapper::GetChildWindowId();
- break;
- case SID_OPENDLG_DATABAR:
- nId = ScCondFormatDataBarDlgWrapper::GetChildWindowId();
- break;
- default:
- break;
+ //ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
+ break;
+ }
+
+ ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo());
+ if(aRangeList.empty())
+ {
+ ScRange* pRange = new ScRange(aPos);
+ aRangeList.push_back(pRange);
+ }
+
+ const ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
+ ScCondFormatDlg* pCondFormatDlg = NULL;
+ if(pCondFormat)
+ {
+ const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
+ if(rCondFormatRange == aRangeList)
+ pCondFormatDlg = new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE );
+ }
+
+ if(!pCondFormatDlg)
+ {
+ condformat::dialog::ScCondFormatDialogType eType = condformat::dialog::NONE;
+ switch(nSlot)
+ {
+ case SID_OPENDLG_CONDFRMT:
+ eType = condformat::dialog::CONDITION;
+ break;
+ case SID_OPENDLG_COLORSCALE:
+ eType = condformat::dialog::COLORSCALE;
+ break;
+ case SID_OPENDLG_DATABAR:
+ eType = condformat::dialog::DATABAR;
+ break;
+ default:
+ break;
+ }
+ pCondFormatDlg = new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType );
+ pCondFormatDlg->Execute();
}
- SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
- SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
- pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
}
break;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 247ff7385c26..58fa2f8b6ff1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1727,6 +1727,7 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
+ std::cout << "MouseButtonDown" << std::endl;
nNestedButtonState = SC_NESTEDBUTTON_DOWN;
HandleMouseButtonDown( rMEvt );
@@ -2042,6 +2043,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt )
void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
+ std::cout << "MouseButtonUp" << std::endl;
aCurMousePos = rMEvt.GetPosPixel();
ScDocument* pDoc = pViewData->GetDocument();
ScMarkData& rMark = pViewData->GetMarkData();
@@ -2470,8 +2472,14 @@ void ScGridWindow::FakeButtonUp()
}
}
+#include <stdio.h>
+
void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
{
+ fprintf( stderr, "MouseMove: %s %d %d %d\n",
+ rMEvt.IsSynthetic() ? "synthetic" : "real",
+ rMEvt.GetMode(), rMEvt.GetModifier(), rMEvt.GetButtons() );
+
aCurMousePos = rMEvt.GetPosPixel();
if ( rMEvt.IsLeaveWindow() && pNoteMarker && !pNoteMarker->IsByKeyboard() )
@@ -2749,7 +2757,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt )
if ( rTEvt.IsTrackingCanceled() ) // alles abbrechen...
{
- if (!pViewData->GetView()->IsInActivatePart())
+ if (!pViewData->GetView()->IsInActivatePart() && !SC_MOD()->IsRefDialogOpen())
{
if (bDPMouse)
bDPMouse = false; // gezeichnet wird per bDragRect
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 052fcaf3acc9..a7cebc498883 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -44,9 +44,6 @@
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatConditionDlgWrapper, SID_OPENDLG_CONDFRMT )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatColorScaleDlgWrapper, SID_OPENDLG_COLORSCALE )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatDataBarDlgWrapper, SID_OPENDLG_DATABAR )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
@@ -121,24 +118,6 @@ IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
//-------------------------------------------------------------------------
-// ScCondFormatConditionDlgWrapper
-//-------------------------------------------------------------------------
-
-IMPL_CHILD_CTOR( ScCondFormatConditionDlgWrapper, SID_OPENDLG_CONDFRMT )
-
-//-------------------------------------------------------------------------
-// ScCondFormatColorScaleDlgWrapper
-//-------------------------------------------------------------------------
-
-IMPL_CHILD_CTOR( ScCondFormatColorScaleDlgWrapper, SID_OPENDLG_COLORSCALE )
-
-//-------------------------------------------------------------------------
-// ScCondFormatDataBarDlgWrapper
-//-------------------------------------------------------------------------
-
-IMPL_CHILD_CTOR( ScCondFormatDataBarDlgWrapper, SID_OPENDLG_DATABAR )
-
-//-------------------------------------------------------------------------
// ScSolverDlgWrapper
//-------------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index f31cddc3a6b3..7b10ecc85cec 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1741,7 +1741,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- pRefDlg->ViewShellChanged(NULL);
+ pRefDlg->ViewShellChanged();
}
}
}
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 75f383686220..893f2512a04a 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -65,9 +65,6 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScNameDefDlgWrapper::GetChildWindowId());
- SFX_CHILDWINDOW_REGISTRATION(ScCondFormatConditionDlgWrapper::GetChildWindowId());
- SFX_CHILDWINDOW_REGISTRATION(ScCondFormatColorScaleDlgWrapper::GetChildWindowId());
- SFX_CHILDWINDOW_REGISTRATION(ScCondFormatDataBarDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScXMLSourceDlgWrapper::GetChildWindowId());
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 595a93f319f0..94314f62deee 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -210,7 +210,7 @@ void ScTabViewShell::Activate(sal_Bool bMDI)
if ( pChildWnd )
{
IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
- pRefDlg->ViewShellChanged(this);
+ pRefDlg->ViewShellChanged();
}
}
}
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 289e60595d02..d3c57d680283 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -182,59 +182,6 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
- case SID_OPENDLG_CONDFRMT:
- case SID_OPENDLG_COLORSCALE:
- case SID_OPENDLG_DATABAR:
- {
- ScRangeList aRangeList;
- ScViewData* pData = GetViewData();
- pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false);
-
- if(pDoc->IsTabProtected(pData->GetTabNo()))
- {
- ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
- break;
- }
-
- ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo());
- if(aRangeList.empty())
- {
- ScRange* pRange = new ScRange(aPos);
- aRangeList.push_back(pRange);
- }
-
- const ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
- condformat::dialog::ScCondFormatDialogType eType = condformat::dialog::NONE;
- switch(nSlotId)
- {
- case SID_OPENDLG_CONDFRMT:
- eType = condformat::dialog::CONDITION;
- break;
- case SID_OPENDLG_COLORSCALE:
- eType = condformat::dialog::COLORSCALE;
- break;
- case SID_OPENDLG_DATABAR:
- eType = condformat::dialog::DATABAR;
- break;
- default:
- break;
- }
-
- if(pCondFormat)
- {
- const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
- if(rCondFormatRange == aRangeList)
- pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, pCondFormat, rCondFormatRange, aPos, eType );
- }
-
- if(!pResult)
- {
- pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType );
- }
- }
-
- break;
-
case SID_DEFINE_COLROWNAMERANGES:
{
pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, GetViewData() );