summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-06 05:19:19 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-06 21:25:11 +0200
commitc2d8d60748769d32133f33efb43be3e9ea28f8c8 (patch)
tree05c017d05e6a8539191dfea826addb5d072d3bd7 /sc
parentb65e98a6a8be0ad7864eb607087d9b85003e5a1e (diff)
selecting the correct entry will also show it in the dialog
Change-Id: I6bbeb2d1cb5af724ac0743d13f3e36cb8b613a88
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx13
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx39
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx2
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx25
-rw-r--r--sc/source/ui/view/cellsh1.cxx6
5 files changed, 71 insertions, 14 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 7962c6d3bcd7..9200eba351b6 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -787,8 +787,17 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win
ScCondFormatDlg* pDlg = NULL;
switch( nId )
{
- case RID_SCDLG_CONDFORMAT:
- pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos );
+ 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;
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index e2f8d679a978..9dc6350241e9 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -633,6 +633,14 @@ void ScCondFrmtEntry::Select()
SetHeight();
}
+void ScCondFrmtEntry::SetType( ScCondFormatEntryType eType )
+{
+ meType = eType;
+ if(eType == DATABAR)
+ maLbColorFormat.SelectEntryPos(2);
+ Select();
+}
+
void ScCondFrmtEntry::Deselect()
{
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
@@ -987,7 +995,8 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl )
return 0;
}
-ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos):
+ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat,
+ const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType):
Control(pParent, rResId),
mbHasScrollBar(false),
mpScrollBar(new ScrollBar(this, WB_VERT )),
@@ -1005,9 +1014,28 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum
{
maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, pFormat->GetEntry(nIndex), maPos ));
}
- if (nCount > 0)
- maEntries.begin()->Select();
}
+ else
+ {
+ switch(eType)
+ {
+ case condformat::dialog::CONDITION:
+ maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, maPos ));
+ break;
+ case condformat::dialog::COLORSCALE:
+ maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, maPos ));
+ maEntries[0].SetType(COLORSCALE);
+ break;
+ case condformat::dialog::DATABAR:
+ maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, maPos ));
+ maEntries[0].SetType(DATABAR);
+ break;
+ default:
+ break;
+ }
+ }
+ if (!maEntries.empty())
+ maEntries.begin()->Select();
RecalcAll();
FreeResource();
@@ -1083,7 +1111,8 @@ void ScCondFormatList::DoScroll(long nDelta)
mpScrollBar->SetPosPixel(aNewPoint);
}
-ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos):
+ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange,
+ const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType):
ModalDialog(pParent, ScResId( RID_SCDLG_CONDFORMAT )),
maBtnAdd( this, ScResId( BTN_ADD ) ),
maBtnRemove( this, ScResId( BTN_REMOVE ) ),
@@ -1091,7 +1120,7 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond
maBtnCancel( this, ScResId( BTN_CANCEL ) ),
maFtRange( this, ScResId( FT_RANGE ) ),
maEdRange( this, ScResId( ED_RANGE ) ),
- maCondFormList( this, ScResId( CTRL_LIST ), pDoc, pFormat, rRange, rPos ),
+ maCondFormList( this, ScResId( CTRL_LIST ), pDoc, pFormat, rRange, rPos, eType ),
maPos(rPos),
mpDoc(pDoc)
{
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 09318997bf4d..6eeecd108dc8 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -217,7 +217,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
return 0;
boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
- pFormat->GetRange().GetTopLeftCorner()));
+ pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE));
if(pDlg->Execute() == RET_OK)
{
sal_Int32 nKey = pFormat->GetKey();
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 4b3e780d69fc..c7a247ce8cf4 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -47,6 +47,22 @@ class ScFormatEntry;
class ScConditionalFormat;
struct ScDataBarFormatData;
+namespace condformat {
+
+namespace dialog {
+
+enum ScCondFormatDialogType
+{
+ NONE,
+ CONDITION,
+ COLORSCALE,
+ DATABAR
+};
+
+}
+
+}
+
class ScCondFrmtEntry : public Control
{
private:
@@ -96,7 +112,6 @@ private:
boost::scoped_ptr<ScDataBarFormatData> mpDataBarData;
//
- void SwitchToType(ScCondFormatEntryType eType);
void SetCondType();
void SetColorScaleType();
void SetDataBarType();
@@ -104,6 +119,7 @@ private:
void HideCondElements();
void HideColorScaleElements();
void HideDataBarElements();
+ void SwitchToType(ScCondFormatEntryType eType);
void SetHeight();
void Init();
@@ -134,6 +150,8 @@ public:
virtual long Notify( NotifyEvent& rNEvt );
+ void SetType( ScCondFormatEntryType eType );
+
void Select();
void Deselect();
@@ -159,7 +177,8 @@ private:
void RecalcAll();
void DoScroll(long nDiff);
public:
- ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos);
+ ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat,
+ const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
ScConditionalFormat* GetConditionalFormat() const;
@@ -188,7 +207,7 @@ private:
DECL_LINK( EdRangeModifyHdl, Edit* );
public:
- ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos);
+ ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
ScConditionalFormat* GetConditionalFormat() const;
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c4b21f30a4a3..1f970b6d0130 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2065,15 +2065,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
if(rCondFormatRange == aRangeList)
- pDlg.reset(pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, pCondFormat->GetRange(), aPos, RID_SCDLG_CONDFORMAT ));
+ 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(), RID_SCDLG_CONDFORMAT ));
+ pDlg.reset(pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), nSlot ));
}
- if(pDlg->Execute() == RET_OK)
+ if(pDlg && pDlg->Execute() == RET_OK)
{
ScConditionalFormat* pFormat = pDlg->GetConditionalFormat();
sal_uLong nOldIndex = 0;