summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-11-07 13:51:13 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-11-07 13:28:54 +0100
commiteb38c0470195869b8c38b864cbb9692cd02f15e5 (patch)
tree2e7e017dad491d7ea0fa18ea6cfc21f62dbf4862 /chart2
parent1787d5aa7e0207fdea6328b1682262265625d165 (diff)
Overload showExtraControls method
and adjust CombiColumnLineChartDialogController accordingly, to be able to use with a VCLContainer parent Change-Id: I835a5ba0e18fe7dbfca97ee975e4d00c2ac302d4 Reviewed-on: https://gerrit.libreoffice.org/82206 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx64
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx1
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx2
-rw-r--r--chart2/source/inc/ChartTypeDialogController.hxx9
4 files changed, 71 insertions, 5 deletions
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 04afdc14244c..b34bf3f102df 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -36,6 +36,7 @@
#include <svtools/valueset.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/builder.hxx>
+#include <vcl/fixed.hxx>
#include <vcl/image.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -371,6 +372,9 @@ bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
void ChartTypeDialogController::showExtraControls(weld::Builder* /*pBuilder*/)
{
}
+void ChartTypeDialogController::showExtraControls(VclBuilderContainer* /*pParent*/)
+{
+}
void ChartTypeDialogController::hideExtraControls() const
{
}
@@ -1228,6 +1232,8 @@ void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter& r
}
CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
+ : m_pFT_NumberOfLines(nullptr)
+ , m_pMF_NumberOfLines(nullptr)
{
bSupports3D = false;
}
@@ -1294,21 +1300,51 @@ void CombiColumnLineChartDialogController::showExtraControls(weld::Builder* pBui
m_xMF_NumberOfLines->show();
}
+void CombiColumnLineChartDialogController::showExtraControls(VclBuilderContainer* pParent)
+{
+ if (!m_pFT_NumberOfLines)
+ {
+ pParent->get(m_pFT_NumberOfLines, "nolinesft");
+ }
+ if (!m_pMF_NumberOfLines)
+ {
+ pParent->get(m_pMF_NumberOfLines, "nolines");
+
+ m_pMF_NumberOfLines->SetSpinSize(1);
+ m_pMF_NumberOfLines->SetFirst( 1 );
+ m_pMF_NumberOfLines->SetLast( 100 );
+ m_pMF_NumberOfLines->SetMin( 1 );
+ m_pMF_NumberOfLines->SetMax( 100 );
+
+ m_pMF_NumberOfLines->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController, ChangeLineCountHdl_unwelded ) );
+ }
+
+ m_pFT_NumberOfLines->Show();
+ m_pMF_NumberOfLines->Show();
+}
+
void CombiColumnLineChartDialogController::hideExtraControls() const
{
if (m_xFT_NumberOfLines)
m_xFT_NumberOfLines->hide();
if (m_xMF_NumberOfLines)
m_xMF_NumberOfLines->hide();
+
+ if(m_pFT_NumberOfLines)
+ m_pFT_NumberOfLines->Hide();
+ if(m_pMF_NumberOfLines)
+ m_pMF_NumberOfLines->Hide();
}
void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
, const uno::Reference< XChartDocument >& xChartModel
, const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
{
- if (!m_xMF_NumberOfLines)
+ if (!m_xMF_NumberOfLines && !m_pMF_NumberOfLines)
return;
+ bool bIsWelded = m_xMF_NumberOfLines != nullptr;
+
uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY );
uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
@@ -1330,18 +1366,31 @@ void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypePar
}
if( nNumLines < 0 )
nNumLines = 0;
- m_xMF_NumberOfLines->set_value(nNumLines);
+
+ if (bIsWelded)
+ m_xMF_NumberOfLines->set_value(nNumLines);
+ else
+ m_pMF_NumberOfLines->SetValue( nNumLines );
sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xModel ).size() - 1;
if( nMaxLines < 0 )
nMaxLines = 0;
- m_xMF_NumberOfLines->set_max(nMaxLines);
+
+ if (bIsWelded)
+ m_xMF_NumberOfLines->set_max(nMaxLines);
+ else
+ {
+ m_pMF_NumberOfLines->SetLast( nMaxLines );
+ m_pMF_NumberOfLines->SetMax( nMaxLines );
+ }
}
void CombiColumnLineChartDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
{
+ bool bIsWelded = m_xMF_NumberOfLines != nullptr;
if( xTemplateProps.is() )
{
- sal_Int32 nNumLines = m_xMF_NumberOfLines->get_value();
+ sal_Int32 nNumLines =
+ bIsWelded ? m_xMF_NumberOfLines->get_value() : static_cast< sal_Int32 >(m_pMF_NumberOfLines->GetValue());
xTemplateProps->setPropertyValue( "NumberOfLines" , uno::Any(nNumLines) );
}
}
@@ -1351,6 +1400,13 @@ IMPL_LINK_NOARG(CombiColumnLineChartDialogController, ChangeLineCountHdl, weld::
if( m_pChangeListener )
m_pChangeListener->stateChanged(this);
}
+
+IMPL_LINK_NOARG(CombiColumnLineChartDialogController, ChangeLineCountHdl_unwelded, Edit&, void)
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+}
+
void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
{
rParameter.b3DLook = false;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index ce489996d2d7..6f19ab1cddcd 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -32,6 +32,7 @@
#include <svtools/controldims.hxx>
#include <svtools/valueset.hxx>
+#include <vcl/fixed.hxx>
#include <o3tl/make_unique.hxx>
#include <vcl/weld.hxx>
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index 006e9818a8f3..8edc16265baa 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -867,7 +867,7 @@ void ChartTypePanel::showAllControls(ChartTypeDialogController& rTypeController)
m_pSortByXValuesResourceGroup->showControls(bShow);
// TODO: Extend ChartTypeDialogController::showExtraControls()
- //rTypeController.showExtraControls(this);
+ rTypeController.showExtraControls(this);
}
void ChartTypePanel::fillAllControls(const ChartTypeParameter& rParameter,
diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx
index c1b3411a3840..008975ce71ef 100644
--- a/chart2/source/inc/ChartTypeDialogController.hxx
+++ b/chart2/source/inc/ChartTypeDialogController.hxx
@@ -37,6 +37,7 @@ namespace com { namespace sun { namespace star { namespace lang { class XMultiSe
class SvtValueSet;
class ValueSet;
+class VclBuilderContainer;
namespace chart
{
@@ -104,6 +105,7 @@ public:
virtual bool shouldShow_SortByXValuesResourceGroup() const;
virtual void showExtraControls(weld::Builder* pBuilder);
+ virtual void showExtraControls(VclBuilderContainer* pParent);
virtual void hideExtraControls() const;
virtual void fillExtraControls( const ChartTypeParameter& rParameter
, const css::uno::Reference< css::chart2::XChartDocument >& xChartModel
@@ -279,6 +281,7 @@ public:
virtual void adjustParameterToSubType( ChartTypeParameter& rParameter ) override;
virtual void showExtraControls(weld::Builder* pBuilder) override;
+ virtual void showExtraControls(VclBuilderContainer* pParent) override;
virtual void hideExtraControls() const override;
virtual void fillExtraControls( const ChartTypeParameter& rParameter
, const css::uno::Reference< css::chart2::XChartDocument >& xChartModel
@@ -288,10 +291,16 @@ public:
private:
DECL_LINK(ChangeLineCountHdl, weld::SpinButton&, void);
+ //Needed for showExtraControls() overload
+ DECL_LINK( ChangeLineCountHdl_unwelded, Edit&, void );
private:
std::unique_ptr<weld::Label> m_xFT_NumberOfLines;
std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines;
+
+ //Needed for showExtraControls() overload
+ VclPtr<FixedText> m_pFT_NumberOfLines;
+ VclPtr<NumericField> m_pMF_NumberOfLines;
};
class BubbleChartDialogController : public ChartTypeDialogController