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

remove duplicated code

Change-Id: I4a5dcb9d05446dc938f978cb30428c70c70d6914
üst 24c0aafd
...@@ -261,6 +261,25 @@ OUString getSeriesLabel(css::uno::Reference<css::frame::XModel> xModel, const OU ...@@ -261,6 +261,25 @@ OUString getSeriesLabel(css::uno::Reference<css::frame::XModel> xModel, const OU
return DataSeriesHelper::getDataSeriesLabel(xSeries, xChartType->getRoleOfSequenceForSeriesLabel()); return DataSeriesHelper::getDataSeriesLabel(xSeries, xChartType->getRoleOfSequenceForSeriesLabel());
} }
OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return OUString();
uno::Any aAny = xSelectionSupplier->getSelection();
assert(aAny.hasValue());
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
assert(eType == OBJECTTYPE_DATA_SERIES);
#endif
return aCID;
}
} }
ChartSeriesPanel::ChartSeriesPanel( ChartSeriesPanel::ChartSeriesPanel(
...@@ -334,19 +353,7 @@ void ChartSeriesPanel::Initialize() ...@@ -334,19 +353,7 @@ void ChartSeriesPanel::Initialize()
void ChartSeriesPanel::updateData() void ChartSeriesPanel::updateData()
{ {
css::uno::Reference<css::frame::XController> xController(mxModel->getCurrentController()); OUString aCID = getCID(mxModel);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return;
uno::Any aAny = xSelectionSupplier->getSelection();
assert(aAny.hasValue());
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
assert(eType == OBJECTTYPE_DATA_SERIES);
#endif
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
bool bLabelVisible = isDataLabelVisible(mxModel, aCID); bool bLabelVisible = isDataLabelVisible(mxModel, aCID);
mpCBLabel->Check(bLabelVisible); mpCBLabel->Check(bLabelVisible);
...@@ -406,19 +413,7 @@ void ChartSeriesPanel::modelInvalid() ...@@ -406,19 +413,7 @@ void ChartSeriesPanel::modelInvalid()
IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox) IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
{ {
bool bChecked = pCheckBox->IsChecked(); bool bChecked = pCheckBox->IsChecked();
css::uno::Reference<css::frame::XController> xController(mxModel->getCurrentController()); OUString aCID = getCID(mxModel);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return 0;
uno::Any aAny = xSelectionSupplier->getSelection();
assert(aAny.hasValue());
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
assert(eType == OBJECTTYPE_DATA_SERIES);
#endif
if (pCheckBox == mpCBLabel.get()) if (pCheckBox == mpCBLabel.get())
setDataLabelVisible(mxModel, aCID, bChecked); setDataLabelVisible(mxModel, aCID, bChecked);
else if (pCheckBox == mpCBTrendline.get()) else if (pCheckBox == mpCBTrendline.get())
...@@ -433,20 +428,7 @@ IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox) ...@@ -433,20 +428,7 @@ IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl) IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl)
{ {
css::uno::Reference<css::frame::XController> xController(mxModel->getCurrentController()); OUString aCID = getCID(mxModel);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return 0;
uno::Any aAny = xSelectionSupplier->getSelection();
assert(aAny.hasValue());
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
assert(eType == OBJECTTYPE_DATA_SERIES);
#endif
bool bChecked = mpRBPrimaryAxis->IsChecked(); bool bChecked = mpRBPrimaryAxis->IsChecked();
setAttachedAxisType(mxModel, aCID, bChecked); setAttachedAxisType(mxModel, aCID, bChecked);
...@@ -456,19 +438,7 @@ IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl) ...@@ -456,19 +438,7 @@ IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl)
IMPL_LINK_NOARG(ChartSeriesPanel, ListBoxHdl) IMPL_LINK_NOARG(ChartSeriesPanel, ListBoxHdl)
{ {
css::uno::Reference<css::frame::XController> xController(mxModel->getCurrentController()); OUString aCID = getCID(mxModel);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return 0;
uno::Any aAny = xSelectionSupplier->getSelection();
assert(aAny.hasValue());
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
assert(eType == OBJECTTYPE_DATA_SERIES);
#endif
sal_Int32 nPos = mpLBLabelPlacement->GetSelectEntryPos(); sal_Int32 nPos = mpLBLabelPlacement->GetSelectEntryPos();
setDataLabelPlacement(mxModel, aCID, nPos); setDataLabelPlacement(mxModel, aCID, nPos);
......
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