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
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;
......
......@@ -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)
{
......
......@@ -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();
......
......@@ -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;
};
......
......@@ -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;
......
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