summaryrefslogtreecommitdiff
path: root/chart2/source/controller/main/ElementSelector.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/main/ElementSelector.cxx')
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index e56da4fc6173..36ea5dabfc18 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -27,16 +27,13 @@
#include <ObjectIdentifier.hxx>
#include <ChartController.hxx>
#include <ChartModel.hxx>
+#include <ChartView.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/safeint.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
namespace chart { class ExplicitValueProvider; }
namespace chart
@@ -55,8 +52,8 @@ constexpr OUStringLiteral lcl_aServiceName
}
SelectorListBox::SelectorListBox(vcl::Window* pParent)
- : InterimItemWindow(pParent, "modules/schart/ui/combobox.ui", "ComboBox")
- , m_xWidget(m_xBuilder->weld_combo_box("combobox"))
+ : InterimItemWindow(pParent, u"modules/schart/ui/combobox.ui"_ustr, u"ComboBox"_ustr)
+ , m_xWidget(m_xBuilder->weld_combo_box(u"combobox"_ustr))
, m_bReleaseFocus(true)
{
InitControlBase(m_xWidget.get());
@@ -111,7 +108,7 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
if( xChartController.is() )
{
ObjectIdentifier aSelectedOID( xChartController->getSelection() );
- OUString aSelectedCID = aSelectedOID.getObjectCID();
+ const OUString& aSelectedCID = aSelectedOID.getObjectCID();
rtl::Reference<::chart::ChartModel> xChartDoc = xChartController->getChartModel();
ObjectType eType( aSelectedOID.getObjectType() );
@@ -119,11 +116,11 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
if ( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL || eType == OBJECTTYPE_SHAPE )
bAddSelectionToList = true;
- Reference< uno::XInterface > xChartView;
- Reference< lang::XMultiServiceFactory > xFact( xChartController->getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartView > xChartView;
+ rtl::Reference< ChartModel > xFact = xChartController->getChartModel();
if( xFact.is() )
- xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
- ExplicitValueProvider* pExplicitValueProvider = nullptr; //ExplicitValueProvider::getExplicitValueProvider(xChartView); this creates all visible data points, that's too much
+ xChartView = xFact->createChartView();
+ ChartView* pExplicitValueProvider = nullptr; //ExplicitValueProvider::getExplicitValueProvider(xChartView); this creates all visible data points, that's too much
ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
lcl_addObjectsToList( aHierarchy, ::chart::ObjectHierarchy::getRootNodeOID(), m_aEntries, 0, xChartDoc );
@@ -162,7 +159,8 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
sal_uInt16 nN=0;
for (auto const& entry : m_aEntries)
{
- m_xWidget->append_text(entry.UIName);
+ // tdf#152087 strip any newlines from the entry
+ m_xWidget->append_text(entry.UIName.replaceAll("\n", " "));
if ( !bSelectionFound && aSelectedOID == entry.OID )
{
nEntryPosToSelect = nN;
@@ -254,7 +252,7 @@ sal_Bool SAL_CALL ElementSelectorToolbarController::supportsService( const OUStr
css::uno::Sequence< OUString > SAL_CALL ElementSelectorToolbarController::getSupportedServiceNames()
{
- return { "com.sun.star.frame.ToolbarController" };
+ return { u"com.sun.star.frame.ToolbarController"_ustr };
}
ElementSelectorToolbarController::ElementSelectorToolbarController()
{
@@ -288,7 +286,7 @@ void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::Feat
Reference< frame::XController > xChartController;
rEvent.State >>= xChartController;
::chart::ChartController* pController = dynamic_cast<::chart::ChartController*>(xChartController.get());
- assert(pController);
+ assert(!xChartController || pController);
m_apSelectorListBox->SetChartController( pController );
m_apSelectorListBox->UpdateChartElementsListAndSelection();
}