diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-07 01:18:43 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-09 06:33:16 +0200 |
commit | ffadab26d62a24f3a142c497669db5a933ba1251 (patch) | |
tree | e252350606d42542ca667f0e128a1f98ff7f69f3 | |
parent | d540c322cce4f00418466cf7715ecc2c2f1e95c5 (diff) |
make ScCondFormatDlg a ScAnyRefDlg
Change-Id: I4e04a1f34dd958922e9856294639de7bf40249e4
-rw-r--r-- | sc/Library_sc.mk | 3 | ||||
-rw-r--r-- | sc/Library_scui.mk | 3 | ||||
-rw-r--r-- | sc/inc/scabstdlg.hxx | 15 | ||||
-rw-r--r-- | sc/sdi/cellsh.sdi | 2 | ||||
-rw-r--r-- | sc/source/ui/app/scdll.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 52 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 19 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 38 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 13 | ||||
-rw-r--r-- | sc/source/ui/inc/condformathelper.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/reffact.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/src/condformatdlg.src | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 92 | ||||
-rw-r--r-- | sc/source/ui/view/reffact.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshc.cxx | 56 |
17 files changed, 131 insertions, 190 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 9bc420fdbde0..f7c73d7c1cad 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -329,6 +329,9 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/cctrl/popmenu \ sc/source/ui/cctrl/tbinsert \ sc/source/ui/cctrl/tbzoomsliderctrl \ + sc/source/ui/condformat/condformatdlg \ + sc/source/ui/condformat/condformathelper \ + sc/source/ui/condformat/colorformat \ sc/source/ui/dbgui/asciiopt \ sc/source/ui/dbgui/consdlg \ sc/source/ui/dbgui/csvcontrol \ diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk index 92017d058f75..b1eb7720f247 100644 --- a/sc/Library_scui.mk +++ b/sc/Library_scui.mk @@ -63,9 +63,6 @@ $(eval $(call gb_Library_add_exception_objects,scui,\ sc/source/ui/attrdlg/scuiexp \ sc/source/ui/attrdlg/tabpages \ sc/source/ui/cctrl/editfield \ - sc/source/ui/condformat/colorformat \ - sc/source/ui/condformat/condformatdlg \ - sc/source/ui/condformat/condformathelper \ sc/source/ui/condformat/condformatmgr \ sc/source/ui/dbgui/dapidata \ sc/source/ui/dbgui/dapitype \ diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index aac528ee487f..d09027cad4cf 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -84,12 +84,6 @@ public: virtual sal_Bool IsRow() = 0; }; -class AbstractScCondFormatDlg : public VclAbstractDialog -{ -public: - virtual ScConditionalFormat* GetConditionalFormat() = 0; -}; - class AbstractScCondFormatManagerDlg : public VclAbstractDialog { public: @@ -98,10 +92,6 @@ public: virtual bool CondFormatsChanged() = 0; }; -class AbstractScDataBarSettingsDlg : public VclAbstractDialog -{ -}; - class AbstractScDataPilotDatabaseDlg :public VclAbstractDialog //add for ScDataPilotDatabaseDlg { public: @@ -365,14 +355,9 @@ public: sal_Bool bColDefault = sal_True ) = 0; virtual VclAbstractDialog * CreateScSortWarningDlg ( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ) = 0; //add for ScSortWarningDlg - virtual AbstractScCondFormatDlg* CreateScCondFormatDlg (Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, - const ScRangeList& rList, const ScAddress& rPos, int nId ) = 0; //add for ScCondFormatDlg - virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos, int nId ) = 0; - virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ) = 0; //add for ScDataBarSettingsDlg - virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, sal_Bool bEnableExternal, int nId ) = 0; //add for ScDataPilotSourceTypeDlg diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 15233b66d08a..1086fd547e6a 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -188,7 +188,7 @@ interface CellSelection FID_USE_NAME [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] SID_CANCEL [ ExecMethod = Execute; ] SID_TOGGLE_REL [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] - SID_OPENDLG_CONDFRMT [ ExecMethod = ExecuteEdit; ] + SID_OPENDLG_CONDFRMT [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] SID_OPENDLG_COLORSCALE [ ExecMethod = ExecuteEdit; ] SID_OPENDLG_DATABAR [ ExecMethod = ExecuteEdit; ] SID_OPENDLG_CONDFRMT_MANAGER [ ExecMethod = ExecuteEdit; ] diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 651b46a1bce9..5f8540d1728d 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -258,7 +258,8 @@ void ScDLL::Init() ScSolverDlgWrapper ::RegisterChildWindow(false, pMod); ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod); ScNameDlgWrapper ::RegisterChildWindow(false, pMod); - ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod); + ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod); + ScCondFormatDlgWrapper ::RegisterChildWindow(false, pMod); ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod); ScTabOpDlgWrapper ::RegisterChildWindow(false, pMod); ScFilterDlgWrapper ::RegisterChildWindow(false, pMod); diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index e23522e2b59e..a23d0edf3f8f 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -90,9 +90,7 @@ IMPL_ABSTDLG_BASE(ScVclAbstractDialog_Impl); IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScAutoFormatDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScColRowLabelDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScCondFormatDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDataPilotServiceDlg_Impl); @@ -452,11 +450,6 @@ sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh() } -ScConditionalFormat* AbstractScCondFormatDlg_Impl::GetConditionalFormat() -{ - return pDlg->GetConditionalFormat(); -} - ScConditionalFormatList* AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList() { return pDlg->GetConditionalFormatList(); @@ -781,33 +774,6 @@ VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window } -AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, - const ScRangeList& rRange, const ScAddress& rPos, int nId) -{ - ScCondFormatDlg* pDlg = NULL; - switch( nId ) - { - case 0: - pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos, condformat::dialog::NONE ); - break; - case SID_OPENDLG_CONDFRMT: - pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos, condformat::dialog::CONDITION ); - break; - case SID_OPENDLG_COLORSCALE: - pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos, condformat::dialog::COLORSCALE ); - break; - case SID_OPENDLG_DATABAR: - pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos, condformat::dialog::DATABAR ); - break; - default: - break; - } - if(pDlg) - return new AbstractScCondFormatDlg_Impl( pDlg ); - - return NULL; -} - AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos, int nId ) { @@ -826,24 +792,6 @@ AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormat return NULL; } -AbstractScDataBarSettingsDlg* ScAbstractDialogFactory_Impl::CreateScDataBarSetttingsDlg(Window* pParent, ScDocument* pDoc, int nId) -{ - ScDataBarSettingsDlg* pDlg = NULL; - switch( nId ) - { - case RID_SCDLG_DATABAR: - pDlg = new ScDataBarSettingsDlg( pParent, pDoc ); - break; - default: - break; - } - if(pDlg) - return new AbstractScDataBarSettingsDlg_Impl( pDlg ); - - return NULL; -} - - AbstractScDataPilotDatabaseDlg * ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg (Window* pParent , int nId ) { diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 60c4e6d6f199..dfbd7fd272c7 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -63,8 +63,6 @@ class ScTabBgColorDlg; class ScImportOptionsDlg; class SfxTabDialog; class ScTextImportOptionsDlg; -class ScDataBarSettingsDlg; -class ScCondFormatDlg; class ScCondFormatManagerDlg; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ @@ -136,13 +134,6 @@ class AbstractScColRowLabelDlg_Impl : public AbstractScColRowLabelDlg //add for virtual sal_Bool IsRow(); }; -class AbstractScCondFormatDlg_Impl : public AbstractScCondFormatDlg -{ - DECL_ABSTDLG_BASE(AbstractScCondFormatDlg_Impl, ScCondFormatDlg) - - virtual ScConditionalFormat* GetConditionalFormat(); -}; - class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg { DECL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl, ScCondFormatManagerDlg) @@ -152,11 +143,6 @@ class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDl virtual bool CondFormatsChanged(); }; -class AbstractScDataBarSettingsDlg_Impl : public AbstractScDataBarSettingsDlg -{ - DECL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl, ScDataBarSettingsDlg) -}; - class AbstractScDataPilotDatabaseDlg_Impl :public AbstractScDataPilotDatabaseDlg //add for ScDataPilotDatabaseDlg { DECL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl, ScDataPilotDatabaseDlg) @@ -435,14 +421,9 @@ public: virtual VclAbstractDialog * CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ); - virtual AbstractScCondFormatDlg* CreateScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, - const ScRangeList& rRange, const ScAddress& rPos, int nId ); //add for ScDataBarSettingsDlg - virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos, int nId ); - virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ); //add for ScDataBarSettingsDlg - virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, sal_Bool bEnableExternal, int nId ) ; //add for ScDataPilotSourceTypeDlg diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 4c5708a00c84..ce539d4e5ddf 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -46,6 +46,7 @@ #include "conditio.hxx" #include "colorscale.hxx" #include "colorformat.hxx" +#include "reffact.hxx" #include "globstr.hrc" @@ -1111,9 +1112,9 @@ void ScCondFormatList::DoScroll(long nDelta) mpScrollBar->SetPosPixel(aNewPoint); } -ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, +ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType): - ModalDialog(pParent, ScResId( RID_SCDLG_CONDFORMAT )), + ScAnyRefDlg(pB, pCW, pParent, RID_SCDLG_CONDFORMAT ), maBtnAdd( this, ScResId( BTN_ADD ) ), maBtnRemove( this, ScResId( BTN_REMOVE ) ), maBtnOk( this, ScResId( BTN_OK ) ), @@ -1134,11 +1135,26 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond maBtnRemove.SetClickHdl( LINK( &maCondFormList, ScCondFormatList, RemoveBtnHdl ) ); maEdRange.SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) ); maBtnOk.SetClickHdl( LINK( this, ScCondFormatDlg, OkBtnHdl ) ); + maBtnCancel.SetClickHdl( LINK( this, ScCondFormatDlg, CancelBtnHdl ) ); FreeResource(); maEdRange.SetText(aRangeString); } +ScCondFormatDlg::~ScCondFormatDlg() +{ +} + +void ScCondFormatDlg::SetActive() +{ + +} + +void ScCondFormatDlg::SetReference(const ScRange&, ScDocument*) +{ + +} + ScConditionalFormat* ScCondFormatDlg::GetConditionalFormat() const { rtl::OUString aRangeStr = maEdRange.GetText(); @@ -1210,16 +1226,14 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit ) IMPL_LINK_NOARG( ScCondFormatDlg, OkBtnHdl ) { - rtl::OUString aRangeStr = maEdRange.GetText(); - ScRangeList aRange; - aRange.Parse(aRangeStr, mpDoc, SCA_VALID, mpDoc->GetAddressConvention()); - boost::scoped_ptr<ScConditionalFormat> pFormat(maCondFormList.GetConditionalFormat()); - if(pFormat && pFormat->GetRange().empty() && aRange.empty()) - return 0; - else - { - EndDialog(RET_OK); - } + DoClose( ScCondFormatDlgWrapper::GetChildWindowId() ); + + return 0; +} + +IMPL_LINK_NOARG( ScCondFormatDlg, CancelBtnHdl ) +{ + DoClose( ScCondFormatDlgWrapper::GetChildWindowId() ); return 0; } diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 0bd35387f793..16c8291cb938 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -216,8 +216,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl) if(!pFormat) return 0; - boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), - pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE)); + boost::scoped_ptr<ScCondFormatDlg> pDlg;//(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), + // pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE)); if(pDlg->Execute() == RET_OK) { sal_Int32 nKey = pFormat->GetKey(); @@ -252,8 +252,8 @@ sal_uInt32 FindKey(ScConditionalFormatList* pFormatList) IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl) { - boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(), - maPos, condformat::dialog::CONDITION)); + boost::scoped_ptr<ScCondFormatDlg> pDlg;//(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(), + // maPos, condformat::dialog::CONDITION)); if(pDlg->Execute() == RET_OK) { ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat(); diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 52c03e504468..8fbf5b11c9b7 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -40,6 +40,7 @@ #include <boost/ptr_container/ptr_vector.hpp> #include <boost/scoped_ptr.hpp> +#include "anyrefdg.hxx" class ScDocument; class ScConditionalFormat; @@ -189,7 +190,7 @@ public: }; -class ScCondFormatDlg : public ModalDialog +class ScCondFormatDlg : public ScAnyRefDlg { private: PushButton maBtnAdd; @@ -206,11 +207,17 @@ private: DECL_LINK( EdRangeModifyHdl, Edit* ); DECL_LINK( OkBtnHdl, void* ); + DECL_LINK( CancelBtnHdl, void* ); public: - ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType); + ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pSW, Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, + const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType); + virtual ~ScCondFormatDlg(); - ScConditionalFormat* GetConditionalFormat() const; + SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const; + + virtual void SetReference(const ScRange&, ScDocument*); + virtual void SetActive(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 99f5b59cdfb1..48c269de0bd6 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -10,6 +10,8 @@ #include <rtl/ustring.hxx> #include "conditio.hxx" +#include "global.hxx" + enum ScCondFormatEntryType { CONDITION, @@ -22,9 +24,9 @@ enum ScCondFormatEntryType class ScCondFormatHelper { public: - static rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); + static SC_DLLPUBLIC rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); - static rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex ); + static SC_DLLPUBLIC rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index e7d728f5150d..2a454c257133 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -45,6 +45,7 @@ DECL_WRAPPER_WITHID(ScNameDlgWrapper) DECL_WRAPPER_WITHID(ScNameDefDlgWrapper) +DECL_WRAPPER_WITHID(ScCondFormatDlgWrapper) DECL_WRAPPER_WITHID(ScSolverDlgWrapper) DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper) DECL_WRAPPER_WITHID(ScPivotLayoutWrapper) diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src index 9a4977624b55..f00052a8d4dd 100644 --- a/sc/source/ui/src/condformatdlg.src +++ b/sc/source/ui/src/condformatdlg.src @@ -28,7 +28,7 @@ #include "condformatdlg.hrc" -ModalDialog RID_SCDLG_CONDFORMAT +ModelessDialog RID_SCDLG_CONDFORMAT { OutputSize = TRUE; Hide = TRUE; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 1f970b6d0130..73eb0516372a 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -126,6 +126,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_INSERT_NAME: case SID_SPELL_DIALOG: case SID_HANGUL_HANJA_CONVERSION: + case SID_OPENDLG_CONDFRMT: + case SID_OPENDLG_COLORSCALE: + case SID_OPENDLG_DATABAR: pScMod->InputEnterHandler(); pTabViewShell->UpdateInputHandler(); @@ -1762,6 +1765,18 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_OPENDLG_CONDFRMT: + case SID_OPENDLG_COLORSCALE: + case SID_OPENDLG_DATABAR: + { + sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId(); + SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); + SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); + + pScMod->SetRefDialog( nId, pWnd ? false : sal_True ); + } + break; + case SID_DEFINE_COLROWNAMERANGES: { @@ -2034,56 +2049,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; - case SID_OPENDLG_CONDFRMT: - case SID_OPENDLG_COLORSCALE: - case SID_OPENDLG_DATABAR: - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - - ScRangeList aRangeList; - ScViewData* pData = GetViewData(); - pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false); - ScDocument* pDoc = pData->GetDocument(); - - if(pDoc->IsTabProtected(pData->GetTabNo())) - { - pTabViewShell->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); - } - - boost::scoped_ptr<AbstractScCondFormatDlg> pDlg; - const ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab()); - if(pCondFormat) - { - const ScRangeList& rCondFormatRange = pCondFormat->GetRange(); - if(rCondFormatRange == aRangeList) - pDlg.reset(pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, pCondFormat->GetRange(), aPos, 0 )); - } - - if(!pDlg) - { - pDlg.reset(pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), nSlot )); - } - - if(pDlg && pDlg->Execute() == RET_OK) - { - ScConditionalFormat* pFormat = pDlg->GetConditionalFormat(); - sal_uLong nOldIndex = 0; - if(pCondFormat) - nOldIndex = pCondFormat->GetKey(); - pData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat( nOldIndex, pFormat, pData->GetTabNo(), pFormat->GetRange() ); - } - } - break; - case SID_OPENDLG_CONDFRMT_MANAGER: { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); @@ -2110,33 +2075,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; - case SID_COLORSCALE: - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - - ScDocument* pDoc = GetViewData()->GetDocument(); - boost::scoped_ptr<AbstractScDataBarSettingsDlg> pDlg(pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), pDoc, RID_SCDLG_DATABAR )); - OSL_ENSURE(pDlg, "Dialog create fail!"); - pDlg->Execute(); - } - break; - - case SID_DATABAR: - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - - ScDocument* pDoc = GetViewData()->GetDocument(); - boost::scoped_ptr<AbstractScDataBarSettingsDlg> pDlg(pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), pDoc, RID_SCDLG_DATABAR )); - OSL_ENSURE(pDlg, "Dialog create fail!"); - if(pDlg->Execute() == RET_OK) - { - //add here code that handles the data bar inserting - } - } - break; - case SID_EXTERNAL_SOURCE: { String aFile; diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 746d7b283d0e..b31b1b2ac744 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -44,6 +44,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME ) SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME ) +SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT ) SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE ) SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER ) SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE ) @@ -116,6 +117,12 @@ IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME ) IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME ) //------------------------------------------------------------------------- +// ScNameDlgWrapper +//------------------------------------------------------------------------- + +IMPL_CHILD_CTOR( ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT ) + +//------------------------------------------------------------------------- // ScSolverDlgWrapper //------------------------------------------------------------------------- diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 6c976cb6e6ec..d4928196a425 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -63,6 +63,7 @@ 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(ScCondFormatDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId()); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index a92fca945f8b..aeb7f3bee453 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -63,6 +63,9 @@ #include "dpobject.hxx" #include "markdata.hxx" #include "reffact.hxx" +#include "condformatdlg.hxx" + +#include <iostream> //------------------------------------------------------------------ @@ -180,6 +183,59 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( } break; + case SID_OPENDLG_CONDFRMT: + case SID_OPENDLG_COLORSCALE: + case SID_OPENDLG_DATABAR: + { + std::cout << "Open Dlg" << std::endl; + 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()); + if(pCondFormat) + { + const ScRangeList& rCondFormatRange = pCondFormat->GetRange(); + if(rCondFormatRange == aRangeList) + pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, NULL, rCondFormatRange, aPos, condformat::dialog::NONE ); + } + + if(!pResult) + { + 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; + } + pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType ); + } + } + + break; + case SID_DEFINE_COLROWNAMERANGES: { pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, GetViewData() ); |