Kaydet (Commit) c2d8d607 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

selecting the correct entry will also show it in the dialog

Change-Id: I6bbeb2d1cb5af724ac0743d13f3e36cb8b613a88
üst b65e98a6
...@@ -787,8 +787,17 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win ...@@ -787,8 +787,17 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win
ScCondFormatDlg* pDlg = NULL; ScCondFormatDlg* pDlg = NULL;
switch( nId ) switch( nId )
{ {
case RID_SCDLG_CONDFORMAT: case 0:
pDlg = new ScCondFormatDlg( pParent, pDoc, pFormat, rRange, rPos ); 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; break;
default: default:
break; break;
......
...@@ -633,6 +633,14 @@ void ScCondFrmtEntry::Select() ...@@ -633,6 +633,14 @@ void ScCondFrmtEntry::Select()
SetHeight(); SetHeight();
} }
void ScCondFrmtEntry::SetType( ScCondFormatEntryType eType )
{
meType = eType;
if(eType == DATABAR)
maLbColorFormat.SelectEntryPos(2);
Select();
}
void ScCondFrmtEntry::Deselect() void ScCondFrmtEntry::Deselect()
{ {
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor()); SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
...@@ -987,7 +995,8 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl ) ...@@ -987,7 +995,8 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl )
return 0; 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), Control(pParent, rResId),
mbHasScrollBar(false), mbHasScrollBar(false),
mpScrollBar(new ScrollBar(this, WB_VERT )), mpScrollBar(new ScrollBar(this, WB_VERT )),
...@@ -1005,9 +1014,28 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum ...@@ -1005,9 +1014,28 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum
{ {
maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, pFormat->GetEntry(nIndex), maPos )); 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(); RecalcAll();
FreeResource(); FreeResource();
...@@ -1083,7 +1111,8 @@ void ScCondFormatList::DoScroll(long nDelta) ...@@ -1083,7 +1111,8 @@ void ScCondFormatList::DoScroll(long nDelta)
mpScrollBar->SetPosPixel(aNewPoint); 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 )), ModalDialog(pParent, ScResId( RID_SCDLG_CONDFORMAT )),
maBtnAdd( this, ScResId( BTN_ADD ) ), maBtnAdd( this, ScResId( BTN_ADD ) ),
maBtnRemove( this, ScResId( BTN_REMOVE ) ), maBtnRemove( this, ScResId( BTN_REMOVE ) ),
...@@ -1091,7 +1120,7 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond ...@@ -1091,7 +1120,7 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond
maBtnCancel( this, ScResId( BTN_CANCEL ) ), maBtnCancel( this, ScResId( BTN_CANCEL ) ),
maFtRange( this, ScResId( FT_RANGE ) ), maFtRange( this, ScResId( FT_RANGE ) ),
maEdRange( this, ScResId( ED_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), maPos(rPos),
mpDoc(pDoc) mpDoc(pDoc)
{ {
......
...@@ -217,7 +217,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl) ...@@ -217,7 +217,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
return 0; return 0;
boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), 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) if(pDlg->Execute() == RET_OK)
{ {
sal_Int32 nKey = pFormat->GetKey(); sal_Int32 nKey = pFormat->GetKey();
......
...@@ -47,6 +47,22 @@ class ScFormatEntry; ...@@ -47,6 +47,22 @@ class ScFormatEntry;
class ScConditionalFormat; class ScConditionalFormat;
struct ScDataBarFormatData; struct ScDataBarFormatData;
namespace condformat {
namespace dialog {
enum ScCondFormatDialogType
{
NONE,
CONDITION,
COLORSCALE,
DATABAR
};
}
}
class ScCondFrmtEntry : public Control class ScCondFrmtEntry : public Control
{ {
private: private:
...@@ -96,7 +112,6 @@ private: ...@@ -96,7 +112,6 @@ private:
boost::scoped_ptr<ScDataBarFormatData> mpDataBarData; boost::scoped_ptr<ScDataBarFormatData> mpDataBarData;
// //
void SwitchToType(ScCondFormatEntryType eType);
void SetCondType(); void SetCondType();
void SetColorScaleType(); void SetColorScaleType();
void SetDataBarType(); void SetDataBarType();
...@@ -104,6 +119,7 @@ private: ...@@ -104,6 +119,7 @@ private:
void HideCondElements(); void HideCondElements();
void HideColorScaleElements(); void HideColorScaleElements();
void HideDataBarElements(); void HideDataBarElements();
void SwitchToType(ScCondFormatEntryType eType);
void SetHeight(); void SetHeight();
void Init(); void Init();
...@@ -134,6 +150,8 @@ public: ...@@ -134,6 +150,8 @@ public:
virtual long Notify( NotifyEvent& rNEvt ); virtual long Notify( NotifyEvent& rNEvt );
void SetType( ScCondFormatEntryType eType );
void Select(); void Select();
void Deselect(); void Deselect();
...@@ -159,7 +177,8 @@ private: ...@@ -159,7 +177,8 @@ private:
void RecalcAll(); void RecalcAll();
void DoScroll(long nDiff); void DoScroll(long nDiff);
public: 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; ScConditionalFormat* GetConditionalFormat() const;
...@@ -188,7 +207,7 @@ private: ...@@ -188,7 +207,7 @@ private:
DECL_LINK( EdRangeModifyHdl, Edit* ); DECL_LINK( EdRangeModifyHdl, Edit* );
public: 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; ScConditionalFormat* GetConditionalFormat() const;
}; };
......
...@@ -2065,15 +2065,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ...@@ -2065,15 +2065,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{ {
const ScRangeList& rCondFormatRange = pCondFormat->GetRange(); const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
if(rCondFormatRange == aRangeList) 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) 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(); ScConditionalFormat* pFormat = pDlg->GetConditionalFormat();
sal_uLong nOldIndex = 0; sal_uLong nOldIndex = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment