Kaydet (Commit) caac9026 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

improve the property mapping dialog

Change-Id: I0dbb44febb058a3b33030aa1fa86d850e71eef48
üst bc338f4a
...@@ -13,12 +13,29 @@ namespace chart { ...@@ -13,12 +13,29 @@ namespace chart {
namespace { namespace {
static long pListBoxTabs[] = long pListBoxTabs[] =
{ {
3, 3,
0, 0, 75 0, 75, 150
}; };
std::vector<OUString> getEntries()
{
const char* pEntries[] =
{
"FillColor\tColor",
"BorderColor\tColor"
};
std::vector<OUString> aRet;
for(size_t i = 0; i < SAL_N_ELEMENTS(pEntries); ++i)
{
aRet.push_back(OUString::createFromAscii(pEntries[i]));
}
return aRet;
}
} }
PropertyMappingDlg::PropertyMappingDlg(Window* pParent) PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
...@@ -26,8 +43,42 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent) ...@@ -26,8 +43,42 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
"modules/schart/ui/dlg_PropertyMapping.ui") "modules/schart/ui/dlg_PropertyMapping.ui")
{ {
get(mpMappingTable, "LST_PROPERTY_MAPPING"); get(mpMappingTable, "LST_PROPERTY_MAPPING");
get(mpBtnOk, "ok");
get(mpBtnCancel, "cancel");
mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT ); mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT );
std::vector<OUString> aEntries = getEntries();
for(std::vector<OUString>::const_iterator itr = aEntries.begin(),
itrEnd = aEntries.end(); itr != itrEnd; ++itr)
{
mpMappingTable->InsertEntry(*itr);
}
mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) );
}
OUString PropertyMappingDlg::getSelectedEntry()
{
if(mpMappingTable->GetSelectionCount())
{
SvTreeListEntry* pEntry = mpMappingTable->FirstSelected();
OUString aText = mpMappingTable->GetEntryText(pEntry, 0);
return aText;
}
return OUString();
}
IMPL_LINK_NOARG(PropertyMappingDlg, OkBtnHdl)
{
EndDialog(RET_OK);
return 0;
}
IMPL_LINK_NOARG(PropertyMappingDlg, CancelBtnHdl)
{
EndDialog(RET_CANCEL);
return 0;
} }
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define CHART2_PROPERTY_MAPPING_HXX #define CHART2_PROPERTY_MAPPING_HXX
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <svtools/svtabbx.hxx> #include <svtools/svtabbx.hxx>
namespace chart { namespace chart {
...@@ -25,7 +26,12 @@ public: ...@@ -25,7 +26,12 @@ public:
private: private:
DECL_LINK( OkBtnHdl, void* );
DECL_LINK( CancelBtnHdl, void* );
SvTabListBox* mpMappingTable; SvTabListBox* mpMappingTable;
Button* mpBtnOk;
Button* mpBtnCancel;
}; };
} }
......
...@@ -762,9 +762,13 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit ) ...@@ -762,9 +762,13 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl ) IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
{ {
PropertyMappingDlg aDlg(this); PropertyMappingDlg aDlg(this);
aDlg.Execute(); short aRet = aDlg.Execute();
OUString aNewMappingName = "FillColor"; if(aRet == RET_OK)
{
OUString aNewMappingName = aDlg.getSelectedEntry();
if(!aNewMappingName.isEmpty())
m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString())); m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
}
return 0; return 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