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/view/cellsh1.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/view/cellsh1.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 66 |
1 files changed, 50 insertions, 16 deletions
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; |