LCOV - code coverage report
Current view: top level - chart2/source/controller/main - ControllerCommandDispatch.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 296 358 82.7 %
Date: 2015-06-13 12:38:46 Functions: 21 24 87.5 %
Legend: Lines: hit not hit

          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 "ControllerCommandDispatch.hxx"
      21             : #include "ChartModelHelper.hxx"
      22             : #include "DiagramHelper.hxx"
      23             : #include "AxisHelper.hxx"
      24             : #include "TitleHelper.hxx"
      25             : #include "LegendHelper.hxx"
      26             : #include "ObjectIdentifier.hxx"
      27             : #include "macros.hxx"
      28             : #include "ChartTypeHelper.hxx"
      29             : #include "ChartController.hxx"
      30             : #include "RegressionCurveHelper.hxx"
      31             : #include "DataSeriesHelper.hxx"
      32             : #include "StatisticsHelper.hxx"
      33             : #include "ShapeController.hxx"
      34             : 
      35             : #include <vcl/svapp.hxx>
      36             : 
      37             : #include <com/sun/star/util/XModifyBroadcaster.hpp>
      38             : #include <com/sun/star/frame/XStorable.hpp>
      39             : #include <com/sun/star/chart2/XChartDocument.hpp>
      40             : #include <com/sun/star/chart2/XChartType.hpp>
      41             : #include <com/sun/star/chart2/XDataSeries.hpp>
      42             : #include <com/sun/star/chart2/XRegressionCurve.hpp>
      43             : #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
      44             : 
      45             : // only needed until #i68864# is fixed
      46             : #include <com/sun/star/frame/XLayoutManager.hpp>
      47             : 
      48             : using namespace ::com::sun::star;
      49             : 
      50             : using ::com::sun::star::uno::Reference;
      51             : using ::com::sun::star::uno::Sequence;
      52             : 
      53             : namespace
      54             : {
      55         803 : bool lcl_isStatusBarVisible( const Reference< frame::XController > & xController )
      56             : {
      57         803 :     bool bIsStatusBarVisible = false;
      58             :     // Status-Bar visible, workaround: this should not be necessary. @todo:
      59             :     // remove when Issue #i68864# is fixed
      60         803 :     if( xController.is())
      61             :     {
      62         803 :         Reference< beans::XPropertySet > xPropSet( xController->getFrame(), uno::UNO_QUERY );
      63         803 :         if( xPropSet.is() )
      64             :         {
      65         803 :             uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
      66         803 :             xPropSet->getPropertyValue( "LayoutManager" ) >>= xLayoutManager;
      67         803 :             if ( xLayoutManager.is() )
      68         803 :                 bIsStatusBarVisible = xLayoutManager->isElementVisible( "private:resource/statusbar/statusbar" );
      69         803 :         }
      70             :     }
      71         803 :     return bIsStatusBarVisible;
      72             : }
      73             : 
      74             : } // anonymous namespace
      75             : 
      76             : namespace chart
      77             : {
      78             : 
      79             : namespace impl
      80             : {
      81             : 
      82             : /// Constants for moving the series.
      83             : namespace {
      84             :     static bool const MOVE_SERIES_FORWARD = true;
      85             :     static bool const MOVE_SERIES_BACKWARD = false;
      86             : }
      87             : 
      88             : /** Represents the current state of the controller (needed for issue 63017).
      89             : 
      90             :     You can set the state by calling update().  After this call the state is
      91             :     preserved in this class until the next call to update().
      92             : 
      93             :     This is useful, not to say necessary, for enabling and disabling of menu
      94             :     entries (e.g. format>arrangement). As the status requests are sent very
      95             :     frequently it would be impossible, from a performance point of view, to
      96             :     query the current status every time directly at the model.  So this class
      97             :     serves as a cache for the state.
      98             : */
      99             : struct ControllerState
     100             : {
     101             :     ControllerState();
     102             : 
     103             :     void update( const Reference< frame::XController > & xController,
     104             :                  const Reference< frame::XModel > & xModel );
     105             : 
     106             :     // -- State variables -------
     107             :     bool bHasSelectedObject;
     108             :     bool bIsPositionableObject;
     109             :     bool bIsTextObject;
     110             :     bool bIsDeleteableObjectSelected;
     111             :     bool bIsFormateableObjectSelected;
     112             : 
     113             :     // May the selected series be moved forward or backward (cf
     114             :     // format>arrangement).
     115             :     bool bMayMoveSeriesForward;
     116             :     bool bMayMoveSeriesBackward;
     117             : 
     118             :     // trendlines
     119             :     bool bMayAddMenuTrendline;
     120             :     bool bMayAddTrendline;
     121             :     bool bMayAddTrendlineEquation;
     122             :     bool bMayAddR2Value;
     123             :     bool bMayAddMeanValue;
     124             :     bool bMayAddXErrorBars;
     125             :     bool bMayAddYErrorBars;
     126             : 
     127             :     bool bMayDeleteTrendline;
     128             :     bool bMayDeleteTrendlineEquation;
     129             :     bool bMayDeleteR2Value;
     130             :     bool bMayDeleteMeanValue;
     131             :     bool bMayDeleteXErrorBars;
     132             :     bool bMayDeleteYErrorBars;
     133             : 
     134             :     bool bMayFormatTrendline;
     135             :     bool bMayFormatTrendlineEquation;
     136             :     bool bMayFormatMeanValue;
     137             :     bool bMayFormatXErrorBars;
     138             :     bool bMayFormatYErrorBars;
     139             : };
     140             : 
     141          17 : ControllerState::ControllerState() :
     142             :         bHasSelectedObject( false ),
     143             :         bIsPositionableObject( false ),
     144             :         bIsTextObject(false),
     145             :         bIsDeleteableObjectSelected(false),
     146             :         bIsFormateableObjectSelected(false),
     147             :         bMayMoveSeriesForward( false ),
     148             :         bMayMoveSeriesBackward( false ),
     149             :         bMayAddMenuTrendline( false ),
     150             :         bMayAddTrendline( false ),
     151             :         bMayAddTrendlineEquation( false ),
     152             :         bMayAddR2Value( false ),
     153             :         bMayAddMeanValue( false ),
     154             :         bMayAddXErrorBars( false ),
     155             :         bMayAddYErrorBars( false ),
     156             :         bMayDeleteTrendline( false ),
     157             :         bMayDeleteTrendlineEquation( false ),
     158             :         bMayDeleteR2Value( false ),
     159             :         bMayDeleteMeanValue( false ),
     160             :         bMayDeleteXErrorBars( false ),
     161             :         bMayDeleteYErrorBars( false ),
     162             :         bMayFormatTrendline( false ),
     163             :         bMayFormatTrendlineEquation( false ),
     164             :         bMayFormatMeanValue( false ),
     165             :         bMayFormatXErrorBars( false ),
     166          17 :         bMayFormatYErrorBars( false )
     167          17 : {}
     168             : 
     169         820 : void ControllerState::update(
     170             :     const Reference< frame::XController > & xController,
     171             :     const Reference< frame::XModel > & xModel )
     172             : {
     173             :     Reference< view::XSelectionSupplier > xSelectionSupplier(
     174         820 :         xController, uno::UNO_QUERY );
     175             : 
     176             :     // Update ControllerState variables.
     177         820 :     if( xSelectionSupplier.is())
     178             :     {
     179         820 :         uno::Any aSelObj( xSelectionSupplier->getSelection() );
     180        1640 :         ObjectIdentifier aSelOID( aSelObj );
     181        1640 :         OUString aSelObjCID( aSelOID.getObjectCID() );
     182             : 
     183         820 :         bHasSelectedObject = aSelOID.isValid();
     184             : 
     185         820 :         ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID ));
     186             : 
     187         820 :         bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && aSelOID.isDragableObject();
     188         820 :         bIsTextObject = OBJECTTYPE_TITLE == aObjectType;
     189             : 
     190        1640 :         uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
     191         820 :         bIsFormateableObjectSelected = bHasSelectedObject && aSelOID.isAutoGeneratedObject();
     192         820 :         if( OBJECTTYPE_DIAGRAM==aObjectType || OBJECTTYPE_DIAGRAM_WALL==aObjectType || OBJECTTYPE_DIAGRAM_FLOOR==aObjectType )
     193           0 :             bIsFormateableObjectSelected = DiagramHelper::isSupportingFloorAndWall( xDiagram );
     194             : 
     195             :         uno::Reference< chart2::XDataSeries > xGivenDataSeries(
     196             :             ObjectIdentifier::getDataSeriesForCID(
     197        1640 :                 aSelObjCID, xModel ) );
     198             : 
     199         820 :         bIsDeleteableObjectSelected = ChartController::isObjectDeleteable( aSelObj );
     200             : 
     201        2460 :         bMayMoveSeriesForward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
     202             :             ChartModelHelper::findDiagram( xModel ),
     203             :             xGivenDataSeries,
     204        2460 :             MOVE_SERIES_FORWARD );
     205             : 
     206        2460 :         bMayMoveSeriesBackward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
     207             :             ChartModelHelper::findDiagram( xModel ),
     208             :             xGivenDataSeries,
     209        2460 :             MOVE_SERIES_BACKWARD );
     210             : 
     211         820 :         bMayAddMenuTrendline = false;
     212         820 :         bMayAddTrendline = false;
     213         820 :         bMayAddTrendlineEquation = false;
     214         820 :         bMayAddR2Value = false;
     215         820 :         bMayAddMeanValue = false;
     216         820 :         bMayAddXErrorBars = false;
     217         820 :         bMayAddYErrorBars = false;
     218         820 :         bMayDeleteTrendline = false;
     219         820 :         bMayDeleteTrendlineEquation = false;
     220         820 :         bMayDeleteR2Value = false;
     221         820 :         bMayDeleteMeanValue = false;
     222         820 :         bMayDeleteXErrorBars = false;
     223         820 :         bMayDeleteYErrorBars = false;
     224         820 :         bMayFormatTrendline = false;
     225         820 :         bMayFormatTrendlineEquation = false;
     226         820 :         bMayFormatMeanValue = false;
     227         820 :         bMayFormatXErrorBars = false;
     228         820 :         bMayFormatYErrorBars = false;
     229         820 :         if( bHasSelectedObject )
     230             :         {
     231           0 :             if( xGivenDataSeries.is())
     232             :             {
     233           0 :                 bMayAddMenuTrendline = true;
     234           0 :                 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
     235             :                 uno::Reference< chart2::XChartType > xFirstChartType(
     236           0 :                     DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram ));
     237             : 
     238             :                 // trend lines/mean value line
     239           0 :                 if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
     240           0 :                     && ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount ))
     241             :                 {
     242           0 :                     uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xGivenDataSeries, uno::UNO_QUERY );
     243           0 :                     if( xRegCurveCnt.is())
     244             :                     {
     245             :                         // Trendline
     246           0 :                         bMayAddTrendline = true;
     247             : 
     248             :                         // Mean Value
     249           0 :                         bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
     250           0 :                         bMayAddMeanValue = ! bMayDeleteMeanValue;
     251           0 :                     }
     252             :                 }
     253             : 
     254             :                 // error bars
     255           0 :                 if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
     256           0 :                     && ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount ))
     257             :                 {
     258           0 :                     bMayFormatXErrorBars = bMayDeleteXErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries, false );
     259           0 :                     bMayAddXErrorBars = ! bMayDeleteXErrorBars;
     260             : 
     261           0 :                     bMayFormatYErrorBars = bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries, true );
     262           0 :                     bMayAddYErrorBars = ! bMayDeleteYErrorBars;
     263           0 :                 }
     264             :             }
     265             : 
     266           0 :             if( aObjectType == OBJECTTYPE_DATA_AVERAGE_LINE )
     267           0 :                 bMayFormatMeanValue = true;
     268             : 
     269           0 :             if( aObjectType == OBJECTTYPE_DATA_ERRORS_X)
     270           0 :                 bMayFormatXErrorBars = true;
     271             : 
     272           0 :             if( aObjectType == OBJECTTYPE_DATA_ERRORS_Y )
     273           0 :                 bMayFormatYErrorBars = true;
     274             : 
     275           0 :             if( aObjectType == OBJECTTYPE_DATA_CURVE )
     276             :             {
     277           0 :                 bMayFormatTrendline = true;
     278           0 :                 bMayDeleteTrendline = true;
     279             :                 uno::Reference< chart2::XRegressionCurve > xRegCurve(
     280           0 :                     ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
     281             : 
     282             :                 // Trendline Equation
     283           0 :                 bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
     284           0 :                 bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
     285             :             }
     286           0 :             else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
     287             :             {
     288           0 :                 bMayFormatTrendlineEquation = true;
     289           0 :                 bool bHasR2Value = false;
     290             :                 try
     291             :                 {
     292             :                     uno::Reference< beans::XPropertySet > xEquationProperties(
     293           0 :                         ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
     294           0 :                     if( xEquationProperties.is() )
     295           0 :                         xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient" ) >>= bHasR2Value;
     296             :                 }
     297           0 :                 catch(const uno::RuntimeException& e)
     298             :                 {
     299             :                     ASSERT_EXCEPTION( e );
     300             :                 }
     301           0 :                 bMayAddR2Value = !bHasR2Value;
     302           0 :                 bMayDeleteR2Value = bHasR2Value;
     303             :             }
     304         820 :         }
     305         820 :     }
     306         820 : }
     307             : 
     308             : /** Represents the current state of the model.
     309             : 
     310             :     You can set the state by calling update().  After this call the state is
     311             :     preserved in this class until the next call to update().
     312             : 
     313             :     This is useful, not to say necessary, for enabling and disabling of menu
     314             :     entries and toolbar icons.  As the status requests are sent very frequently
     315             :     it would be impossible, from a performance point of view, to query the
     316             :     current status every time directly at the model.  So this class serves as a
     317             :     cache for the state.
     318             :  */
     319             : struct ModelState
     320             : {
     321             :     ModelState();
     322             : 
     323             :     void update( const Reference< frame::XModel > & xModel );
     324             : 
     325             :     bool HasAnyAxis() const;
     326             :     bool HasAnyGrid() const;
     327             :     bool HasAnyTitle() const;
     328             : 
     329             :     bool bIsReadOnly;
     330             :     bool bIsThreeD;
     331             :     bool bHasOwnData;
     332             : 
     333             :     bool bHasMainTitle;
     334             :     bool bHasSubTitle;
     335             :     bool bHasXAxisTitle;
     336             :     bool bHasYAxisTitle;
     337             :     bool bHasZAxisTitle;
     338             :     bool bHasSecondaryXAxisTitle;
     339             :     bool bHasSecondaryYAxisTitle;
     340             : 
     341             :     bool bHasXAxis;
     342             :     bool bHasYAxis;
     343             :     bool bHasZAxis;
     344             :     bool bHasAAxis;
     345             :     bool bHasBAxis;
     346             : 
     347             :     bool bHasMainXGrid;
     348             :     bool bHasMainYGrid;
     349             :     bool bHasMainZGrid;
     350             :     bool bHasHelpXGrid;
     351             :     bool bHasHelpYGrid;
     352             :     bool bHasHelpZGrid;
     353             : 
     354             :     bool bHasAutoScaledText;
     355             :     bool bHasLegend;
     356             :     bool bHasWall;
     357             :     bool bHasFloor;
     358             : 
     359             :     bool bSupportsStatistics;
     360             :     bool bSupportsAxes;
     361             : };
     362             : 
     363          17 : ModelState::ModelState() :
     364             :         bIsReadOnly( true ),
     365             :         bIsThreeD( false ),
     366             :         bHasOwnData( false ),
     367             :         bHasMainTitle( false ),
     368             :         bHasSubTitle( false ),
     369             :         bHasXAxisTitle( false ),
     370             :         bHasYAxisTitle( false ),
     371             :         bHasZAxisTitle( false ),
     372             :         bHasSecondaryXAxisTitle( false ),
     373             :         bHasSecondaryYAxisTitle( false ),
     374             :         bHasXAxis( false ),
     375             :         bHasYAxis( false ),
     376             :         bHasZAxis( false ),
     377             :         bHasAAxis( false ),
     378             :         bHasBAxis( false ),
     379             :         bHasMainXGrid( false ),
     380             :         bHasMainYGrid( false ),
     381             :         bHasMainZGrid( false ),
     382             :         bHasHelpXGrid( false ),
     383             :         bHasHelpYGrid( false ),
     384             :         bHasHelpZGrid( false ),
     385             :         bHasAutoScaledText( false ),
     386             :         bHasLegend( false ),
     387             :         bHasWall( false ),
     388             :         bHasFloor( false ),
     389             :         bSupportsStatistics( false ),
     390          17 :         bSupportsAxes( false )
     391             : 
     392          17 : {}
     393             : 
     394         820 : void ModelState::update( const Reference< frame::XModel > & xModel )
     395             : {
     396         820 :     Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
     397        1640 :     Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
     398             : 
     399         820 :     bIsReadOnly = true;
     400        1640 :     Reference< frame::XStorable > xStorable( xModel, uno::UNO_QUERY );
     401         820 :     if( xStorable.is())
     402         820 :         bIsReadOnly = xStorable->isReadonly();
     403             : 
     404         820 :     sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
     405             : 
     406        1640 :     uno::Reference< chart2::XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
     407         820 :     bSupportsStatistics = ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount );
     408         820 :     bSupportsAxes = ChartTypeHelper::isSupportingMainAxis( xFirstChartType, nDimensionCount, 0 );
     409             : 
     410         820 :     bIsThreeD = (nDimensionCount == 3);
     411         820 :     bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
     412             : 
     413         820 :     bHasMainTitle =  TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is();
     414         820 :     bHasSubTitle =   TitleHelper::getTitle( TitleHelper::SUB_TITLE, xModel ).is();
     415         820 :     bHasXAxisTitle = TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, xModel ).is();
     416         820 :     bHasYAxisTitle = TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, xModel ).is();
     417         820 :     bHasZAxisTitle = TitleHelper::getTitle( TitleHelper::Z_AXIS_TITLE, xModel ).is();
     418         820 :     bHasSecondaryXAxisTitle = TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xModel ).is();
     419         820 :     bHasSecondaryYAxisTitle = TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xModel ).is();
     420             : 
     421         820 :     bHasXAxis = bSupportsAxes && AxisHelper::getAxis( 0, true, xDiagram ).is();
     422         820 :     bHasYAxis = bSupportsAxes && AxisHelper::getAxis( 1, true, xDiagram ).is();
     423         820 :     bHasZAxis = bSupportsAxes && AxisHelper::getAxis( 2, true, xDiagram ).is();
     424         820 :     bHasAAxis = bSupportsAxes && AxisHelper::getAxis( 0, false, xDiagram ).is();
     425         820 :     bHasBAxis = bSupportsAxes && AxisHelper::getAxis( 1, false, xDiagram ).is();
     426             : 
     427         820 :     bHasMainXGrid = bSupportsAxes && AxisHelper::isGridShown( 0, 0, true, xDiagram );
     428         820 :     bHasMainYGrid = bSupportsAxes && AxisHelper::isGridShown( 1, 0, true, xDiagram );
     429         820 :     bHasMainZGrid = bSupportsAxes && AxisHelper::isGridShown( 2, 0, true, xDiagram );
     430         820 :     bHasHelpXGrid = bSupportsAxes && AxisHelper::isGridShown( 0, 0, false, xDiagram );
     431         820 :     bHasHelpYGrid = bSupportsAxes && AxisHelper::isGridShown( 1, 0, false, xDiagram );
     432         820 :     bHasHelpZGrid = bSupportsAxes && AxisHelper::isGridShown( 2, 0, false, xDiagram );
     433             : 
     434             :     bHasAutoScaledText =
     435         820 :         (ReferenceSizeProvider::getAutoResizeState( xChartDoc ) ==
     436         820 :          ReferenceSizeProvider::AUTO_RESIZE_YES);
     437             : 
     438         820 :     bHasLegend = LegendHelper::hasLegend( xDiagram );
     439         820 :     bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
     440        1640 :     bHasFloor = bHasWall && bIsThreeD;
     441         820 : }
     442             : 
     443         820 : bool ModelState::HasAnyAxis() const
     444             : {
     445         820 :     return bHasXAxis || bHasYAxis || bHasZAxis || bHasAAxis || bHasBAxis;
     446             : }
     447             : 
     448         820 : bool ModelState::HasAnyGrid() const
     449             : {
     450         755 :     return bHasMainXGrid || bHasMainYGrid || bHasMainZGrid ||
     451        1079 :         bHasHelpXGrid || bHasHelpYGrid || bHasHelpZGrid;
     452             : }
     453             : 
     454         820 : bool ModelState::HasAnyTitle() const
     455             : {
     456         820 :     return bHasMainTitle || bHasSubTitle || bHasXAxisTitle || bHasYAxisTitle || bHasZAxisTitle || bHasSecondaryXAxisTitle || bHasSecondaryYAxisTitle;
     457             : }
     458             : 
     459             : } // namespace impl
     460             : 
     461          17 : ControllerCommandDispatch::ControllerCommandDispatch(
     462             :     const Reference< uno::XComponentContext > & xContext,
     463             :     ChartController* pController, CommandDispatchContainer* pContainer ) :
     464             :         impl::ControllerCommandDispatch_Base( xContext ),
     465             :         m_pChartController( pController ),
     466          17 :         m_xController( Reference< frame::XController >( pController ) ),
     467          17 :         m_xSelectionSupplier( Reference< view::XSelectionSupplier >( pController ) ),
     468          17 :         m_xDispatch( Reference< frame::XDispatch >( pController ) ),
     469             :         m_apModelState( new impl::ModelState() ),
     470             :         m_apControllerState( new impl::ControllerState() ),
     471          68 :         m_pDispatchContainer( pContainer )
     472             : {
     473          17 : }
     474             : 
     475           2 : ControllerCommandDispatch::~ControllerCommandDispatch()
     476             : {
     477           2 : }
     478             : 
     479          17 : void ControllerCommandDispatch::initialize()
     480             : {
     481          17 :     if( m_xController.is())
     482             :     {
     483          17 :         Reference< frame::XModel > xModel( m_xController->getModel());
     484          34 :         Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY );
     485             :         OSL_ASSERT( xModifyBroadcaster.is());
     486          17 :         if( xModifyBroadcaster.is())
     487          17 :             xModifyBroadcaster->addModifyListener( this );
     488             : 
     489             :                 // Listen selection modifications (Arrangement feature - issue 63017).
     490          17 :                 if( m_xSelectionSupplier.is() )
     491          17 :                         m_xSelectionSupplier->addSelectionChangeListener( this );
     492             : 
     493          17 :         if( m_apModelState.get() && xModel.is())
     494          17 :             m_apModelState->update( xModel );
     495             : 
     496          17 :         if( m_apControllerState.get() && xModel.is())
     497          17 :             m_apControllerState->update( m_xController, xModel );
     498             : 
     499          34 :         updateCommandAvailability();
     500             :     }
     501          17 : }
     502             : 
     503       84672 : void ControllerCommandDispatch::fireStatusEventForURLImpl(
     504             :     const OUString & rURL,
     505             :     const Reference< frame::XStatusListener > & xSingleListener )
     506             : {
     507       84672 :     ::std::map< OUString, uno::Any >::const_iterator aArgIt( m_aCommandArguments.find( rURL ));
     508       84672 :     if( aArgIt != m_aCommandArguments.end())
     509        3280 :         fireStatusEventForURL( rURL, aArgIt->second, commandAvailable( rURL ), xSingleListener );
     510             :     else
     511       81392 :         fireStatusEventForURL( rURL, uno::Any(), commandAvailable( rURL ), xSingleListener );
     512       84672 : }
     513             : 
     514         820 : void ControllerCommandDispatch::updateCommandAvailability()
     515             : {
     516         820 :     bool bModelStateIsValid = ( m_apModelState.get() != 0 );
     517         820 :     bool bControllerStateIsValid = ( m_apControllerState.get() != 0 );
     518             :     // Model and controller states exist.
     519             :     OSL_ASSERT( bModelStateIsValid );
     520             :     OSL_ASSERT( bControllerStateIsValid );
     521             : 
     522             :     // read-only
     523         820 :     bool bIsWritable = bModelStateIsValid && (! m_apModelState->bIsReadOnly);
     524             :     // paste is available
     525             :     // @todo: determine correctly
     526         820 :     bool bHasSuitableClipboardContent = true;
     527             : 
     528         820 :     bool bShapeContext = m_pChartController && m_pChartController->isShapeContext();
     529             : 
     530         820 :     bool bEnableDataTableDialog = false;
     531         820 :     if ( m_xController.is() )
     532             :     {
     533         820 :         Reference< beans::XPropertySet > xProps( m_xController->getModel(), uno::UNO_QUERY );
     534         820 :         if ( xProps.is() )
     535             :         {
     536             :             try
     537             :             {
     538         820 :                 xProps->getPropertyValue("EnableDataTableDialog") >>= bEnableDataTableDialog;
     539             :             }
     540           0 :             catch( const uno::Exception& e )
     541             :             {
     542             :                 ASSERT_EXCEPTION( e );
     543             :             }
     544         820 :         }
     545             :     }
     546             : 
     547             :     // edit commands
     548         820 :     m_aCommandAvailability[ ".uno:Cut" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsDeleteableObjectSelected;
     549         820 :     m_aCommandAvailability[ ".uno:Copy" ] = bControllerStateIsValid && m_apControllerState->bHasSelectedObject;
     550         820 :     m_aCommandAvailability[ ".uno:Paste" ] = bIsWritable && bHasSuitableClipboardContent;
     551             : 
     552             :     // toolbar commands
     553         820 :     m_aCommandAvailability[ ".uno:ToggleGridHorizontal" ] = bIsWritable;
     554         820 :     m_aCommandArguments[ ".uno:ToggleGridHorizontal" ] = uno::makeAny( m_apModelState->bHasMainYGrid );
     555         820 :     m_aCommandAvailability[ ".uno:ToggleGridVertical" ] = bIsWritable;
     556         820 :     m_aCommandArguments[ ".uno:ToggleGridVertical" ] = uno::makeAny( m_apModelState->bHasMainXGrid );
     557             : 
     558         820 :     m_aCommandAvailability[ ".uno:ToggleLegend" ] = bIsWritable;
     559         820 :     m_aCommandArguments[ ".uno:ToggleLegend" ] = uno::makeAny( m_apModelState->bHasLegend );
     560             : 
     561         820 :     m_aCommandAvailability[ ".uno:NewArrangement" ] = bIsWritable;
     562         820 :     m_aCommandAvailability[ ".uno:Update" ] = bIsWritable;
     563         820 :     m_aCommandAvailability[ ".uno:DefaultColors" ] = bIsWritable;
     564         820 :     m_aCommandAvailability[ ".uno:BarWidth" ] = bIsWritable;
     565         820 :     m_aCommandAvailability[ ".uno:NumberOfLines" ] = bIsWritable;
     566        1640 :     m_aCommandAvailability[ ".uno:ArrangeRow" ] =
     567         820 :         bShapeContext || ( bIsWritable && bControllerStateIsValid && ( m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward ) );
     568             : 
     569             :     // insert objects
     570         820 :     m_aCommandAvailability[ ".uno:InsertTitles" ] = m_aCommandAvailability[ ".uno:InsertMenuTitles" ] = bIsWritable;
     571         820 :     m_aCommandAvailability[ ".uno:InsertLegend" ] = m_aCommandAvailability[ ".uno:InsertMenuLegend" ] = bIsWritable;
     572         820 :     m_aCommandAvailability[ ".uno:DeleteLegend" ] = bIsWritable;
     573         820 :     m_aCommandAvailability[ ".uno:InsertMenuDataLabels" ] = bIsWritable;
     574         820 :     m_aCommandAvailability[ ".uno:InsertRemoveAxes" ] = m_aCommandAvailability[ ".uno:InsertMenuAxes" ] = bIsWritable && m_apModelState->bSupportsAxes;
     575         820 :     m_aCommandAvailability[ ".uno:InsertMenuGrids" ] = bIsWritable && m_apModelState->bSupportsAxes;
     576         820 :     m_aCommandAvailability[ ".uno:InsertMenuTrendlines" ] = bIsWritable && m_apModelState->bSupportsStatistics && m_apControllerState->bMayAddMenuTrendline;
     577         820 :     m_aCommandAvailability[ ".uno:InsertMenuMeanValues" ] = bIsWritable && m_apModelState->bSupportsStatistics;
     578         820 :     m_aCommandAvailability[ ".uno:InsertMenuXErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics;
     579         820 :     m_aCommandAvailability[ ".uno:InsertMenuYErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics;
     580         820 :     m_aCommandAvailability[ ".uno:InsertSymbol" ] = bIsWritable && m_apControllerState->bIsTextObject;
     581             : 
     582             :     // format objects
     583         820 :     bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected;
     584         820 :     m_aCommandAvailability[ ".uno:FormatSelection" ] = bFormatObjectAvailable;
     585         820 :     m_aCommandAvailability[ ".uno:FormatAxis" ] = bFormatObjectAvailable;
     586         820 :     m_aCommandAvailability[ ".uno:FormatTitle" ] = bFormatObjectAvailable;
     587         820 :     m_aCommandAvailability[ ".uno:FormatDataSeries" ] = bFormatObjectAvailable;
     588         820 :     m_aCommandAvailability[ ".uno:FormatDataPoint" ] = bFormatObjectAvailable;
     589         820 :     m_aCommandAvailability[ ".uno:FormatDataLabels" ] = bFormatObjectAvailable;
     590         820 :     m_aCommandAvailability[ ".uno:FormatDataLabel" ] = bFormatObjectAvailable;
     591         820 :     m_aCommandAvailability[ ".uno:FormatXErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatXErrorBars;
     592         820 :     m_aCommandAvailability[ ".uno:FormatYErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatYErrorBars;
     593         820 :     m_aCommandAvailability[ ".uno:FormatMeanValue" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatMeanValue;
     594         820 :     m_aCommandAvailability[ ".uno:FormatTrendline" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendline;
     595         820 :     m_aCommandAvailability[ ".uno:FormatTrendlineEquation" ] = bFormatObjectAvailable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendlineEquation;
     596         820 :     m_aCommandAvailability[ ".uno:FormatStockLoss" ] = bFormatObjectAvailable;
     597         820 :     m_aCommandAvailability[ ".uno:FormatStockGain" ] = bFormatObjectAvailable;
     598             : 
     599         820 :     m_aCommandAvailability[ ".uno:DiagramType" ] = bIsWritable;
     600         820 :     m_aCommandAvailability[ ".uno:Legend" ] = bIsWritable && m_apModelState->bHasLegend;
     601         820 :     m_aCommandAvailability[ ".uno:DiagramWall" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasWall;
     602         820 :     m_aCommandAvailability[ ".uno:DiagramArea" ] = bIsWritable;
     603             : 
     604         820 :     m_aCommandAvailability[ ".uno:TransformDialog" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsPositionableObject;
     605             : 
     606             :     // 3d commands
     607         820 :     m_aCommandAvailability[ ".uno:View3D" ] = bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD;
     608         820 :     m_aCommandAvailability[ ".uno:DiagramFloor" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasFloor;
     609             : 
     610             :     //some mor format commands with different ui text
     611         820 :     m_aCommandAvailability[ ".uno:FormatWall" ] = m_aCommandAvailability[ ".uno:DiagramWall" ];
     612         820 :     m_aCommandAvailability[ ".uno:FormatFloor" ] = m_aCommandAvailability[ ".uno:DiagramFloor" ];
     613         820 :     m_aCommandAvailability[ ".uno:FormatChartArea" ] = m_aCommandAvailability[ ".uno:DiagramArea" ];
     614         820 :     m_aCommandAvailability[ ".uno:FormatLegend" ] = m_aCommandAvailability[ ".uno:Legend" ];
     615             : 
     616             :     // depending on own data
     617         820 :     m_aCommandAvailability[ ".uno:DataRanges" ] = bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData);
     618         820 :     m_aCommandAvailability[ ".uno:DiagramData" ] = bIsWritable && bModelStateIsValid &&  m_apModelState->bHasOwnData && bEnableDataTableDialog;
     619             : 
     620             :     // titles
     621         820 :     m_aCommandAvailability[ ".uno:MainTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainTitle;
     622         820 :     m_aCommandAvailability[ ".uno:SubTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSubTitle;
     623         820 :     m_aCommandAvailability[ ".uno:XTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxisTitle;
     624         820 :     m_aCommandAvailability[ ".uno:YTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxisTitle;
     625         820 :     m_aCommandAvailability[ ".uno:ZTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxisTitle;
     626         820 :     m_aCommandAvailability[ ".uno:SecondaryXTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSecondaryXAxisTitle;
     627         820 :     m_aCommandAvailability[ ".uno:SecondaryYTitle" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSecondaryYAxisTitle;
     628         820 :     m_aCommandAvailability[ ".uno:AllTitles" ] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyTitle();
     629             : 
     630             :     // text
     631         820 :     m_aCommandAvailability[ ".uno:ScaleText" ] = bIsWritable && bModelStateIsValid ;
     632         820 :     m_aCommandArguments[ ".uno:ScaleText" ] = uno::makeAny( m_apModelState->bHasAutoScaledText );
     633             : 
     634             :     // axes
     635         820 :     m_aCommandAvailability[ ".uno:DiagramAxisX" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxis;
     636         820 :     m_aCommandAvailability[ ".uno:DiagramAxisY" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxis;
     637         820 :     m_aCommandAvailability[ ".uno:DiagramAxisZ" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxis;
     638         820 :     m_aCommandAvailability[ ".uno:DiagramAxisA" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasAAxis;
     639         820 :     m_aCommandAvailability[ ".uno:DiagramAxisB" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasBAxis;
     640         820 :     m_aCommandAvailability[ ".uno:DiagramAxisAll" ] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyAxis();
     641             : 
     642             :     // grids
     643             :     // note: x and y are swapped in the commands!
     644         820 :     m_aCommandAvailability[ ".uno:DiagramGridYMain" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainXGrid;
     645         820 :     m_aCommandAvailability[ ".uno:DiagramGridXMain" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainYGrid;
     646         820 :     m_aCommandAvailability[ ".uno:DiagramGridZMain" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainZGrid;
     647         820 :     m_aCommandAvailability[ ".uno:DiagramGridYHelp" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpXGrid;
     648         820 :     m_aCommandAvailability[ ".uno:DiagramGridXHelp" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpYGrid;
     649         820 :     m_aCommandAvailability[ ".uno:DiagramGridZHelp" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpZGrid;
     650         820 :     m_aCommandAvailability[ ".uno:DiagramGridAll" ] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyGrid();
     651             : 
     652             :     // series arrangement
     653        1640 :     m_aCommandAvailability[ ".uno:Forward" ] = ( bShapeContext ? isShapeControllerCommandAvailable( ".uno:Forward" ) :
     654         820 :         ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward && bEnableDataTableDialog ) );
     655        1640 :     m_aCommandAvailability[ ".uno:Backward" ] = ( bShapeContext ? isShapeControllerCommandAvailable( ".uno:Backward" ) :
     656         820 :         ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward && bEnableDataTableDialog ) );
     657             : 
     658         820 :     m_aCommandAvailability[ ".uno:InsertDataLabels" ] = bIsWritable;
     659         820 :     m_aCommandAvailability[ ".uno:InsertDataLabel" ] = bIsWritable;
     660         820 :     m_aCommandAvailability[ ".uno:InsertMeanValue" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddMeanValue;
     661         820 :     m_aCommandAvailability[ ".uno:InsertTrendline" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendline;
     662         820 :     m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
     663         820 :     m_aCommandAvailability[ ".uno:InsertTrendlineEquationAndR2" ] = m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ];
     664         820 :     m_aCommandAvailability[ ".uno:InsertR2Value" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value;
     665         820 :     m_aCommandAvailability[ ".uno:DeleteR2Value" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value;
     666             : 
     667         820 :     m_aCommandAvailability[ ".uno:InsertXErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddXErrorBars;
     668         820 :     m_aCommandAvailability[ ".uno:InsertYErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars;
     669             : 
     670         820 :     m_aCommandAvailability[ ".uno:DeleteDataLabels" ] = bIsWritable;
     671         820 :     m_aCommandAvailability[ ".uno:DeleteDataLabel" ] = bIsWritable;
     672         820 :     m_aCommandAvailability[ ".uno:DeleteTrendline" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline;
     673         820 :     m_aCommandAvailability[ ".uno:DeleteTrendlineEquation" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendlineEquation;
     674         820 :     m_aCommandAvailability[ ".uno:DeleteMeanValue" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue;
     675         820 :     m_aCommandAvailability[ ".uno:DeleteXErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteXErrorBars;
     676         820 :     m_aCommandAvailability[ ".uno:DeleteYErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars;
     677             : 
     678         820 :     m_aCommandAvailability[ ".uno:ResetDataPoint" ] = bIsWritable;
     679         820 :     m_aCommandAvailability[ ".uno:ResetAllDataPoints" ] = bIsWritable;
     680             : 
     681         820 :     m_aCommandAvailability[ ".uno:InsertAxis" ] = bIsWritable;
     682         820 :     m_aCommandAvailability[ ".uno:DeleteAxis" ] = bIsWritable;
     683         820 :     m_aCommandAvailability[ ".uno:InsertAxisTitle" ] = bIsWritable;
     684         820 :     m_aCommandAvailability[ ".uno:FormatMajorGrid" ] = bIsWritable;
     685         820 :     m_aCommandAvailability[ ".uno:InsertMajorGrid" ] = bIsWritable;
     686         820 :     m_aCommandAvailability[ ".uno:DeleteMajorGrid" ] = bIsWritable;
     687         820 :     m_aCommandAvailability[ ".uno:FormatMinorGrid" ] = bIsWritable;
     688         820 :     m_aCommandAvailability[ ".uno:InsertMinorGrid" ] = bIsWritable;
     689         820 :     m_aCommandAvailability[ ".uno:DeleteMinorGrid" ] = bIsWritable;
     690         820 : }
     691             : 
     692       84672 : bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
     693             : {
     694       84672 :     ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.find( rCommand ));
     695       84672 :     if( aIt != m_aCommandAvailability.end())
     696       84672 :         return aIt->second;
     697             :     OSL_FAIL( "commandAvailable: command not in availability map" );
     698           0 :     return false;
     699             : }
     700             : 
     701           0 : bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const OUString& rCommand )
     702             : {
     703           0 :     ShapeController* pShapeController(0);
     704             :     {
     705           0 :         SolarMutexGuard g;
     706           0 :         if (m_pDispatchContainer)
     707           0 :             pShapeController = m_pDispatchContainer->getShapeController();
     708             :     }
     709           0 :     if ( pShapeController )
     710             :     {
     711           0 :         FeatureState aState( pShapeController->getState( rCommand ) );
     712           0 :         return aState.bEnabled;
     713             :     }
     714           0 :     return false;
     715             : }
     716             : 
     717        1177 : void ControllerCommandDispatch::fireStatusEvent(
     718             :     const OUString & rURL,
     719             :     const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
     720             : {
     721        1177 :     bool bIsChartSelectorURL = rURL == ".uno:ChartElementSelector";
     722        1177 :     if( rURL.isEmpty() || bIsChartSelectorURL )
     723             :     {
     724         820 :         uno::Any aArg;
     725         820 :         aArg <<= m_xController;
     726         820 :         fireStatusEventForURL( ".uno:ChartElementSelector", aArg, true, xSingleListener );
     727             :     }
     728             : 
     729        1177 :     if( rURL.isEmpty() )
     730      255354 :         for( ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.begin());
     731      170236 :              aIt != m_aCommandAvailability.end(); ++aIt )
     732       84315 :             fireStatusEventForURLImpl( aIt->first, xSingleListener );
     733         374 :     else if( !bIsChartSelectorURL )
     734         357 :         fireStatusEventForURLImpl( rURL, xSingleListener );
     735             : 
     736             :     // statusbar. Should be handled by base implementation
     737             :     // @todo: remove if Issue 68864 is fixed
     738        1177 :     if( rURL.isEmpty() || rURL == ".uno:StatusBarVisible" )
     739             :     {
     740         803 :         bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xController ));
     741         803 :         fireStatusEventForURL( ".uno:StatusBarVisible", uno::makeAny( bIsStatusBarVisible ), true, xSingleListener );
     742             :     }
     743        1177 : }
     744             : 
     745             : // ____ XDispatch ____
     746           0 : void SAL_CALL ControllerCommandDispatch::dispatch(
     747             :     const util::URL& URL,
     748             :     const Sequence< beans::PropertyValue >& Arguments )
     749             :     throw (uno::RuntimeException, std::exception)
     750             : {
     751           0 :     if( commandAvailable( URL.Complete ))
     752           0 :         m_xDispatch->dispatch( URL, Arguments );
     753           0 : }
     754             : 
     755             : // ____ WeakComponentImplHelperBase ____
     756             : /// is called when this is disposed
     757          17 : void SAL_CALL ControllerCommandDispatch::disposing()
     758             : {
     759          17 :     m_xController.clear();
     760          17 :     m_xDispatch.clear();
     761          17 :     m_xSelectionSupplier.clear();
     762          17 : }
     763             : 
     764             : // ____ XEventListener (base of XModifyListener) ____
     765          17 : void SAL_CALL ControllerCommandDispatch::disposing( const lang::EventObject& /* Source */ )
     766             :     throw (uno::RuntimeException, std::exception)
     767             : {
     768          17 :     m_xController.clear();
     769          17 :     m_xDispatch.clear();
     770          17 :     m_xSelectionSupplier.clear();
     771          17 : }
     772             : 
     773             : // ____ XModifyListener ____
     774         803 : void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEvent )
     775             :     throw (uno::RuntimeException, std::exception)
     776             : {
     777         803 :     bool bUpdateCommandAvailability = false;
     778             : 
     779             :     // Update the "ModelState" Struct.
     780         803 :     if( m_apModelState.get() && m_xController.is())
     781             :     {
     782         803 :         m_apModelState->update( m_xController->getModel());
     783         803 :         bUpdateCommandAvailability = true;
     784             :     }
     785             : 
     786             :     // Update the "ControllerState" Struct.
     787         803 :     if( m_apControllerState.get() && m_xController.is())
     788             :     {
     789         803 :         m_apControllerState->update( m_xController, m_xController->getModel());
     790         803 :         bUpdateCommandAvailability = true;
     791             :     }
     792             : 
     793         803 :     if( bUpdateCommandAvailability )
     794         803 :         updateCommandAvailability();
     795             : 
     796         803 :     CommandDispatch::modified( aEvent );
     797         803 : }
     798             : 
     799             : // ____ XSelectionChangeListener ____
     800           0 : void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObject& aEvent )
     801             :     throw (uno::RuntimeException, std::exception)
     802             : {
     803             :     // Update the "ControllerState" Struct.
     804           0 :     if( m_apControllerState.get() && m_xController.is())
     805             :     {
     806           0 :         m_apControllerState->update( m_xController, m_xController->getModel());
     807           0 :         updateCommandAvailability();
     808             :     }
     809             : 
     810           0 :     CommandDispatch::modified( aEvent );
     811           0 : }
     812             : 
     813          57 : } //  namespace chart
     814             : 
     815             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11