summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/main/ChartController_Window.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/main/ChartController_Window.cxx')
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx556
1 files changed, 267 insertions, 289 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index b8d925427736..375c2824a8a1 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -22,12 +22,14 @@
#include <string_view>
#include <ChartController.hxx>
+#include <ChartView.hxx>
#include <PositionAndSizeHelper.hxx>
#include <ObjectIdentifier.hxx>
#include <ChartWindow.hxx>
#include <ResId.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
#include <DiagramHelper.hxx>
#include <Diagram.hxx>
#include <TitleHelper.hxx>
@@ -42,8 +44,12 @@
#include <RelativePositionHelper.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <StatisticsHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <LegendHelper.hxx>
#include <servicenames_charttypes.hxx>
@@ -53,24 +59,17 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/awt/PopupMenuDirection.hpp>
#include <com/sun/star/frame/DispatchHelper.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/qa/XDumper.hpp>
#include <comphelper/lok.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/propertyvalue.hxx>
-#include <comphelper/sequence.hxx>
-
-#include <toolkit/awt/vclxmenu.hxx>
#include <sfx2/viewsh.hxx>
#include <svx/ActionDescriptionProvider.hxx>
@@ -84,8 +83,10 @@
#include <vcl/weld.hxx>
#include <vcl/ptrstyle.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <boost/property_tree/json_parser.hpp>
#include <sfx2/dispatch.hxx>
@@ -95,6 +96,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
namespace chart
@@ -148,7 +150,7 @@ void lcl_insertMenuCommand(
xMenu->setCommand( nId, rCommand );
}
-OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
+OUString lcl_getFormatCommandForObjectCID( std::u16string_view rCID )
{
OUString aDispatchCommand( ".uno:FormatSelection" );
@@ -265,8 +267,7 @@ void SAL_CALL ChartController::setPosSize(
pChartWindow->setPosSizePixel( X, Y, Width, Height, static_cast<PosSizeFlags>(Flags) );
//#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
- uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
- if( xProp.is() )
+ if( m_xChartView.is() )
{
auto aZoomFactors(::comphelper::InitPropertySequence({
{ "ScaleXNumerator", uno::Any( nScaleXNumerator ) },
@@ -274,7 +275,7 @@ void SAL_CALL ChartController::setPosSize(
{ "ScaleYNumerator", uno::Any( nScaleYNumerator ) },
{ "ScaleYDenominator", uno::Any( nScaleYDenominator ) }
}));
- xProp->setPropertyValue( "ZoomFactors", uno::Any( aZoomFactors ));
+ m_xChartView->setPropertyValue( "ZoomFactors", uno::Any( aZoomFactors ));
}
//a correct work area is at least necessary for correct values in the position and size dialog and for dragging area
@@ -461,14 +462,13 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
{
try
{
- uno::Reference<frame::XModel> xModel(getModel());
+ rtl::Reference<ChartModel> xModel(getChartModel());
//OSL_ENSURE( xModel.is(), "ChartController::execute_Paint: have no model to paint");
if (!xModel.is())
return;
//better performance for big data
- uno::Reference<beans::XPropertySet> xProp(m_xChartView, uno::UNO_QUERY);
- if (xProp.is())
+ if (m_xChartView.is())
{
awt::Size aResolution(1000, 1000);
{
@@ -480,12 +480,11 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
aResolution.Height = pChartWindow->GetSizePixel().Height();
}
}
- xProp->setPropertyValue( "Resolution", uno::Any( aResolution ));
+ m_xChartView->setPropertyValue( "Resolution", uno::Any( aResolution ));
}
- uno::Reference< util::XUpdatable > xUpdatable( m_xChartView, uno::UNO_QUERY );
- if (xUpdatable.is())
- xUpdatable->update();
+ if (m_xChartView.is())
+ m_xChartView->update();
{
SolarMutexGuard aGuard;
@@ -705,7 +704,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
}
else
{
- OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
+ std::u16string_view aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
if( aDragMethodServiceName == ObjectIdentifier::getPieSegmentDragMethodServiceName() )
pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getChartModel() );
}
@@ -744,6 +743,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
m_bWaitingForMouseUp = false;
bool bNotifySelectionChange = false;
+ bool bEditText = false;
{
SolarMutexGuard aGuard;
@@ -843,7 +843,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) );
tools::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
- const E3dObject* pE3dObject(dynamic_cast< const E3dObject*>(pObj));
+ const E3dObject* pE3dObject(DynCastE3dObject(pObj));
if(nullptr != pE3dObject)
{
E3dScene* pScene(pE3dObject->getRootE3dSceneFromE3dObject());
@@ -864,17 +864,15 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
m_xUndoManager );
bool bChanged = false;
- css::uno::Reference< css::frame::XModel > xModel = getModel();
- ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
- assert(pModel);
+ rtl::Reference< ChartModel > xModel = getChartModel();
if ( eObjectType == OBJECTTYPE_LEGEND )
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , true );
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *xModel, false , true );
bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
- , getChartModel()
- , awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getWidth(),aObjectRect.getHeight())
+ , xModel
+ , awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getOpenWidth(),aObjectRect.getOpenHeight())
, awt::Rectangle(aOldObjectRect.Left(), aOldObjectRect.Top(), 0, 0)
- , awt::Rectangle(aPageRect.Left(),aPageRect.Top(),aPageRect.getWidth(),aPageRect.getHeight()) );
+ , awt::Rectangle(aPageRect.Left(),aPageRect.Top(),aPageRect.getOpenWidth(),aPageRect.getOpenHeight()) );
if( bMoved || bChanged )
{
@@ -922,7 +920,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if( isDoubleClick(rMEvt) && !bMouseUpWithoutMouseDown /*#i106966#*/ )
{
Point aMousePixel = rMEvt.GetPosPixel();
- execute_DoubleClick( &aMousePixel );
+ execute_DoubleClick( &aMousePixel, bEditText );
}
if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
@@ -931,18 +929,17 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
impl_SetMousePointer( rMEvt );
- if(bNotifySelectionChange)
+ if(bNotifySelectionChange || bEditText)
impl_notifySelectionChangeListeners();
}
-void ChartController::execute_DoubleClick( const Point* pMousePixel )
+void ChartController::execute_DoubleClick( const Point* pMousePixel, bool &bEditText )
{
const SfxViewShell* pViewShell = SfxViewShell::Current();
- bool isMobilePhone = pViewShell && pViewShell->isLOKMobilePhone();
- if (isMobilePhone)
+ bool notAllowed = pViewShell && (pViewShell->isLOKMobilePhone() || pViewShell->IsLokReadOnlyView());
+ if (notAllowed)
return;
- bool bEditText = false;
if ( m_aSelection.hasSelection() )
{
OUString aCID( m_aSelection.getSelectedCID() );
@@ -958,7 +955,7 @@ void ChartController::execute_DoubleClick( const Point* pMousePixel )
{
// #i12587# support for shapes in chart
SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
- if ( dynamic_cast< const SdrTextObj* >(pObj) != nullptr )
+ if ( DynCastSdrTextObj(pObj) != nullptr )
{
bEditText = true;
}
@@ -1006,8 +1003,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
impl_notifySelectionChangeListeners();
- css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( m_xCC->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", m_xCC ), css::uno::UNO_QUERY );
+ rtl::Reference< VCLXPopupMenu > xPopupMenu = new VCLXPopupMenu();
Point aPos( rCEvt.GetMousePosPixel() );
if( !rCEvt.IsMouseEvent() )
@@ -1022,254 +1018,249 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
aMenuName = m_pDrawViewWrapper->IsTextEdit() ? std::u16string_view( u"drawtext" ) : std::u16string_view( u"draw" );
else
{
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
+
// todo: the context menu should be specified by an xml file in uiconfig
- if( xPopupMenu.is())
+ sal_Int16 nUniqueId = 1;
+ if (eObjectType != OBJECTTYPE_DATA_TABLE)
{
- sal_Int16 nUniqueId = 1;
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Cut" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Copy" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Paste" );
xPopupMenu->insertSeparator( -1 );
+ }
- ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
- rtl::Reference< Diagram > xDiagram = getFirstDiagram();
+ rtl::Reference< Diagram > xDiagram = getFirstDiagram();
- OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand );
+ OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand );
+ if (eObjectType == OBJECTTYPE_TITLE && m_pDrawViewWrapper->IsTextEdit())
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FontDialog" );
- //some commands for dataseries and points:
+ //some commands for dataseries and points:
- if( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_POINT )
+ if( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_POINT )
+ {
+ bool bIsPoint = ( eObjectType == OBJECTTYPE_DATA_POINT );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
+ rtl::Reference< RegressionCurveModel > xTrendline = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xSeries );
+ bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
+ rtl::Reference< RegressionCurveModel > xMeanValue = RegressionCurveHelper::getMeanValueLine( xSeries );
+ bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries );
+ bool bHasXErrorBars = StatisticsHelper::hasErrorBars( xSeries, false );
+ bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
+ bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
+ bool bHasDataLabelAtPoint = false;
+ sal_Int32 nPointIndex = -1;
+ if( bIsPoint )
{
- bool bIsPoint = ( eObjectType == OBJECTTYPE_DATA_POINT );
- uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
- uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
- Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) );
- bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
- Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) );
- bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries );
- bool bHasXErrorBars = StatisticsHelper::hasErrorBars( xSeries, false );
- bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
- bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
- bool bHasDataLabelAtPoint = false;
- sal_Int32 nPointIndex = -1;
- if( bIsPoint )
- {
- nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
- bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
- }
- bool bSelectedPointIsFormatted = false;
- bool bHasFormattedDataPointsOtherThanSelected = false;
+ nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
+ bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
+ }
+ bool bSelectedPointIsFormatted = false;
+ bool bHasFormattedDataPointsOtherThanSelected = false;
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
- uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( aAttributedDataPointIndexList.hasElements() )
{
- if( aAttributedDataPointIndexList.hasElements() )
+ if( bIsPoint )
{
- if( bIsPoint )
- {
- auto aIndices( comphelper::sequenceToContainer<std::vector< sal_Int32 >>( aAttributedDataPointIndexList ) );
- std::vector< sal_Int32 >::iterator aIt = std::find( aIndices.begin(), aIndices.end(), nPointIndex );
- if( aIt != aIndices.end())
- bSelectedPointIsFormatted = true;
- else
- bHasFormattedDataPointsOtherThanSelected = true;
- }
+ auto aIt = std::find( aAttributedDataPointIndexList.begin(), aAttributedDataPointIndexList.end(), nPointIndex );
+ if (aIt != aAttributedDataPointIndexList.end())
+ bSelectedPointIsFormatted = true;
else
bHasFormattedDataPointsOtherThanSelected = true;
}
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
}
}
+ }
- if( bIsPoint )
- {
- if( bHasDataLabelAtPoint )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabel" );
- if( !bHasDataLabelAtPoint )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabel" );
- else
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabel" );
- if( bSelectedPointIsFormatted )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetDataPoint" );
+ if( bIsPoint )
+ {
+ if( bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabel" );
+ if( !bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabel" );
+ else
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabel" );
+ if( bSelectedPointIsFormatted )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetDataPoint" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataSeries" );
- }
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataSeries" );
+ }
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
- if( xChartType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
+ if( xChartType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
+ {
+ try
{
- try
- {
- Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if( xChartTypeProp.is() )
- {
- bool bJapaneseStyle = false;
- xChartTypeProp->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
-
- if( bJapaneseStyle )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
- }
- }
- }
- catch( const uno::Exception & )
+ bool bJapaneseStyle = false;
+ xChartType->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
+
+ if( bJapaneseStyle )
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
}
}
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
- if( bHasDataLabelsAtSeries )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" );
- if( bHasEquation )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
- if( xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMeanValue" );
- if( bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatXErrorBars" );
- if( bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatYErrorBars" );
+ if( bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMeanValue" );
+ if( bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatXErrorBars" );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatYErrorBars" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- if( !bHasDataLabelsAtSeries )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" );
-
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" );
-
- if( !xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" );
- if( !bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertXErrorBars" );
- if( !bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertYErrorBars" );
- if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" );
- if( bHasEquation )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
- if( xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMeanValue" );
- if( bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteXErrorBars" );
- if( bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteYErrorBars" );
-
- if( bHasFormattedDataPointsOtherThanSelected )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetAllDataPoints" );
+ if( !bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" );
+
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" );
+
+ if( !xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" );
+ if( !bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertXErrorBars" );
+ if( !bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertYErrorBars" );
+ if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMeanValue" );
+ if( bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteXErrorBars" );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteYErrorBars" );
+
+ if( bHasFormattedDataPointsOtherThanSelected )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetAllDataPoints" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId, ".uno:ArrangeRow" );
- uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
- m_xCC->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", m_xCC ), uno::UNO_QUERY );
- if( xArrangePopupMenu.is() )
- {
- sal_Int16 nSubId = nUniqueId + 1;
- lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, ".uno:Forward" );
- lcl_insertMenuCommand( xArrangePopupMenu, nSubId, ".uno:Backward" );
- xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
- nUniqueId = nSubId;
- }
- ++nUniqueId;
- }
- else if( eObjectType == OBJECTTYPE_DATA_CURVE )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
- }
- else if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
- }
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId, ".uno:ArrangeRow" );
+ rtl::Reference< VCLXPopupMenu > xArrangePopupMenu = new VCLXPopupMenu();
+ sal_Int16 nSubId = nUniqueId + 1;
+ lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, ".uno:Forward" );
+ lcl_insertMenuCommand( xArrangePopupMenu, nSubId, ".uno:Backward" );
+ xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
+ nUniqueId = nSubId;
+ ++nUniqueId;
+ }
+ else if( eObjectType == OBJECTTYPE_DATA_CURVE )
+ {
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
+ }
+ else if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ {
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
+ }
- //some commands for axes: and grids
+ //some commands for axes: and grids
- else if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_GRID || eObjectType == OBJECTTYPE_SUBGRID )
+ else if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_GRID || eObjectType == OBJECTTYPE_SUBGRID )
+ {
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
+ if( xAxis.is() && xDiagram.is() )
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
- if( xAxis.is() && xDiagram.is() )
- {
- sal_Int32 nDimensionIndex = -1;
- sal_Int32 nCooSysIndex = -1;
- sal_Int32 nAxisIndex = -1;
- AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
- bool bIsSecondaryAxis = nAxisIndex!=0;
- bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
- bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
- bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
- bool bHasTitle = false;
- uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
- if( xTitled.is())
- bHasTitle = !TitleHelper::getCompleteString( xTitled->getTitleObject() ).isEmpty();
-
- if( eObjectType != OBJECTTYPE_AXIS && bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatAxis" );
- if( eObjectType != OBJECTTYPE_GRID && bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMajorGrid" );
- if( eObjectType != OBJECTTYPE_SUBGRID && bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMinorGrid" );
-
- xPopupMenu->insertSeparator( -1 );
-
- if( eObjectType != OBJECTTYPE_AXIS && !bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxis" );
- if( eObjectType != OBJECTTYPE_GRID && !bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMajorGrid" );
- if( eObjectType != OBJECTTYPE_SUBGRID && !bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMinorGrid" );
- if( !bHasTitle )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxisTitle" );
-
- if( bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteAxis" );
- if( bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMajorGrid" );
- if( bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMinorGrid" );
- }
- }
-
- if( eObjectType == OBJECTTYPE_DATA_STOCK_LOSS )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
- else if( eObjectType == OBJECTTYPE_DATA_STOCK_GAIN )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
+ bool bIsSecondaryAxis = nAxisIndex!=0;
+ bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
+ bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
+ bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
+ bool bHasTitle = !TitleHelper::getCompleteString( xAxis->getTitleObject2() ).isEmpty();
+
+ if( eObjectType != OBJECTTYPE_AXIS && bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatAxis" );
+ if( eObjectType != OBJECTTYPE_GRID && bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMajorGrid" );
+ if( eObjectType != OBJECTTYPE_SUBGRID && bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMinorGrid" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:TransformDialog" );
+ xPopupMenu->insertSeparator( -1 );
- if( eObjectType == OBJECTTYPE_PAGE || eObjectType == OBJECTTYPE_DIAGRAM
- || eObjectType == OBJECTTYPE_DIAGRAM_WALL
- || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR
- || eObjectType == OBJECTTYPE_UNKNOWN )
- {
- if( eObjectType != OBJECTTYPE_UNKNOWN )
- xPopupMenu->insertSeparator( -1 );
- bool bHasLegend = LegendHelper::hasLegend( xDiagram );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTitles" );
- if( !bHasLegend )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertLegend" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertRemoveAxes" );
- if( bHasLegend )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteLegend" );
+ if( eObjectType != OBJECTTYPE_AXIS && !bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxis" );
+ if( eObjectType != OBJECTTYPE_GRID && !bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMajorGrid" );
+ if( eObjectType != OBJECTTYPE_SUBGRID && !bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMinorGrid" );
+ if( !bHasTitle )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxisTitle" );
+
+ if( bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteAxis" );
+ if( bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMajorGrid" );
+ if( bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMinorGrid" );
+ if (bIsAxisVisible)
+ lcl_insertMenuCommand(xPopupMenu, nUniqueId++, ".uno:InsertDataTable");
}
+ }
+ else if (eObjectType == OBJECTTYPE_DATA_TABLE)
+ {
+ lcl_insertMenuCommand(xPopupMenu, nUniqueId++, ".uno:DeleteDataTable");
+ }
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramType" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" );
+ if( eObjectType == OBJECTTYPE_DATA_STOCK_LOSS )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
+ else if( eObjectType == OBJECTTYPE_DATA_STOCK_GAIN )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:TransformDialog" );
+
+ if( eObjectType == OBJECTTYPE_PAGE || eObjectType == OBJECTTYPE_DIAGRAM
+ || eObjectType == OBJECTTYPE_DIAGRAM_WALL
+ || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR
+ || eObjectType == OBJECTTYPE_UNKNOWN )
+ {
+ if( eObjectType != OBJECTTYPE_UNKNOWN )
+ xPopupMenu->insertSeparator( -1 );
+ bool bHasLegend = LegendHelper::hasLegend( xDiagram );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTitles" );
+ if( !bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertLegend" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertRemoveAxes" );
+ if( bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteLegend" );
}
+
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramType" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" );
}
css::uno::Sequence< css::uno::Any > aArgs{
@@ -1303,14 +1294,13 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
}
}
- Menu* pPopupMenu = comphelper::getFromUnoTunnel<VCLXMenu>(xPopupMenu)->GetMenu();
- boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(pPopupMenu);
+ boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(xPopupMenu);
boost::property_tree::ptree aRoot;
aRoot.add_child("menu", aMenu);
std::stringstream aStream;
boost::property_tree::write_json(aStream, aRoot, true);
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, OString(aStream.str()));
}
}
else
@@ -1330,8 +1320,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
( rCEvt.GetCommand() == CommandEventId::InputContextChange ) )
{
//#i84417# enable editing with IME
- if( m_pDrawViewWrapper )
- m_pDrawViewWrapper->Command( rCEvt, pChartWindow );
+ m_pDrawViewWrapper->Command( rCEvt, pChartWindow );
}
}
@@ -1384,7 +1373,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
// Navigation (Tab/F3/Home/End)
rtl::Reference<::chart::ChartModel> xChartDoc( getChartModel() );
- ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView ));
+ ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, m_xChartView.get() );
awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode ));
bReturn = aObjNav.handleKeyEvent( aKeyEvent );
if( bReturn )
@@ -1427,7 +1416,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
nCode == KEY_DOWN )
{
bDrag = true;
- OUString aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
+ std::u16string_view aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
sal_Int32 nOffsetPercentDummy( 0 );
awt::Point aMinimumPosition( 0, 0 );
awt::Point aMaximumPosition( 0, 0 );
@@ -1532,7 +1521,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
else
bReturn = PositionAndSizeHelper::moveObject(
m_aSelection.getSelectedCID(), getChartModel(),
- awt::Rectangle(aRect.Left() + fShiftAmountX, aRect.Top() + fShiftAmountY, aRect.getWidth(), aRect.getHeight()),
+ awt::Rectangle(aRect.Left() + fShiftAmountX, aRect.Top() + fShiftAmountY, aRect.getOpenWidth(), aRect.getOpenHeight()),
awt::Rectangle(aRect.Left(), aRect.Top(), 0, 0),
awt::Rectangle(0, 0, aPageSize.Width, aPageSize.Height));
}
@@ -1572,10 +1561,10 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
// dumping the shape
if( !bReturn && bCtrl && nCode == KEY_F12)
{
- uno::Reference< qa::XDumper > xChartModel( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xChartModel = getChartModel();
if(xChartModel.is())
{
- OUString aDump = xChartModel->dump();
+ OUString aDump = xChartModel->dump("shapes");
SAL_WARN("chart2", aDump);
}
}
@@ -1613,10 +1602,10 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
bReturn = executeDispatch_Delete();
if( ! bReturn )
{
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow->GetFrameWeld(),
+ std::shared_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow->GetFrameWeld(),
VclMessageType::Info, VclButtonsType::Ok,
SchResId(STR_ACTION_NOTPOSSIBLE)));
- xInfoBox->run();
+ xInfoBox->runAsync(xInfoBox, [] (int) {});
}
}
@@ -1650,10 +1639,8 @@ bool ChartController::requestQuickHelp(
rOutQuickHelpText = ObjectNameProvider::getHelpText( aCID, xChartModel, bIsBalloonHelp /* bVerbose */ );
// set rectangle
- ExplicitValueProvider * pValueProvider(
- comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView ));
- if( pValueProvider )
- rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true );
+ if( m_xChartView )
+ rOutEqualRect = m_xChartView->getRectangleOfObject( aCID, true );
}
return bResult;
@@ -1738,7 +1725,8 @@ void SAL_CALL ChartController::addSelectionChangeListener( const uno::Reference<
return; //behave passive if already disposed or suspended
//--add listener
- m_aLifeTimeManager.m_aListenerContainer.addInterface( cppu::UnoType<view::XSelectionChangeListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aSelectionChangeListeners.addInterface( aGuard2, xListener );
}
void SAL_CALL ChartController::removeSelectionChangeListener( const uno::Reference<view::XSelectionChangeListener> & xListener )
@@ -1748,22 +1736,18 @@ void SAL_CALL ChartController::removeSelectionChangeListener( const uno::Referen
return; //behave passive if already disposed or suspended
//--remove listener
- m_aLifeTimeManager.m_aListenerContainer.removeInterface( cppu::UnoType<view::XSelectionChangeListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aSelectionChangeListeners.removeInterface( aGuard2, xListener );
}
void ChartController::impl_notifySelectionChangeListeners()
{
- ::comphelper::OInterfaceContainerHelper2* pIC = m_aLifeTimeManager.m_aListenerContainer
- .getContainer( cppu::UnoType<view::XSelectionChangeListener>::get() );
- if( pIC )
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ if( m_aLifeTimeManager.m_aSelectionChangeListeners.getLength(aGuard) )
{
uno::Reference< view::XSelectionSupplier > xSelectionSupplier(this);
lang::EventObject aEvent( xSelectionSupplier );
- ::comphelper::OInterfaceIteratorHelper2 aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- static_cast< view::XSelectionChangeListener* >( aIt.next() )->selectionChanged( aEvent );
- }
+ m_aLifeTimeManager.m_aSelectionChangeListeners.notifyEach(aGuard, &view::XSelectionChangeListener::selectionChanged, aEvent);
}
}
@@ -1805,8 +1789,7 @@ bool ChartController::impl_moveOrResizeObject(
if( ( bDeterminePos || bDetermineSize ) &&
( aRefSize.Width > 0 && aRefSize.Height > 0 ) )
{
- ExplicitValueProvider * pValueProvider(
- comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView ));
+ ExplicitValueProvider * pValueProvider( m_xChartView.get() );
if( pValueProvider )
{
awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID ));
@@ -1863,15 +1846,15 @@ bool ChartController::impl_moveOrResizeObject(
return bResult;
}
-bool ChartController::impl_DragDataPoint( const OUString & rCID, double fAdditionalOffset )
+bool ChartController::impl_DragDataPoint( std::u16string_view rCID, double fAdditionalOffset )
{
bool bResult = false;
if( fAdditionalOffset < -1.0 || fAdditionalOffset > 1.0 || fAdditionalOffset == 0.0 )
return bResult;
sal_Int32 nDataPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rCID );
- uno::Reference< chart2::XDataSeries > xSeries(
- ObjectIdentifier::getDataSeriesForCID( rCID, getChartModel() ));
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( rCID, getChartModel() );
if( xSeries.is())
{
try
@@ -2073,12 +2056,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
pChartWindow->SetPointer( PointerStyle::Arrow );
}
-css::uno::Reference<css::uno::XInterface> const & ChartController::getChartView() const
-{
- return m_xChartView;
-}
-
-void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle)
+void ChartController::sendPopupRequest(std::u16string_view rCID, tools::Rectangle aRectangle)
{
ChartModel* pChartModel = m_aModel->getModel().get();
if (!pChartModel)
@@ -2097,11 +2075,11 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
return;
// Get dimension index from CID
- sal_Int32 nStartPos = rCID.lastIndexOf('.');
+ size_t nStartPos = rCID.rfind('.');
nStartPos++;
- sal_Int32 nEndPos = rCID.getLength();
- OUString sDimensionIndex = rCID.copy(nStartPos, nEndPos - nStartPos);
- sal_Int32 nDimensionIndex = sDimensionIndex.toInt32();
+ sal_Int32 nEndPos = rCID.size();
+ std::u16string_view sDimensionIndex = rCID.substr(nStartPos, nEndPos - nStartPos);
+ sal_Int32 nDimensionIndex = o3tl::toInt32(sDimensionIndex);
awt::Rectangle xRectangle {
sal_Int32(aRectangle.Left()),
@@ -2112,12 +2090,12 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
uno::Sequence<beans::PropertyValue> aCallbackData = comphelper::InitPropertySequence(
{
- {"Rectangle", uno::makeAny<awt::Rectangle>(xRectangle)},
- {"DimensionIndex", uno::makeAny<sal_Int32>(nDimensionIndex)},
- {"PivotTableName", uno::makeAny<OUString>(sPivotTableName)},
+ {"Rectangle", uno::Any(xRectangle)},
+ {"DimensionIndex", uno::Any(sal_Int32(nDimensionIndex))},
+ {"PivotTableName", uno::Any(sPivotTableName)},
});
- pPopupRequest->getCallback()->notify(uno::makeAny(aCallbackData));
+ pPopupRequest->getCallback()->notify(uno::Any(aCallbackData));
}
} //namespace chart