summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-03-09 18:45:58 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-09 19:27:49 +0100
commitcaac9026f6532483e0ae1fa09a36a4fc0e92aa8a (patch)
tree7a7586b5cf1d720ae8cea2514579d3e13009bd13 /chart2
parentbc338f4afc4126b37b3183182016ff4173cadeb8 (diff)
improve the property mapping dialog
Change-Id: I0dbb44febb058a3b33030aa1fa86d850e71eef48
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/dlg_PropertyMapping.cxx55
-rw-r--r--chart2/source/controller/dialogs/dlg_PropertyMapping.hxx6
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx10
3 files changed, 66 insertions, 5 deletions
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index 8022c5d621a8..0f193b89f743 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
@@ -13,12 +13,29 @@ namespace chart {
namespace {
-static long pListBoxTabs[] =
+long pListBoxTabs[] =
{
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)
@@ -26,8 +43,42 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
"modules/schart/ui/dlg_PropertyMapping.ui")
{
get(mpMappingTable, "LST_PROPERTY_MAPPING");
+ get(mpBtnOk, "ok");
+ get(mpBtnCancel, "cancel");
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;
}
}
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
index 3240a30fa1bc..e6a6b4bd44b3 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
@@ -11,6 +11,7 @@
#define CHART2_PROPERTY_MAPPING_HXX
#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
#include <svtools/svtabbx.hxx>
namespace chart {
@@ -25,7 +26,12 @@ public:
private:
+ DECL_LINK( OkBtnHdl, void* );
+ DECL_LINK( CancelBtnHdl, void* );
+
SvTabListBox* mpMappingTable;
+ Button* mpBtnOk;
+ Button* mpBtnCancel;
};
}
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 60cf54b049fd..12533aa437b0 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -762,9 +762,13 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
{
PropertyMappingDlg aDlg(this);
- aDlg.Execute();
- OUString aNewMappingName = "FillColor";
- m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
+ short aRet = aDlg.Execute();
+ if(aRet == RET_OK)
+ {
+ OUString aNewMappingName = aDlg.getSelectedEntry();
+ if(!aNewMappingName.isEmpty())
+ m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
+ }
return 0;
}