LCOV - code coverage report
Current view: top level - chart2/source/controller/main - ChartController_Insert.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 420 0.0 %
Date: 2012-08-25 Functions: 0 36 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1508 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "ChartController.hxx"
      21                 :            : 
      22                 :            : #include "dlg_InsertAxis_Grid.hxx"
      23                 :            : #include "dlg_InsertDataLabel.hxx"
      24                 :            : #include "dlg_InsertLegend.hxx"
      25                 :            : #include "dlg_InsertTrendline.hxx"
      26                 :            : #include "dlg_InsertErrorBars.hxx"
      27                 :            : #include "dlg_InsertTitle.hxx"
      28                 :            : #include "dlg_ObjectProperties.hxx"
      29                 :            : 
      30                 :            : #include "ChartWindow.hxx"
      31                 :            : #include "ChartModelHelper.hxx"
      32                 :            : #include "AxisHelper.hxx"
      33                 :            : #include "TitleHelper.hxx"
      34                 :            : #include "DiagramHelper.hxx"
      35                 :            : #include "macros.hxx"
      36                 :            : #include "chartview/DrawModelWrapper.hxx"
      37                 :            : #include "NumberFormatterWrapper.hxx"
      38                 :            : #include "ViewElementListProvider.hxx"
      39                 :            : #include "MultipleChartConverters.hxx"
      40                 :            : #include "ControllerLockGuard.hxx"
      41                 :            : #include "UndoGuard.hxx"
      42                 :            : #include "ResId.hxx"
      43                 :            : #include "Strings.hrc"
      44                 :            : #include "ReferenceSizeProvider.hxx"
      45                 :            : #include "ObjectIdentifier.hxx"
      46                 :            : #include "RegressionCurveHelper.hxx"
      47                 :            : #include "RegressionCurveItemConverter.hxx"
      48                 :            : #include "StatisticsHelper.hxx"
      49                 :            : #include "ErrorBarItemConverter.hxx"
      50                 :            : #include "MultipleItemConverter.hxx"
      51                 :            : #include "DataSeriesHelper.hxx"
      52                 :            : #include "ObjectNameProvider.hxx"
      53                 :            : #include "LegendHelper.hxx"
      54                 :            : 
      55                 :            : #include <com/sun/star/chart2/XRegressionCurve.hpp>
      56                 :            : #include <com/sun/star/chart/ErrorBarStyle.hpp>
      57                 :            : #include <svx/ActionDescriptionProvider.hxx>
      58                 :            : 
      59                 :            : //--------------------------------------
      60                 :            : 
      61                 :            : // header for define RET_OK
      62                 :            : #include <vcl/msgbox.hxx>
      63                 :            : // header for class OUStringBuffer
      64                 :            : #include <rtl/ustrbuf.hxx>
      65                 :            : // header for class Application
      66                 :            : #include <vcl/svapp.hxx>
      67                 :            : // header for class ::vos::OGuard
      68                 :            : #include <osl/mutex.hxx>
      69                 :            : 
      70                 :            : 
      71                 :            : using namespace ::com::sun::star;
      72                 :            : using namespace ::com::sun::star::chart2;
      73                 :            : using ::com::sun::star::uno::Reference;
      74                 :            : using ::com::sun::star::uno::Sequence;
      75                 :            : using ::rtl::OUString;
      76                 :            : 
      77                 :            : //.............................................................................
      78                 :            : 
      79                 :            : namespace
      80                 :            : {
      81                 :          0 : struct lcl_InsertMeanValueLine
      82                 :            : {
      83                 :            : public:
      84                 :          0 :     lcl_InsertMeanValueLine( const uno::Reference< uno::XComponentContext > & xContext ) :
      85                 :          0 :             m_xContext( xContext )
      86                 :          0 :     {}
      87                 :            : 
      88                 :          0 :     void operator()( const uno::Reference< chart2::XDataSeries > & xSeries )
      89                 :            :     {
      90                 :            :         uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
      91         [ #  # ]:          0 :             xSeries, uno::UNO_QUERY );
      92         [ #  # ]:          0 :         if( xRegCurveCnt.is())
      93                 :            :         {
      94                 :            :             ::chart::RegressionCurveHelper::addMeanValueLine(
      95 [ #  # ][ #  # ]:          0 :                 xRegCurveCnt, m_xContext, uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ));
      96                 :          0 :         }
      97                 :          0 :     }
      98                 :            : 
      99                 :            : private:
     100                 :            :     uno::Reference< uno::XComponentContext > m_xContext;
     101                 :            : };
     102                 :            : 
     103                 :            : } // anonymous namespace
     104                 :            : 
     105                 :            : //.............................................................................
     106                 :            : namespace chart
     107                 :            : {
     108                 :            : //.............................................................................
     109                 :            : 
     110                 :          0 : void ChartController::executeDispatch_InsertAxes()
     111                 :            : {
     112                 :            :     UndoGuard aUndoGuard(
     113                 :            :         ActionDescriptionProvider::createDescription(
     114                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXES ))),
     115 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     116                 :            : 
     117                 :            :     try
     118                 :            :     {
     119         [ #  # ]:          0 :         InsertAxisOrGridDialogData aDialogInput;
     120 [ #  # ][ #  # ]:          0 :         uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
     121         [ #  # ]:          0 :         AxisHelper::getAxisOrGridExcistence( aDialogInput.aExistenceList, xDiagram, sal_True );
     122         [ #  # ]:          0 :         AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, sal_True );
     123                 :            : 
     124         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     125         [ #  # ]:          0 :         SchAxisDlg aDlg( m_pChartWindow, aDialogInput );
     126 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     127                 :            :         {
     128                 :            :             // lock controllers till end of block
     129 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     130                 :            : 
     131         [ #  # ]:          0 :             InsertAxisOrGridDialogData aDialogOutput;
     132         [ #  # ]:          0 :             aDlg.getResult( aDialogOutput );
     133                 :            :             ::std::auto_ptr< ReferenceSizeProvider > mpRefSizeProvider(
     134 [ #  # ][ #  # ]:          0 :                 impl_createReferenceSizeProvider());
     135                 :            :             bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
     136                 :            :                 , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC
     137         [ #  # ]:          0 :                 , mpRefSizeProvider.get() );
     138         [ #  # ]:          0 :             if( bChanged )
     139 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
         [ #  # ][ #  # ]
     140 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
     141                 :            :     }
     142         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     143                 :            :     {
     144                 :            :         ASSERT_EXCEPTION( e );
     145         [ #  # ]:          0 :     }
     146                 :          0 : }
     147                 :            : 
     148                 :          0 : void ChartController::executeDispatch_InsertGrid()
     149                 :            : {
     150                 :            :     UndoGuard aUndoGuard(
     151                 :            :         ActionDescriptionProvider::createDescription(
     152                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRIDS ))),
     153 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     154                 :            : 
     155                 :            :     try
     156                 :            :     {
     157         [ #  # ]:          0 :         InsertAxisOrGridDialogData aDialogInput;
     158 [ #  # ][ #  # ]:          0 :         uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
     159         [ #  # ]:          0 :         AxisHelper::getAxisOrGridExcistence( aDialogInput.aExistenceList, xDiagram, sal_False );
     160         [ #  # ]:          0 :         AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, sal_False );
     161                 :            : 
     162         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     163         [ #  # ]:          0 :         SchGridDlg aDlg( m_pChartWindow, aDialogInput );//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
     164 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     165                 :            :         {
     166                 :            :             // lock controllers till end of block
     167 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     168         [ #  # ]:          0 :             InsertAxisOrGridDialogData aDialogOutput;
     169         [ #  # ]:          0 :             aDlg.getResult( aDialogOutput );
     170                 :            :             bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
     171         [ #  # ]:          0 :                 , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
     172         [ #  # ]:          0 :             if( bChanged )
     173 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
                 [ #  # ]
     174 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
     175                 :            :     }
     176         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     177                 :            :     {
     178                 :            :         ASSERT_EXCEPTION( e );
     179         [ #  # ]:          0 :     }
     180                 :          0 : }
     181                 :            : 
     182                 :            : //-----------------------------------------------------------------------------
     183                 :            : //-----------------------------------------------------------------------------
     184                 :            : 
     185                 :          0 : void ChartController::executeDispatch_InsertTitles()
     186                 :            : {
     187                 :            :     UndoGuard aUndoGuard(
     188                 :            :         ActionDescriptionProvider::createDescription(
     189                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLES ))),
     190 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     191                 :            : 
     192                 :            :     try
     193                 :            :     {
     194 [ #  # ][ #  # ]:          0 :         TitleDialogData aDialogInput;
                 [ #  # ]
     195 [ #  # ][ #  # ]:          0 :         aDialogInput.readFromModel( getModel() );
     196                 :            : 
     197         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     198         [ #  # ]:          0 :         SchTitleDlg aDlg( m_pChartWindow, aDialogInput );
     199 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     200                 :            :         {
     201                 :            :             // lock controllers till end of block
     202 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     203 [ #  # ][ #  # ]:          0 :             TitleDialogData aDialogOutput( impl_createReferenceSizeProvider());
         [ #  # ][ #  # ]
     204         [ #  # ]:          0 :             aDlg.getResult( aDialogOutput );
     205 [ #  # ][ #  # ]:          0 :             bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
     206         [ #  # ]:          0 :             if( bChanged )
     207 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
                 [ #  # ]
     208 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
     209                 :            :     }
     210         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     211                 :            :     {
     212                 :            :         ASSERT_EXCEPTION( e );
     213         [ #  # ]:          0 :     }
     214                 :          0 : }
     215                 :            : 
     216                 :          0 : void ChartController::executeDispatch_DeleteLegend()
     217                 :            : {
     218                 :            :     UndoGuard aUndoGuard(
     219                 :            :         ActionDescriptionProvider::createDescription(
     220                 :            :             ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))),
     221 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     222                 :            : 
     223 [ #  # ][ #  # ]:          0 :     LegendHelper::hideLegend( getModel() );
     224 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     225                 :          0 : }
     226                 :            : 
     227                 :          0 : void ChartController::executeDispatch_InsertLegend()
     228                 :            : {
     229                 :            :     UndoGuard aUndoGuard(
     230                 :            :         ActionDescriptionProvider::createDescription(
     231                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))),
     232 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     233                 :            : 
     234 [ #  # ][ #  # ]:          0 :     Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC );
     235 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     236                 :          0 : }
     237                 :            : 
     238                 :          0 : void ChartController::executeDispatch_OpenLegendDialog()
     239                 :            : {
     240                 :            :     UndoGuard aUndoGuard(
     241                 :            :         ActionDescriptionProvider::createDescription(
     242                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))),
     243 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     244                 :            : 
     245                 :            :     try
     246                 :            :     {
     247                 :            :         //prepare and open dialog
     248         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     249         [ #  # ]:          0 :         SchLegendDlg aDlg( m_pChartWindow, m_xCC );
     250 [ #  # ][ #  # ]:          0 :         aDlg.init( getModel() );
     251 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     252                 :            :         {
     253                 :            :             // lock controllers till end of block
     254 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     255 [ #  # ][ #  # ]:          0 :             bool bChanged = aDlg.writeToModel( getModel() );
     256         [ #  # ]:          0 :             if( bChanged )
     257 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
     258 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     259                 :            :     }
     260         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     261                 :            :     {
     262                 :            :         ASSERT_EXCEPTION( e );
     263         [ #  # ]:          0 :     }
     264                 :          0 : }
     265                 :            : 
     266                 :            : //-----------------------------------------------------------------------------
     267                 :            : //-----------------------------------------------------------------------------
     268                 :            : 
     269                 :          0 : void ChartController::executeDispatch_InsertMenu_DataLabels()
     270                 :            : {
     271                 :            :     UndoGuard aUndoGuard(
     272                 :            :         ActionDescriptionProvider::createDescription(
     273                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_DATALABELS ))),
     274 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     275                 :            : 
     276                 :            :     //if a series is selected insert labels for that series only:
     277                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     278 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel()), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     279         [ #  # ]:          0 :     if( xSeries.is() )
     280                 :            :     {
     281                 :            :         // add labels
     282         [ #  # ]:          0 :         DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
     283                 :            : 
     284         [ #  # ]:          0 :         rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
     285         [ #  # ]:          0 :         aChildParticle+=(C2U("="));
     286                 :            :         rtl::OUString aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticles(
     287 [ #  # ][ #  # ]:          0 :             ObjectIdentifier::getSeriesParticleFromCID(m_aSelection.getSelectedCID()), aChildParticle );
                 [ #  # ]
     288                 :            : 
     289         [ #  # ]:          0 :         bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true );
     290         [ #  # ]:          0 :         if( bSuccess )
     291         [ #  # ]:          0 :             aUndoGuard.commit();
     292                 :          0 :         return;
     293                 :            :     }
     294                 :            : 
     295                 :            :     try
     296                 :            :     {
     297                 :            :         wrapper::AllDataLabelItemConverter aItemConverter(
     298                 :          0 :             getModel(),
     299         [ #  # ]:          0 :             m_pDrawModelWrapper->GetItemPool(),
     300         [ #  # ]:          0 :             m_pDrawModelWrapper->getSdrModel(),
     301 [ #  # ][ #  # ]:          0 :             uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
         [ #  # ][ #  # ]
     302         [ #  # ]:          0 :         SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
     303         [ #  # ]:          0 :         aItemConverter.FillItemSet( aItemSet );
     304                 :            : 
     305                 :            :         //prepare and open dialog
     306         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     307                 :            : 
     308                 :            :         //get number formatter
     309 [ #  # ][ #  # ]:          0 :         uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( getModel(), uno::UNO_QUERY );
     310         [ #  # ]:          0 :         NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
     311         [ #  # ]:          0 :         SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
     312                 :            : 
     313         [ #  # ]:          0 :         DataLabelsDialog aDlg( m_pChartWindow, aItemSet, pNumberFormatter);
     314                 :            : 
     315 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     316                 :            :         {
     317         [ #  # ]:          0 :             SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
     318         [ #  # ]:          0 :             aDlg.FillItemSet( aOutItemSet );
     319                 :            :             // lock controllers till end of block
     320 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     321         [ #  # ]:          0 :             bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
     322         [ #  # ]:          0 :             if( bChanged )
     323 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
                 [ #  # ]
     324 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     325                 :            :     }
     326         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     327                 :            :     {
     328                 :            :         ASSERT_EXCEPTION( e );
     329 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     330                 :            : }
     331                 :            : 
     332                 :          0 : void ChartController::executeDispatch_InsertMeanValue()
     333                 :            : {
     334                 :            :     UndoGuard aUndoGuard(
     335                 :            :         ActionDescriptionProvider::createDescription(
     336                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
     337 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     338                 :            :     lcl_InsertMeanValueLine( m_xCC ).operator()(
     339 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     340 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     341                 :          0 : }
     342                 :            : 
     343                 :          0 : void ChartController::executeDispatch_InsertMenu_MeanValues()
     344                 :            : {
     345                 :            :     UndoGuard aUndoGuard(
     346                 :            :         ActionDescriptionProvider::createDescription(
     347                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
     348 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     349                 :            : 
     350                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     351 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     352         [ #  # ]:          0 :     if( xSeries.is() )
     353                 :            :     {
     354                 :            :         //if a series is selected insert mean value only for that series:
     355 [ #  # ][ #  # ]:          0 :         lcl_InsertMeanValueLine( m_xCC ).operator()(xSeries);
                 [ #  # ]
     356                 :            :     }
     357                 :            :     else
     358                 :            :     {
     359                 :            :         ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries(
     360 [ #  # ][ #  # ]:          0 :             DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( getModel() )));
                 [ #  # ]
     361 [ #  # ][ #  # ]:          0 :         ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC ));
         [ #  # ][ #  # ]
     362                 :            :     }
     363 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     364                 :          0 : }
     365                 :            : 
     366                 :          0 : void ChartController::executeDispatch_InsertMenu_Trendlines()
     367                 :            : {
     368                 :            :     //if a series is selected insert only for that series:
     369                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     370 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     371         [ #  # ]:          0 :     if( xSeries.is())
     372                 :            :     {
     373         [ #  # ]:          0 :         executeDispatch_InsertTrendline();
     374                 :          0 :         return;
     375                 :            :     }
     376                 :            : 
     377                 :            :     UndoGuard aUndoGuard(
     378                 :            :         ActionDescriptionProvider::createDescription(
     379                 :            :             ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ),
     380 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
                 [ #  # ]
     381                 :            : 
     382                 :            :     try
     383                 :            :     {
     384                 :            :         wrapper::AllSeriesStatisticsConverter aItemConverter(
     385 [ #  # ][ #  # ]:          0 :             getModel(), m_pDrawModelWrapper->GetItemPool() );
                 [ #  # ]
     386         [ #  # ]:          0 :         SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
     387         [ #  # ]:          0 :         aItemConverter.FillItemSet( aItemSet );
     388                 :            : 
     389                 :            :         //prepare and open dialog
     390         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     391         [ #  # ]:          0 :         InsertTrendlineDialog aDlg( m_pChartWindow, aItemSet );
     392         [ #  # ]:          0 :         aDlg.adjustSize();
     393                 :            : 
     394 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK )
     395                 :            :         {
     396         [ #  # ]:          0 :             SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
     397         [ #  # ]:          0 :             aDlg.FillItemSet( aOutItemSet );
     398                 :            : 
     399                 :            :             // lock controllers till end of block
     400 [ #  # ][ #  # ]:          0 :             ControllerLockGuard aCLGuard( getModel() );
     401         [ #  # ]:          0 :             bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
     402         [ #  # ]:          0 :             if( bChanged )
     403 [ #  # ][ #  # ]:          0 :                 aUndoGuard.commit();
                 [ #  # ]
     404 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
                 [ #  # ]
     405                 :            :     }
     406         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     407                 :            :     {
     408                 :            :         ASSERT_EXCEPTION( e );
     409 [ #  # ][ #  # ]:          0 :     }
     410                 :            : }
     411                 :            : 
     412                 :          0 : void ChartController::executeDispatch_InsertTrendline()
     413                 :            : {
     414                 :            :     uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
     415 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel()), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     416         [ #  # ]:          0 :     if( xRegCurveCnt.is())
     417                 :            :     {
     418                 :            :         UndoLiveUpdateGuard aUndoGuard(
     419                 :            :             ActionDescriptionProvider::createDescription(
     420                 :            :                 ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE ))),
     421 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     422                 :            : 
     423                 :            :         // add a linear curve
     424                 :            :         RegressionCurveHelper::addRegressionCurve(
     425         [ #  # ]:          0 :             RegressionCurveHelper::REGRESSION_TYPE_LINEAR, xRegCurveCnt, m_xCC );
     426                 :            : 
     427                 :            :         // get an appropriate item converter
     428                 :            :         uno::Reference< chart2::XRegressionCurve > xCurve(
     429         [ #  # ]:          0 :             RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ));
     430         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xCurveProp( xCurve, uno::UNO_QUERY );
     431         [ #  # ]:          0 :         if( !xCurveProp.is())
     432                 :          0 :             return;
     433                 :            :         wrapper::RegressionCurveItemConverter aItemConverter(
     434         [ #  # ]:          0 :             xCurveProp, xRegCurveCnt, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
     435         [ #  # ]:          0 :             m_pDrawModelWrapper->getSdrModel(),
     436         [ #  # ]:          0 :             uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
           [ #  #  #  # ]
     437                 :            : 
     438                 :            :         // open dialog
     439         [ #  # ]:          0 :         SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
     440         [ #  # ]:          0 :         aItemConverter.FillItemSet( aItemSet );
     441                 :            :         ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter(
     442                 :            :             ObjectIdentifier::createDataCurveCID(
     443                 :            :                 ObjectIdentifier::getSeriesParticleFromCID( m_aSelection.getSelectedCID()),
     444 [ #  # ][ #  # ]:          0 :                 RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt, xCurve ), false ));
         [ #  # ][ #  # ]
                 [ #  # ]
     445 [ #  # ][ #  # ]:          0 :         aDialogParameter.init( getModel() );
     446         [ #  # ]:          0 :         ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
     447         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     448                 :            :         SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
     449 [ #  # ][ #  # ]:          0 :                               uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
                 [ #  # ]
     450                 :            : 
     451                 :            :         // note: when a user pressed "OK" but didn't change any settings in the
     452                 :            :         // dialog, the SfxTabDialog returns "Cancel"
     453 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
         [ #  # ][ #  # ]
                 [ #  # ]
     454                 :            :         {
     455                 :          0 :             const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
     456         [ #  # ]:          0 :             if( pOutItemSet )
     457                 :            :             {
     458 [ #  # ][ #  # ]:          0 :                 ControllerLockGuard aCLGuard( getModel() );
     459 [ #  # ][ #  # ]:          0 :                 aItemConverter.ApplyItemSet( *pOutItemSet );
     460                 :            :             }
     461         [ #  # ]:          0 :             aUndoGuard.commit();
     462 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     463         [ #  # ]:          0 :     }
     464                 :            : }
     465                 :            : 
     466                 :          0 : void ChartController::executeDispatch_InsertErrorBars( bool bYError )
     467                 :            : {
     468         [ #  # ]:          0 :     ObjectType objType = bYError ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X;
     469                 :            : 
     470                 :            :     //if a series is selected insert error bars for that series only:
     471                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     472 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     473                 :            : 
     474         [ #  # ]:          0 :     if( xSeries.is())
     475                 :            :     {
     476                 :            :         UndoLiveUpdateGuard aUndoGuard(
     477                 :            :             ActionDescriptionProvider::createDescription(
     478                 :            :                 ActionDescriptionProvider::INSERT,
     479                 :            :                 String( SchResId( bYError ? STR_OBJECT_ERROR_BARS_Y : STR_OBJECT_ERROR_BARS_X ))),
     480 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     481                 :            : 
     482                 :            :         // add error bars with standard deviation
     483                 :            :         uno::Reference< beans::XPropertySet > xErrorBarProp(
     484                 :            :             StatisticsHelper::addErrorBars( xSeries, m_xCC,
     485                 :            :                                             ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION,
     486         [ #  # ]:          0 :                                             bYError));
     487                 :            : 
     488                 :            :         // get an appropriate item converter
     489                 :            :         wrapper::ErrorBarItemConverter aItemConverter(
     490         [ #  # ]:          0 :             getModel(), xErrorBarProp, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
     491         [ #  # ]:          0 :             m_pDrawModelWrapper->getSdrModel(),
     492         [ #  # ]:          0 :             uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
           [ #  #  #  # ]
                 [ #  # ]
     493                 :            : 
     494                 :            :         // open dialog
     495         [ #  # ]:          0 :         SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
     496 [ #  # ][ #  # ]:          0 :         aItemSet.Put(SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE,bYError));
                 [ #  # ]
     497         [ #  # ]:          0 :         aItemConverter.FillItemSet( aItemSet );
     498                 :            :         ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter(
     499                 :            :             ObjectIdentifier::createClassifiedIdentifierWithParent(
     500 [ #  # ][ #  # ]:          0 :                 objType, ::rtl::OUString(), m_aSelection.getSelectedCID()));
                 [ #  # ]
     501 [ #  # ][ #  # ]:          0 :         aDialogParameter.init( getModel() );
     502         [ #  # ]:          0 :         ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
     503         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     504                 :            :         SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
     505 [ #  # ][ #  # ]:          0 :                               uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
                 [ #  # ]
     506                 :            :         aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
     507                 :          0 :             InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(),
     508 [ #  # ][ #  # ]:          0 :                                                                              m_xChartView, m_aSelection.getSelectedCID()));
         [ #  # ][ #  # ]
     509                 :            : 
     510                 :            :         // note: when a user pressed "OK" but didn't change any settings in the
     511                 :            :         // dialog, the SfxTabDialog returns "Cancel"
     512 [ #  # ][ #  # ]:          0 :         if( aDlg.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
         [ #  # ][ #  # ]
                 [ #  # ]
     513                 :            :         {
     514                 :          0 :             const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
     515         [ #  # ]:          0 :             if( pOutItemSet )
     516                 :            :             {
     517 [ #  # ][ #  # ]:          0 :                 ControllerLockGuard aCLGuard( getModel() );
     518 [ #  # ][ #  # ]:          0 :                 aItemConverter.ApplyItemSet( *pOutItemSet );
     519                 :            :             }
     520         [ #  # ]:          0 :             aUndoGuard.commit();
     521 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     522                 :            :     }
     523                 :            :     else
     524                 :            :     {
     525                 :            :         //if no series is selected insert error bars for all series
     526                 :            :         UndoGuard aUndoGuard(
     527                 :            :             ActionDescriptionProvider::createDescription(
     528                 :            :                 ActionDescriptionProvider::INSERT,
     529                 :            :                 ObjectNameProvider::getName_ObjectForAllSeries( objType ) ),
     530 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
                 [ #  # ]
     531                 :            : 
     532                 :            :         try
     533                 :            :         {
     534                 :            :             wrapper::AllSeriesStatisticsConverter aItemConverter(
     535 [ #  # ][ #  # ]:          0 :                 getModel(), m_pDrawModelWrapper->GetItemPool() );
                 [ #  # ]
     536         [ #  # ]:          0 :             SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
     537         [ #  # ]:          0 :             aItemConverter.FillItemSet( aItemSet );
     538                 :            : 
     539                 :            :             //prepare and open dialog
     540         [ #  # ]:          0 :             SolarMutexGuard aGuard;
     541                 :            :             InsertErrorBarsDialog aDlg(
     542                 :            :                 m_pChartWindow, aItemSet,
     543                 :          0 :                 uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
     544 [ #  # ][ #  # ]:          0 :                 bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
         [ #  # ][ #  # ]
     545                 :            : 
     546                 :            :             aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
     547 [ #  # ][ #  # ]:          0 :                 InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rtl::OUString() ) );
                 [ #  # ]
     548                 :            : 
     549 [ #  # ][ #  # ]:          0 :             if( aDlg.Execute() == RET_OK )
     550                 :            :             {
     551         [ #  # ]:          0 :                 SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
     552         [ #  # ]:          0 :                 aDlg.FillItemSet( aOutItemSet );
     553                 :            : 
     554                 :            :                 // lock controllers till end of block
     555 [ #  # ][ #  # ]:          0 :                 ControllerLockGuard aCLGuard( getModel() );
     556         [ #  # ]:          0 :                 bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
     557         [ #  # ]:          0 :                 if( bChanged )
     558 [ #  # ][ #  # ]:          0 :                     aUndoGuard.commit();
                 [ #  # ]
     559 [ #  # ][ #  # ]:          0 :             }
         [ #  # ][ #  # ]
                 [ #  # ]
     560                 :            :         }
     561         [ #  # ]:          0 :         catch(const uno::RuntimeException& e)
     562                 :            :         {
     563                 :            :             ASSERT_EXCEPTION( e );
     564         [ #  # ]:          0 :         }
     565                 :          0 :     }
     566                 :          0 : }
     567                 :            : 
     568                 :          0 : void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
     569                 :            : {
     570                 :            :     uno::Reference< chart2::XRegressionCurve > xRegCurve(
     571 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     572         [ #  # ]:          0 :     if( !xRegCurve.is() )
     573                 :            :     {
     574                 :            :         uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
     575 [ #  # ][ #  # ]:          0 :             ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     576 [ #  # ][ #  # ]:          0 :         xRegCurve.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
     577                 :            :     }
     578         [ #  # ]:          0 :     if( xRegCurve.is())
     579                 :            :     {
     580 [ #  # ][ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties());
     581         [ #  # ]:          0 :         if( xEqProp.is())
     582                 :            :         {
     583                 :            :             // using assignment for broken gcc 3.3
     584                 :            :             UndoGuard aUndoGuard = UndoGuard(
     585                 :            :                 ActionDescriptionProvider::createDescription(
     586                 :            :                     ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
     587 [ #  # ][ #  # ]:          0 :                 m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     588 [ #  # ][ #  # ]:          0 :             xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true ));
         [ #  # ][ #  # ]
     589 [ #  # ][ #  # ]:          0 :             xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 ));
         [ #  # ][ #  # ]
     590 [ #  # ][ #  # ]:          0 :             aUndoGuard.commit();
     591                 :          0 :         }
     592                 :          0 :     }
     593                 :          0 : }
     594                 :            : 
     595                 :          0 : void ChartController::executeDispatch_InsertR2Value()
     596                 :            : {
     597                 :            :     uno::Reference< beans::XPropertySet > xEqProp(
     598 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     599         [ #  # ]:          0 :     if( xEqProp.is())
     600                 :            :     {
     601                 :            :         UndoGuard aUndoGuard = UndoGuard(
     602                 :            :             ActionDescriptionProvider::createDescription(
     603                 :            :                 ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
     604 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     605 [ #  # ][ #  # ]:          0 :         xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true ));
         [ #  # ][ #  # ]
     606 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     607                 :          0 :     }
     608                 :          0 : }
     609                 :            : 
     610                 :          0 : void ChartController::executeDispatch_DeleteR2Value()
     611                 :            : {
     612                 :            :     uno::Reference< beans::XPropertySet > xEqProp(
     613 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     614         [ #  # ]:          0 :     if( xEqProp.is())
     615                 :            :     {
     616                 :            :         UndoGuard aUndoGuard = UndoGuard(
     617                 :            :             ActionDescriptionProvider::createDescription(
     618                 :            :                 ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
     619 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     620 [ #  # ][ #  # ]:          0 :         xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
         [ #  # ][ #  # ]
     621 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     622                 :          0 :     }
     623                 :          0 : }
     624                 :            : 
     625                 :          0 : void ChartController::executeDispatch_DeleteMeanValue()
     626                 :            : {
     627                 :            :     uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
     628 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     629         [ #  # ]:          0 :     if( xRegCurveCnt.is())
     630                 :            :     {
     631                 :            :         UndoGuard aUndoGuard(
     632                 :            :             ActionDescriptionProvider::createDescription(
     633                 :            :                 ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
     634 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     635         [ #  # ]:          0 :         RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt );
     636 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     637                 :          0 :     }
     638                 :          0 : }
     639                 :            : 
     640                 :          0 : void ChartController::executeDispatch_DeleteTrendline()
     641                 :            : {
     642                 :            :     uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
     643 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     644         [ #  # ]:          0 :     if( xRegCurveCnt.is())
     645                 :            :     {
     646                 :            :         UndoGuard aUndoGuard(
     647                 :            :             ActionDescriptionProvider::createDescription(
     648                 :            :                 ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))),
     649 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     650         [ #  # ]:          0 :         RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt );
     651 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     652                 :          0 :     }
     653                 :          0 : }
     654                 :            : 
     655                 :          0 : void ChartController::executeDispatch_DeleteTrendlineEquation()
     656                 :            : {
     657                 :            :     uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
     658 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     659         [ #  # ]:          0 :     if( xRegCurveCnt.is())
     660                 :            :     {
     661                 :            :         UndoGuard aUndoGuard(
     662                 :            :             ActionDescriptionProvider::createDescription(
     663                 :            :                 ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
     664 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     665         [ #  # ]:          0 :         RegressionCurveHelper::removeEquations( xRegCurveCnt );
     666 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     667                 :          0 :     }
     668                 :          0 : }
     669                 :            : 
     670                 :          0 : void ChartController::executeDispatch_DeleteErrorBars( bool bYError )
     671                 :            : {
     672                 :            :     uno::Reference< chart2::XDataSeries > xDataSeries(
     673 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
                 [ #  # ]
     674         [ #  # ]:          0 :     if( xDataSeries.is())
     675                 :            :     {
     676                 :            :         UndoGuard aUndoGuard(
     677                 :            :             ActionDescriptionProvider::createDescription(
     678                 :            :                 ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))),
     679 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     680         [ #  # ]:          0 :         StatisticsHelper::removeErrorBars( xDataSeries, bYError );
     681 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     682                 :          0 :     }
     683                 :          0 : }
     684                 :            : 
     685                 :          0 : void ChartController::executeDispatch_InsertDataLabels()
     686                 :            : {
     687                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     688 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     689         [ #  # ]:          0 :     if( xSeries.is() )
     690                 :            :     {
     691                 :            :         UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
     692                 :            :             String( SchResId( STR_OBJECT_DATALABELS ))),
     693 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     694         [ #  # ]:          0 :         DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
     695 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     696                 :          0 :     }
     697                 :          0 : }
     698                 :            : 
     699                 :          0 : void ChartController::executeDispatch_InsertDataLabel()
     700                 :            : {
     701                 :            :     UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
     702                 :            :         String( SchResId( STR_OBJECT_LABEL ))),
     703 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     704 [ #  # ][ #  # ]:          0 :     DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
         [ #  # ][ #  # ]
     705 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     706                 :          0 : }
     707                 :            : 
     708                 :          0 : void ChartController::executeDispatch_DeleteDataLabels()
     709                 :            : {
     710                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
     711 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     712         [ #  # ]:          0 :     if( xSeries.is() )
     713                 :            :     {
     714                 :            :         UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
     715                 :            :             String( SchResId( STR_OBJECT_DATALABELS ))),
     716 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     717         [ #  # ]:          0 :         DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries );
     718 [ #  # ][ #  # ]:          0 :         aUndoGuard.commit();
     719                 :          0 :     }
     720                 :          0 : }
     721                 :            : 
     722                 :          0 : void ChartController::executeDispatch_DeleteDataLabel()
     723                 :            : {
     724                 :            :     UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
     725                 :            :         String( SchResId( STR_OBJECT_LABEL ))),
     726 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     727 [ #  # ][ #  # ]:          0 :     DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
         [ #  # ][ #  # ]
     728 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     729                 :          0 : }
     730                 :            : 
     731                 :          0 : void ChartController::executeDispatch_ResetAllDataPoints()
     732                 :            : {
     733                 :            :     UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
     734                 :            :         String( SchResId( STR_OBJECT_DATAPOINTS ))),
     735 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     736 [ #  # ][ #  # ]:          0 :     uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     737         [ #  # ]:          0 :     if( xSeries.is() )
     738 [ #  # ][ #  # ]:          0 :         xSeries->resetAllDataPoints();
     739 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     740                 :          0 : }
     741                 :          0 : void ChartController::executeDispatch_ResetDataPoint()
     742                 :            : {
     743                 :            :     UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
     744                 :            :         String( SchResId( STR_OBJECT_DATAPOINT ))),
     745 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     746 [ #  # ][ #  # ]:          0 :     uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     747         [ #  # ]:          0 :     if( xSeries.is() )
     748                 :            :     {
     749 [ #  # ][ #  # ]:          0 :         sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
     750 [ #  # ][ #  # ]:          0 :         xSeries->resetDataPoint( nPointIndex );
     751                 :            :     }
     752 [ #  # ][ #  # ]:          0 :     aUndoGuard.commit();
     753                 :          0 : }
     754                 :            : 
     755                 :          0 : void ChartController::executeDispatch_InsertAxisTitle()
     756                 :            : {
     757                 :            :     try
     758                 :            :     {
     759                 :          0 :         uno::Reference< XTitle > xTitle;
     760                 :            :         {
     761                 :            :             UndoGuard aUndoGuard(
     762                 :            :             ActionDescriptionProvider::createDescription(
     763                 :            :                 ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLE ))),
     764 [ #  # ][ #  # ]:          0 :             m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     765                 :            : 
     766 [ #  # ][ #  # ]:          0 :             Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     767                 :          0 :             sal_Int32 nDimensionIndex = -1;
     768                 :          0 :             sal_Int32 nCooSysIndex = -1;
     769                 :          0 :             sal_Int32 nAxisIndex = -1;
     770 [ #  # ][ #  # ]:          0 :             AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram(getModel()), nCooSysIndex, nDimensionIndex, nAxisIndex );
                 [ #  # ]
     771                 :            : 
     772                 :          0 :             TitleHelper::eTitleType eTitleType = TitleHelper::X_AXIS_TITLE;
     773         [ #  # ]:          0 :             if( nDimensionIndex==0 )
     774         [ #  # ]:          0 :                 eTitleType = nAxisIndex==0 ? TitleHelper::X_AXIS_TITLE : TitleHelper::SECONDARY_X_AXIS_TITLE;
     775         [ #  # ]:          0 :             else if( nDimensionIndex==1 )
     776         [ #  # ]:          0 :                 eTitleType = nAxisIndex==0 ? TitleHelper::Y_AXIS_TITLE : TitleHelper::SECONDARY_Y_AXIS_TITLE;
     777                 :            :             else
     778                 :          0 :                 eTitleType = TitleHelper::Z_AXIS_TITLE;
     779                 :            : 
     780 [ #  # ][ #  # ]:          0 :             ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider());
     781 [ #  # ][ #  # ]:          0 :             xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getModel(), m_xCC, apRefSizeProvider.get() );
         [ #  # ][ #  # ]
     782 [ #  # ][ #  # ]:          0 :             aUndoGuard.commit();
                 [ #  # ]
     783         [ #  # ]:          0 :         }
     784                 :            :     }
     785                 :          0 :     catch(const uno::RuntimeException& e)
     786                 :            :     {
     787                 :            :         ASSERT_EXCEPTION( e );
     788                 :            :     }
     789                 :          0 : }
     790                 :            : 
     791                 :          0 : void ChartController::executeDispatch_InsertAxis()
     792                 :            : {
     793                 :            :     UndoGuard aUndoGuard(
     794                 :            :         ActionDescriptionProvider::createDescription(
     795                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXIS ))),
     796 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     797                 :            : 
     798                 :            :     try
     799                 :            :     {
     800 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     801         [ #  # ]:          0 :         if( xAxis.is() )
     802                 :            :         {
     803         [ #  # ]:          0 :             AxisHelper::makeAxisVisible( xAxis );
     804         [ #  # ]:          0 :             aUndoGuard.commit();
     805         [ #  # ]:          0 :         }
     806                 :            :     }
     807         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     808                 :            :     {
     809                 :            :         ASSERT_EXCEPTION( e );
     810         [ #  # ]:          0 :     }
     811                 :          0 : }
     812                 :            : 
     813                 :          0 : void ChartController::executeDispatch_DeleteAxis()
     814                 :            : {
     815                 :            :     UndoGuard aUndoGuard(
     816                 :            :         ActionDescriptionProvider::createDescription(
     817                 :            :             ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AXIS ))),
     818 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     819                 :            : 
     820                 :            :     try
     821                 :            :     {
     822 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     823         [ #  # ]:          0 :         if( xAxis.is() )
     824                 :            :         {
     825         [ #  # ]:          0 :             AxisHelper::makeAxisInvisible( xAxis );
     826         [ #  # ]:          0 :             aUndoGuard.commit();
     827         [ #  # ]:          0 :         }
     828                 :            :     }
     829         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     830                 :            :     {
     831                 :            :         ASSERT_EXCEPTION( e );
     832         [ #  # ]:          0 :     }
     833                 :          0 : }
     834                 :            : 
     835                 :          0 : void ChartController::executeDispatch_InsertMajorGrid()
     836                 :            : {
     837                 :            :     UndoGuard aUndoGuard(
     838                 :            :         ActionDescriptionProvider::createDescription(
     839                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))),
     840 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     841                 :            : 
     842                 :            :     try
     843                 :            :     {
     844 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     845         [ #  # ]:          0 :         if( xAxis.is() )
     846                 :            :         {
     847 [ #  # ][ #  # ]:          0 :             AxisHelper::makeGridVisible( xAxis->getGridProperties() );
                 [ #  # ]
     848         [ #  # ]:          0 :             aUndoGuard.commit();
     849         [ #  # ]:          0 :         }
     850                 :            :     }
     851         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     852                 :            :     {
     853                 :            :         ASSERT_EXCEPTION( e );
     854         [ #  # ]:          0 :     }
     855                 :          0 : }
     856                 :            : 
     857                 :          0 : void ChartController::executeDispatch_DeleteMajorGrid()
     858                 :            : {
     859                 :            :     UndoGuard aUndoGuard(
     860                 :            :         ActionDescriptionProvider::createDescription(
     861                 :            :             ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))),
     862 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     863                 :            : 
     864                 :            :     try
     865                 :            :     {
     866 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     867         [ #  # ]:          0 :         if( xAxis.is() )
     868                 :            :         {
     869 [ #  # ][ #  # ]:          0 :             AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
                 [ #  # ]
     870         [ #  # ]:          0 :             aUndoGuard.commit();
     871         [ #  # ]:          0 :         }
     872                 :            :     }
     873         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     874                 :            :     {
     875                 :            :         ASSERT_EXCEPTION( e );
     876         [ #  # ]:          0 :     }
     877                 :          0 : }
     878                 :            : 
     879                 :          0 : void ChartController::executeDispatch_InsertMinorGrid()
     880                 :            : {
     881                 :            :     UndoGuard aUndoGuard(
     882                 :            :         ActionDescriptionProvider::createDescription(
     883                 :            :             ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))),
     884 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     885                 :            : 
     886                 :            :     try
     887                 :            :     {
     888 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     889         [ #  # ]:          0 :         if( xAxis.is() )
     890                 :            :         {
     891 [ #  # ][ #  # ]:          0 :             Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
     892         [ #  # ]:          0 :             for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
     893 [ #  # ][ #  # ]:          0 :                 AxisHelper::makeGridVisible( aSubGrids[nN] );
     894 [ #  # ][ #  # ]:          0 :             aUndoGuard.commit();
     895         [ #  # ]:          0 :         }
     896                 :            :     }
     897         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     898                 :            :     {
     899                 :            :         ASSERT_EXCEPTION( e );
     900         [ #  # ]:          0 :     }
     901                 :          0 : }
     902                 :            : 
     903                 :          0 : void ChartController::executeDispatch_DeleteMinorGrid()
     904                 :            : {
     905                 :            :     UndoGuard aUndoGuard(
     906                 :            :         ActionDescriptionProvider::createDescription(
     907                 :            :             ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))),
     908 [ #  # ][ #  # ]:          0 :         m_xUndoManager );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     909                 :            : 
     910                 :            :     try
     911                 :            :     {
     912 [ #  # ][ #  # ]:          0 :         Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
     913         [ #  # ]:          0 :         if( xAxis.is() )
     914                 :            :         {
     915 [ #  # ][ #  # ]:          0 :             Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
     916         [ #  # ]:          0 :             for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
     917 [ #  # ][ #  # ]:          0 :                 AxisHelper::makeGridInvisible( aSubGrids[nN] );
     918 [ #  # ][ #  # ]:          0 :             aUndoGuard.commit();
     919         [ #  # ]:          0 :         }
     920                 :            :     }
     921         [ #  # ]:          0 :     catch(const uno::RuntimeException& e)
     922                 :            :     {
     923                 :            :         ASSERT_EXCEPTION( e );
     924         [ #  # ]:          0 :     }
     925                 :          0 : }
     926                 :            : 
     927                 :            : //.............................................................................
     928                 :            : } //namespace chart
     929                 :            : //.............................................................................
     930                 :            : 
     931                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10