LCOV - code coverage report
Current view: top level - chart2/source/controller/main - ChartController_Window.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 134 1013 13.2 %
Date: 2012-08-25 Functions: 14 50 28.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 128 2309 5.5 %

           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                 :            : #include "PositionAndSizeHelper.hxx"
      22                 :            : #include "ObjectIdentifier.hxx"
      23                 :            : #include "ChartWindow.hxx"
      24                 :            : #include "ResId.hxx"
      25                 :            : #include "CommonConverters.hxx"
      26                 :            : #include "ChartModelHelper.hxx"
      27                 :            : #include "DiagramHelper.hxx"
      28                 :            : #include "TitleHelper.hxx"
      29                 :            : #include "UndoGuard.hxx"
      30                 :            : #include "ControllerLockGuard.hxx"
      31                 :            : #include "ObjectNameProvider.hxx"
      32                 :            : #include "Strings.hrc"
      33                 :            : #include "macros.hxx"
      34                 :            : #include "DragMethod_PieSegment.hxx"
      35                 :            : #include "DragMethod_RotateDiagram.hxx"
      36                 :            : #include "ObjectHierarchy.hxx"
      37                 :            : #include "chartview/ExplicitValueProvider.hxx"
      38                 :            : #include "RelativePositionHelper.hxx"
      39                 :            : #include "chartview/DrawModelWrapper.hxx"
      40                 :            : #include "RegressionCurveHelper.hxx"
      41                 :            : #include "StatisticsHelper.hxx"
      42                 :            : #include "DataSeriesHelper.hxx"
      43                 :            : #include "ContainerHelper.hxx"
      44                 :            : #include "AxisHelper.hxx"
      45                 :            : #include "LegendHelper.hxx"
      46                 :            : #include "servicenames_charttypes.hxx"
      47                 :            : #include "MenuResIds.hrc"
      48                 :            : #include "DrawCommandDispatch.hxx"
      49                 :            : 
      50                 :            : #include <com/sun/star/chart2/RelativePosition.hpp>
      51                 :            : #include <com/sun/star/chart2/RelativeSize.hpp>
      52                 :            : #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
      53                 :            : 
      54                 :            : #include <com/sun/star/frame/XDispatchHelper.hpp>
      55                 :            : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      56                 :            : #include <com/sun/star/util/XUpdatable.hpp>
      57                 :            : #include <comphelper/InlineContainer.hxx>
      58                 :            : 
      59                 :            : #include <svtools/contextmenuhelper.hxx>
      60                 :            : #include <toolkit/awt/vclxmenu.hxx>
      61                 :            : 
      62                 :            : #include <svx/svxids.hrc>
      63                 :            : #include <svx/ActionDescriptionProvider.hxx>
      64                 :            : 
      65                 :            : // header for class E3dObject
      66                 :            : #include <svx/obj3d.hxx>
      67                 :            : // header for class E3dScene
      68                 :            : #include <svx/scene3d.hxx>
      69                 :            : // header for class SdrDragMethod
      70                 :            : #include <svx/svddrgmt.hxx>
      71                 :            : #include <vcl/svapp.hxx>
      72                 :            : #include <osl/mutex.hxx>
      73                 :            : 
      74                 :            : // for InfoBox
      75                 :            : #include <vcl/msgbox.hxx>
      76                 :            : 
      77                 :            : #include <rtl/math.hxx>
      78                 :            : #include <svtools/acceleratorexecute.hxx>
      79                 :            : 
      80                 :            : #define DRGPIX    2     // Drag MinMove in Pixel
      81                 :            : 
      82                 :            : using namespace ::com::sun::star;
      83                 :            : using namespace ::com::sun::star::chart2;
      84                 :            : using ::com::sun::star::uno::Reference;
      85                 :            : using ::rtl::OUString;
      86                 :            : 
      87                 :            : //.............................................................................
      88                 :            : namespace chart
      89                 :            : {
      90                 :            : //.............................................................................
      91                 :            : 
      92                 :            : namespace
      93                 :            : {
      94                 :          0 : bool lcl_GrowAndShiftLogic(
      95                 :            :     RelativePosition &  rInOutRelPos,
      96                 :            :     RelativeSize &      rInOutRelSize,
      97                 :            :     const awt::Size &   rRefSize,
      98                 :            :     double              fGrowLogicX,
      99                 :            :     double              fGrowLogicY )
     100                 :            : {
     101 [ #  # ][ #  # ]:          0 :     if( rRefSize.Width == 0 ||
     102                 :            :         rRefSize.Height == 0 )
     103                 :          0 :         return false;
     104                 :            : 
     105                 :          0 :     double fRelativeGrowX = fGrowLogicX / rRefSize.Width;
     106                 :          0 :     double fRelativeGrowY = fGrowLogicY / rRefSize.Height;
     107                 :            : 
     108                 :            :     return ::chart::RelativePositionHelper::centerGrow(
     109                 :            :         rInOutRelPos, rInOutRelSize,
     110                 :            :         fRelativeGrowX, fRelativeGrowY,
     111                 :          0 :         /* bCheck = */ true );
     112                 :            : }
     113                 :            : 
     114                 :          0 : bool lcl_MoveObjectLogic(
     115                 :            :     RelativePosition &  rInOutRelPos,
     116                 :            :     RelativeSize &      rObjectSize,
     117                 :            :     const awt::Size &   rRefSize,
     118                 :            :     double              fShiftLogicX,
     119                 :            :     double              fShiftLogicY )
     120                 :            : {
     121 [ #  # ][ #  # ]:          0 :     if( rRefSize.Width == 0 ||
     122                 :            :         rRefSize.Height == 0 )
     123                 :          0 :         return false;
     124                 :            : 
     125                 :          0 :     double fRelativeShiftX = fShiftLogicX / rRefSize.Width;
     126                 :          0 :     double fRelativeShiftY = fShiftLogicY / rRefSize.Height;
     127                 :            : 
     128                 :            :     return ::chart::RelativePositionHelper::moveObject(
     129                 :            :         rInOutRelPos, rObjectSize,
     130                 :            :         fRelativeShiftX, fRelativeShiftY,
     131                 :          0 :         /* bCheck = */ true );
     132                 :            : }
     133                 :            : 
     134                 :          0 : void lcl_insertMenuCommand(
     135                 :            :     const uno::Reference< awt::XPopupMenu > & xMenu,
     136                 :            :     const uno::Reference< awt::XMenuExtended > & xMenuEx,
     137                 :            :     sal_Int16 nId, const ::rtl::OUString & rCommand )
     138                 :            : {
     139 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString aEmptyString;
     140                 :          0 :     xMenu->insertItem( nId, aEmptyString, 0, -1 );
     141                 :          0 :     xMenuEx->setCommand( nId, rCommand );
     142                 :          0 : }
     143                 :            : 
     144                 :          0 : OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
     145                 :            : {
     146                 :          0 :     OUString aDispatchCommand( C2U(".uno:FormatSelection") );
     147                 :            : 
     148         [ #  # ]:          0 :     ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
     149                 :            : 
     150   [ #  #  #  #  :          0 :     switch(eObjectType)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     151                 :            :     {
     152                 :            :         case OBJECTTYPE_DIAGRAM:
     153                 :            :         case OBJECTTYPE_DIAGRAM_WALL:
     154         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatWall");
     155                 :          0 :             break;
     156                 :            :         case OBJECTTYPE_DIAGRAM_FLOOR:
     157         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatFloor");
     158                 :          0 :             break;
     159                 :            :         case OBJECTTYPE_PAGE:
     160         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatChartArea");
     161                 :          0 :             break;
     162                 :            :         case OBJECTTYPE_LEGEND:
     163         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatLegend");
     164                 :          0 :             break;
     165                 :            :         case OBJECTTYPE_TITLE:
     166         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatTitle");
     167                 :          0 :             break;
     168                 :            :         case OBJECTTYPE_LEGEND_ENTRY:
     169         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatDataSeries");
     170                 :          0 :             break;
     171                 :            :         case OBJECTTYPE_AXIS:
     172                 :            :         case OBJECTTYPE_AXIS_UNITLABEL:
     173         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatAxis");
     174                 :          0 :             break;
     175                 :            :         case OBJECTTYPE_GRID:
     176         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatMajorGrid");
     177                 :          0 :             break;
     178                 :            :         case OBJECTTYPE_SUBGRID:
     179         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatMinorGrid");
     180                 :          0 :             break;
     181                 :            :         case OBJECTTYPE_DATA_LABELS:
     182         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatDataLabels");
     183                 :          0 :             break;
     184                 :            :         case OBJECTTYPE_DATA_SERIES:
     185         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatDataSeries");
     186                 :          0 :             break;
     187                 :            :         case OBJECTTYPE_DATA_LABEL:
     188         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatDataLabel");
     189                 :          0 :             break;
     190                 :            :         case OBJECTTYPE_DATA_POINT:
     191         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatDataPoint");
     192                 :          0 :             break;
     193                 :            :         case OBJECTTYPE_DATA_AVERAGE_LINE:
     194         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatMeanValue");
     195                 :          0 :             break;
     196                 :            :         case OBJECTTYPE_DATA_ERRORS_X:
     197         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatXErrorBars");
     198                 :          0 :             break;
     199                 :            :         case OBJECTTYPE_DATA_ERRORS_Y:
     200         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatYErrorBars");
     201                 :          0 :             break;
     202                 :            :         case OBJECTTYPE_DATA_ERRORS_Z:
     203         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatZErrorBars");
     204                 :          0 :             break;
     205                 :            :         case OBJECTTYPE_DATA_CURVE:
     206         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatTrendline");
     207                 :          0 :             break;
     208                 :            :         case OBJECTTYPE_DATA_CURVE_EQUATION:
     209         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatTrendlineEquation");
     210                 :          0 :             break;
     211                 :            :         case OBJECTTYPE_DATA_STOCK_RANGE:
     212         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatSelection");
     213                 :          0 :             break;
     214                 :            :         case OBJECTTYPE_DATA_STOCK_LOSS:
     215         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatStockLoss");
     216                 :          0 :             break;
     217                 :            :         case OBJECTTYPE_DATA_STOCK_GAIN:
     218         [ #  # ]:          0 :             aDispatchCommand = C2U(".uno:FormatStockGain");
     219                 :          0 :             break;
     220                 :            :         default: //OBJECTTYPE_UNKNOWN
     221                 :          0 :             break;
     222                 :            :     }
     223                 :          0 :     return aDispatchCommand;
     224                 :            : }
     225                 :            : 
     226                 :            : } // anonymous namespace
     227                 :            : 
     228                 :            : const short HITPIX=2; //hit-tolerance in pixel
     229                 :            : 
     230                 :            : //-----------------------------------------------------------------
     231                 :            : // awt::XWindow
     232                 :            : //-----------------------------------------------------------------
     233                 :         36 :     void SAL_CALL ChartController
     234                 :            : ::setPosSize( sal_Int32 X, sal_Int32 Y
     235                 :            :             , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
     236                 :            :             throw (uno::RuntimeException)
     237                 :            : {
     238         [ +  - ]:         36 :     SolarMutexGuard aGuard;
     239                 :         36 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     240                 :            : 
     241 [ +  - ][ +  - ]:         36 :     if(xWindow.is() && m_pChartWindow)
                 [ +  - ]
     242                 :            :     {
     243 [ +  - ][ +  - ]:         36 :         Size aLogicSize = m_pChartWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM )  );
                 [ +  - ]
     244                 :            : 
     245                 :         36 :         bool bIsEmbedded = true;
     246                 :            :         //todo: for standalone chart: detect whether we are standalone
     247         [ +  - ]:         36 :         if( bIsEmbedded )
     248                 :            :         {
     249                 :            :             //change map mode to fit new size
     250 [ +  - ][ +  - ]:         36 :             awt::Size aModelPageSize = ChartModelHelper::getPageSize( getModel() );
     251                 :         36 :             sal_Int32 nScaleXNumerator = aLogicSize.Width();
     252                 :         36 :             sal_Int32 nScaleXDenominator = aModelPageSize.Width;
     253                 :         36 :             sal_Int32 nScaleYNumerator = aLogicSize.Height();
     254                 :         36 :             sal_Int32 nScaleYDenominator = aModelPageSize.Height;
     255                 :            :             MapMode aNewMapMode( MAP_100TH_MM, Point(0,0)
     256                 :            :             , Fraction(nScaleXNumerator,nScaleXDenominator)
     257 [ +  - ][ +  - ]:         36 :             , Fraction(nScaleYNumerator,nScaleYDenominator) );
                 [ +  - ]
     258         [ +  - ]:         36 :             m_pChartWindow->SetMapMode(aNewMapMode);
     259         [ +  - ]:         36 :             m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
     260                 :            : 
     261                 :            :             //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
     262         [ +  - ]:         36 :             uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
     263         [ +  - ]:         36 :             if( xProp.is() )
     264                 :            :             {
     265         [ +  - ]:         36 :                 uno::Sequence< beans::PropertyValue > aZoomFactors(4);
     266 [ +  - ][ +  - ]:         36 :                 aZoomFactors[0].Name = C2U("ScaleXNumerator");
     267 [ +  - ][ +  - ]:         36 :                 aZoomFactors[0].Value = uno::makeAny( nScaleXNumerator );
     268 [ +  - ][ +  - ]:         36 :                 aZoomFactors[1].Name = C2U("ScaleXDenominator");
     269 [ +  - ][ +  - ]:         36 :                 aZoomFactors[1].Value = uno::makeAny( nScaleXDenominator );
     270 [ +  - ][ +  - ]:         36 :                 aZoomFactors[2].Name = C2U("ScaleYNumerator");
     271 [ +  - ][ +  - ]:         36 :                 aZoomFactors[2].Value = uno::makeAny( nScaleYNumerator );
     272 [ +  - ][ +  - ]:         36 :                 aZoomFactors[3].Name = C2U("ScaleYDenominator");
     273 [ +  - ][ +  - ]:         36 :                 aZoomFactors[3].Value = uno::makeAny( nScaleYDenominator );
     274 [ +  - ][ +  - ]:         36 :                 xProp->setPropertyValue( C2U("ZoomFactors"), uno::makeAny( aZoomFactors ));
         [ +  - ][ +  - ]
                 [ +  - ]
     275                 :            :             }
     276                 :            : 
     277                 :            :             //a correct work area is at least necessary for correct values in the position and  size dialog and for dragging area
     278         [ +  - ]:         36 :             if(m_pDrawViewWrapper)
     279                 :            :             {
     280 [ +  - ][ +  - ]:         36 :                 Rectangle aRect(Point(0,0), m_pChartWindow->GetOutputSize());
     281                 :         36 :                 m_pDrawViewWrapper->SetWorkArea( aRect );
     282         [ +  - ]:         36 :             }
     283                 :            :         }
     284                 :            :         else
     285                 :            :         {
     286                 :            :             //change visarea
     287 [ #  # ][ #  # ]:          0 :             ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() );
     288         [ #  # ]:          0 :             m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
     289                 :            :         }
     290         [ +  - ]:         36 :         m_pChartWindow->Invalidate();
     291         [ +  - ]:         36 :     }
     292                 :         36 : }
     293                 :            : 
     294                 :         66 :     awt::Rectangle SAL_CALL ChartController
     295                 :            : ::getPosSize()
     296                 :            :             throw (uno::RuntimeException)
     297                 :            : {
     298                 :            :     //@todo
     299                 :         66 :     awt::Rectangle aRet(0,0,0,0);
     300                 :            : 
     301                 :         66 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     302         [ +  + ]:         66 :     if(xWindow.is())
     303 [ +  - ][ +  - ]:         34 :         aRet = xWindow->getPosSize();
     304                 :            : 
     305                 :         66 :     return aRet;
     306                 :            : }
     307                 :            : 
     308                 :          0 :     void SAL_CALL ChartController
     309                 :            : ::setVisible( sal_Bool Visible )
     310                 :            :             throw (uno::RuntimeException)
     311                 :            : {
     312                 :            :     //@todo
     313                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     314                 :            : 
     315         [ #  # ]:          0 :     if(xWindow.is())
     316 [ #  # ][ #  # ]:          0 :         xWindow->setVisible( Visible );
     317                 :          0 : }
     318                 :            : 
     319                 :          0 :     void SAL_CALL ChartController
     320                 :            : ::setEnable( sal_Bool Enable )
     321                 :            :             throw (uno::RuntimeException)
     322                 :            : {
     323                 :            :     //@todo
     324                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     325                 :            : 
     326         [ #  # ]:          0 :     if(xWindow.is())
     327 [ #  # ][ #  # ]:          0 :         xWindow->setEnable( Enable );
     328                 :          0 : }
     329                 :            : 
     330                 :         34 :     void SAL_CALL ChartController
     331                 :            : ::setFocus()    throw (uno::RuntimeException)
     332                 :            : {
     333                 :            :     //@todo
     334                 :         34 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     335                 :            : 
     336         [ +  - ]:         34 :     if(xWindow.is())
     337 [ +  - ][ +  - ]:         34 :         xWindow->setFocus();
     338                 :         34 : }
     339                 :            : 
     340                 :          0 :     void SAL_CALL ChartController
     341                 :            : ::addWindowListener( const uno::Reference<
     342                 :            :             awt::XWindowListener >& xListener )
     343                 :            :             throw (uno::RuntimeException)
     344                 :            : {
     345                 :            :     //@todo
     346                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     347                 :            : 
     348         [ #  # ]:          0 :     if(xWindow.is())
     349 [ #  # ][ #  # ]:          0 :         xWindow->addWindowListener( xListener );
     350                 :          0 : }
     351                 :            : 
     352                 :          0 :     void SAL_CALL ChartController
     353                 :            : ::removeWindowListener( const uno::Reference<
     354                 :            :             awt::XWindowListener >& xListener )
     355                 :            :             throw (uno::RuntimeException)
     356                 :            : {
     357                 :            :     //@todo
     358                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     359                 :            : 
     360         [ #  # ]:          0 :     if(xWindow.is())
     361 [ #  # ][ #  # ]:          0 :         xWindow->removeWindowListener( xListener );
     362                 :          0 : }
     363                 :            : 
     364                 :          0 :     void SAL_CALL ChartController
     365                 :            : ::addFocusListener( const uno::Reference<
     366                 :            :             awt::XFocusListener >& xListener )
     367                 :            :             throw (uno::RuntimeException)
     368                 :            : {
     369                 :            :     //@todo
     370                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     371                 :            : 
     372         [ #  # ]:          0 :     if(xWindow.is())
     373 [ #  # ][ #  # ]:          0 :         xWindow->addFocusListener( xListener );
     374                 :          0 : }
     375                 :            : 
     376                 :          0 :     void SAL_CALL ChartController
     377                 :            : ::removeFocusListener( const uno::Reference<
     378                 :            :             awt::XFocusListener >& xListener )
     379                 :            :             throw (uno::RuntimeException)
     380                 :            : {
     381                 :            :     //@todo
     382                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     383                 :            : 
     384         [ #  # ]:          0 :     if(xWindow.is())
     385 [ #  # ][ #  # ]:          0 :         xWindow->removeFocusListener( xListener );
     386                 :          0 : }
     387                 :            : 
     388                 :          0 :     void SAL_CALL ChartController
     389                 :            : ::addKeyListener( const uno::Reference<
     390                 :            :             awt::XKeyListener >& xListener )
     391                 :            :             throw (uno::RuntimeException)
     392                 :            : {
     393                 :            :     //@todo
     394                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     395                 :            : 
     396         [ #  # ]:          0 :     if(xWindow.is())
     397 [ #  # ][ #  # ]:          0 :         xWindow->addKeyListener( xListener );
     398                 :          0 : }
     399                 :            : 
     400                 :          0 :     void SAL_CALL ChartController
     401                 :            : ::removeKeyListener( const uno::Reference<
     402                 :            :             awt::XKeyListener >& xListener )
     403                 :            :             throw (uno::RuntimeException)
     404                 :            : {
     405                 :            :     //@todo
     406                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     407                 :            : 
     408         [ #  # ]:          0 :     if(xWindow.is())
     409 [ #  # ][ #  # ]:          0 :         xWindow->removeKeyListener( xListener );
     410                 :          0 : }
     411                 :            : 
     412                 :          0 :     void SAL_CALL ChartController
     413                 :            : ::addMouseListener( const uno::Reference<
     414                 :            :             awt::XMouseListener >& xListener )
     415                 :            :             throw (uno::RuntimeException)
     416                 :            : {
     417                 :            :     //@todo
     418                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     419                 :            : 
     420         [ #  # ]:          0 :     if(xWindow.is())
     421 [ #  # ][ #  # ]:          0 :         xWindow->addMouseListener( xListener );
     422                 :          0 : }
     423                 :            : 
     424                 :          0 :     void SAL_CALL ChartController
     425                 :            : ::removeMouseListener( const uno::Reference<
     426                 :            :             awt::XMouseListener >& xListener )
     427                 :            :             throw (uno::RuntimeException)
     428                 :            : {
     429                 :            :     //@todo
     430                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     431                 :            : 
     432         [ #  # ]:          0 :     if(xWindow.is())
     433 [ #  # ][ #  # ]:          0 :         xWindow->removeMouseListener( xListener );
     434                 :          0 : }
     435                 :            : 
     436                 :          0 :     void SAL_CALL ChartController
     437                 :            : ::addMouseMotionListener( const uno::Reference<
     438                 :            :             awt::XMouseMotionListener >& xListener )
     439                 :            :             throw (uno::RuntimeException)
     440                 :            : {
     441                 :            :     //@todo
     442                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     443                 :            : 
     444         [ #  # ]:          0 :     if(xWindow.is())
     445 [ #  # ][ #  # ]:          0 :         xWindow->addMouseMotionListener( xListener );
     446                 :          0 : }
     447                 :            : 
     448                 :          0 :     void SAL_CALL ChartController
     449                 :            : ::removeMouseMotionListener( const uno::Reference<
     450                 :            :             awt::XMouseMotionListener >& xListener )
     451                 :            :             throw (uno::RuntimeException)
     452                 :            : {
     453                 :            :     //@todo
     454                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     455                 :            : 
     456         [ #  # ]:          0 :     if(xWindow.is())
     457 [ #  # ][ #  # ]:          0 :         xWindow->removeMouseMotionListener( xListener );
     458                 :          0 : }
     459                 :            : 
     460                 :          0 :     void SAL_CALL ChartController
     461                 :            : ::addPaintListener( const uno::Reference<
     462                 :            :             awt::XPaintListener >& xListener )
     463                 :            :             throw (uno::RuntimeException)
     464                 :            : {
     465                 :            :     //@todo
     466                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     467                 :            : 
     468         [ #  # ]:          0 :     if(xWindow.is())
     469 [ #  # ][ #  # ]:          0 :         xWindow->addPaintListener( xListener );
     470                 :          0 : }
     471                 :            : 
     472                 :          0 :     void SAL_CALL ChartController
     473                 :            : ::removePaintListener( const uno::Reference<
     474                 :            :             awt::XPaintListener >& xListener )
     475                 :            :             throw (uno::RuntimeException)
     476                 :            : {
     477                 :            :     //@todo
     478                 :          0 :     uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
     479                 :            : 
     480         [ #  # ]:          0 :     if(xWindow.is())
     481 [ #  # ][ #  # ]:          0 :         xWindow->removePaintListener( xListener );
     482                 :          0 : }
     483                 :            : 
     484                 :            : //-----------------------------------------------------------------
     485                 :            : // impl vcl window controller methods
     486                 :            : //-----------------------------------------------------------------
     487                 :       1007 : void ChartController::PrePaint()
     488                 :            : {
     489                 :            :     // forward VCLs PrePaint window event to DrawingLayer
     490                 :       1007 :     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
     491                 :            : 
     492         [ +  - ]:       1007 :     if(pDrawViewWrapper)
     493                 :            :     {
     494                 :       1007 :         pDrawViewWrapper->PrePaint();
     495                 :            :     }
     496                 :       1007 : }
     497                 :            : 
     498                 :        912 : void ChartController::execute_Paint( const Rectangle& rRect )
     499                 :            : {
     500                 :            :     try
     501                 :            :     {
     502         [ +  - ]:        912 :         uno::Reference< frame::XModel > xModel( getModel() );
     503                 :            :         //OSL_ENSURE( xModel.is(), "ChartController::execute_Paint: have no model to paint");
     504         [ +  + ]:        912 :         if( !xModel.is() )
     505                 :        912 :             return;
     506                 :            : 
     507                 :            :         //better performance for big data
     508         [ +  - ]:        908 :         uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
     509         [ +  - ]:        908 :         if( xProp.is() )
     510                 :            :         {
     511                 :        908 :             awt::Size aResolution(1000,1000);
     512                 :            :             {
     513         [ +  - ]:        908 :                 SolarMutexGuard aGuard;
     514         [ +  - ]:        908 :                 if( m_pChartWindow )
     515                 :            :                 {
     516         [ +  - ]:        908 :                     aResolution.Width = m_pChartWindow->GetSizePixel().Width();
     517         [ +  - ]:        908 :                     aResolution.Height = m_pChartWindow->GetSizePixel().Height();
     518         [ +  - ]:        908 :                 }
     519                 :            :             }
     520 [ +  - ][ +  - ]:        908 :             xProp->setPropertyValue( C2U("Resolution"), uno::makeAny( aResolution ));
         [ +  - ][ +  - ]
     521                 :            :         }
     522                 :            :         //
     523                 :            : 
     524         [ +  - ]:        908 :         uno::Reference< util::XUpdatable > xUpdatable( m_xChartView, uno::UNO_QUERY );
     525         [ +  - ]:        908 :         if( xUpdatable.is() )
     526 [ +  - ][ +  - ]:        908 :             xUpdatable->update();
     527                 :            : 
     528                 :            :         {
     529         [ +  - ]:        908 :             SolarMutexGuard aGuard;
     530                 :        908 :             DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
     531         [ +  - ]:        908 :             if(pDrawViewWrapper)
     532 [ +  - ][ +  - ]:        908 :                 pDrawViewWrapper->CompleteRedraw(m_pChartWindow, Region(rRect) );
         [ +  - ][ +  - ]
     533 [ +  + ][ #  # ]:        912 :         }
     534                 :            :     }
     535                 :          0 :     catch( const uno::Exception & ex )
     536                 :            :     {
     537                 :            :         ASSERT_EXCEPTION( ex );
     538                 :            :     }
     539                 :          0 :     catch( ... )
     540                 :            :     {
     541                 :            :     }
     542                 :            : }
     543                 :            : 
     544                 :          0 : bool isDoubleClick( const MouseEvent& rMEvt )
     545                 :            : {
     546                 :          0 :     return rMEvt.GetClicks() == 2 && rMEvt.IsLeft() &&
     547 [ #  # ][ #  # ]:          0 :         !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift();
                 [ #  # ]
           [ #  #  #  # ]
     548                 :            : }
     549                 :            : 
     550                 :            : //-----------------------------------------------------------------------------
     551                 :            : //-----------------------------------------------------------------------------
     552                 :            : //-----------------------------------------------------------------------------
     553                 :            : 
     554                 :          0 : void ChartController::startDoubleClickWaiting()
     555                 :            : {
     556         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     557                 :            : 
     558                 :          0 :     m_bWaitingForDoubleClick = true;
     559                 :            : 
     560                 :          0 :     sal_uLong nDblClkTime = 500;
     561         [ #  # ]:          0 :     if( m_pChartWindow )
     562                 :            :     {
     563                 :          0 :         const MouseSettings& rMSettings = m_pChartWindow->GetSettings().GetMouseSettings();
     564                 :          0 :         nDblClkTime = rMSettings.GetDoubleClickTime();
     565                 :            :     }
     566         [ #  # ]:          0 :     m_aDoubleClickTimer.SetTimeout( nDblClkTime );
     567 [ #  # ][ #  # ]:          0 :     m_aDoubleClickTimer.Start();
     568                 :          0 : }
     569                 :            : 
     570                 :         68 : void ChartController::stopDoubleClickWaiting()
     571                 :            : {
     572                 :         68 :     m_aDoubleClickTimer.Stop();
     573                 :         68 :     m_bWaitingForDoubleClick = false;
     574                 :         68 : }
     575                 :            : 
     576                 :          0 : IMPL_LINK_NOARG(ChartController, DoubleClickWaitingHdl)
     577                 :            : {
     578                 :          0 :     m_bWaitingForDoubleClick = false;
     579                 :            : 
     580 [ #  # ][ #  # ]:          0 :     if( !m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
                 [ #  # ]
     581                 :            :     {
     582         [ #  # ]:          0 :         this->impl_selectObjectAndNotiy();
     583         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     584         [ #  # ]:          0 :         if( m_pChartWindow )
     585                 :            :         {
     586         [ #  # ]:          0 :             Window::PointerState aPointerState( m_pChartWindow->GetPointerState() );
     587                 :            :             MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/,
     588                 :            :                                     0/*nMode*/, static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/,
     589         [ #  # ]:          0 :                                     0/*nModifier*/ );
     590         [ #  # ]:          0 :             impl_SetMousePointer( aMouseEvent );
     591         [ #  # ]:          0 :         }
     592                 :            :     }
     593                 :            : 
     594                 :          0 :     return 0;
     595                 :            : }
     596                 :            : 
     597                 :            : //------------------------------------------------------------------------
     598                 :            : 
     599                 :          0 : void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
     600                 :            : {
     601         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     602                 :            : 
     603                 :          0 :     m_bWaitingForMouseUp = true;
     604                 :            : 
     605         [ #  # ]:          0 :     if( isDoubleClick(rMEvt) )
     606         [ #  # ]:          0 :         stopDoubleClickWaiting();
     607                 :            :     else
     608         [ #  # ]:          0 :         startDoubleClickWaiting();
     609                 :            : 
     610         [ #  # ]:          0 :     m_aSelection.remindSelectionBeforeMouseDown();
     611                 :            : 
     612                 :          0 :     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
     613 [ #  # ][ #  # ]:          0 :     if(!m_pChartWindow || !pDrawViewWrapper )
     614                 :            :         return;
     615                 :            : 
     616         [ #  # ]:          0 :     Point   aMPos   = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel());
     617                 :            : 
     618         [ #  # ]:          0 :     if ( MOUSE_LEFT == rMEvt.GetButtons() )
     619                 :            :     {
     620         [ #  # ]:          0 :         m_pChartWindow->GrabFocus();
     621         [ #  # ]:          0 :         m_pChartWindow->CaptureMouse();
     622                 :            :     }
     623                 :            : 
     624 [ #  # ][ #  # ]:          0 :     if( pDrawViewWrapper->IsTextEdit() )
     625                 :            :     {
     626         [ #  # ]:          0 :         SdrViewEvent aVEvt;
     627         [ #  # ]:          0 :         if ( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX ) ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     628                 :            :              // #i12587# support for shapes in chart
     629         [ #  # ]:          0 :              ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) )
     630                 :            :         {
     631         [ #  # ]:          0 :             pDrawViewWrapper->MouseButtonDown(rMEvt,m_pChartWindow);
     632                 :            :             return;
     633                 :            :         }
     634                 :            :         else
     635                 :            :         {
     636 [ #  # ][ #  # ]:          0 :             this->EndTextEdit();
     637         [ #  # ]:          0 :         }
     638                 :            :     }
     639                 :            : 
     640                 :            :     //abort running action
     641 [ #  # ][ #  # ]:          0 :     if( pDrawViewWrapper->IsAction() )
     642                 :            :     {
     643         [ #  # ]:          0 :         if( rMEvt.IsRight() )
     644         [ #  # ]:          0 :             pDrawViewWrapper->BckAction();
     645                 :            :         return;
     646                 :            :     }
     647                 :            : 
     648         [ #  # ]:          0 :     if( isDoubleClick(rMEvt) ) //do not change selection if double click
     649                 :            :         return;//double click is handled further in mousebutton up
     650                 :            : 
     651                 :          0 :     SdrHdl* pHitSelectionHdl = 0;
     652                 :            :     //switch from move to resize if handle is hit on a resizeable object
     653 [ #  # ][ #  # ]:          0 :     if( m_aSelection.isResizeableObjectSelected() )
     654         [ #  # ]:          0 :         pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos );
     655                 :            :     //only change selection if no selection handles are hit
     656         [ #  # ]:          0 :     if( !pHitSelectionHdl )
     657                 :            :     {
     658                 :            :         // #i12587# support for shapes in chart
     659 [ #  # ][ #  # ]:          0 :         if ( m_eDrawMode == CHARTDRAW_INSERT &&
         [ #  # ][ #  # ]
     660 [ #  # ][ #  # ]:          0 :              ( !pDrawViewWrapper->IsMarkedHit( aMPos ) || !m_aSelection.isDragableObjectSelected() ) )
     661                 :            :         {
     662 [ #  # ][ #  # ]:          0 :             if ( m_aSelection.hasSelection() )
     663                 :            :             {
     664         [ #  # ]:          0 :                 m_aSelection.clearSelection();
     665                 :            :             }
     666 [ #  # ][ #  # ]:          0 :             if ( !pDrawViewWrapper->IsAction() )
     667                 :            :             {
     668         [ #  # ]:          0 :                 if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION )
     669                 :            :                 {
     670                 :          0 :                     Size aCaptionSize( 2268, 1134 );
     671         [ #  # ]:          0 :                     pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize );
     672                 :            :                 }
     673                 :            :                 else
     674                 :            :                 {
     675         [ #  # ]:          0 :                     pDrawViewWrapper->BegCreateObj( aMPos);
     676                 :            :                 }
     677                 :          0 :                 SdrObject* pObj = pDrawViewWrapper->GetCreateObj();
     678                 :          0 :                 DrawCommandDispatch* pDrawCommandDispatch = m_aDispatchContainer.getDrawCommandDispatch();
     679 [ #  # ][ #  # ]:          0 :                 if ( pObj && m_pDrawModelWrapper && pDrawCommandDispatch )
         [ #  # ][ #  # ]
     680                 :            :                 {
     681 [ #  # ][ #  # ]:          0 :                     SfxItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
     682         [ #  # ]:          0 :                     pDrawCommandDispatch->setAttributes( pObj );
     683         [ #  # ]:          0 :                     pDrawCommandDispatch->setLineEnds( aSet );
     684 [ #  # ][ #  # ]:          0 :                     pObj->SetMergedItemSet( aSet );
     685                 :            :                 }
     686                 :            :             }
     687         [ #  # ]:          0 :             impl_SetMousePointer( rMEvt );
     688                 :            :             return;
     689                 :            :         }
     690                 :            : 
     691                 :            :         m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper
     692         [ #  # ]:          0 :             , rMEvt.IsRight(), m_bWaitingForDoubleClick );
     693                 :            : 
     694 [ #  # ][ #  # ]:          0 :         if( !m_aSelection.isRotateableObjectSelected( getModel() ) )
                 [ #  # ]
     695                 :            :         {
     696                 :          0 :                 m_eDragMode = SDRDRAG_MOVE;
     697         [ #  # ]:          0 :                 pDrawViewWrapper->SetDragMode(m_eDragMode);
     698                 :            :         }
     699                 :            : 
     700         [ #  # ]:          0 :         m_aSelection.applySelection(pDrawViewWrapper);
     701                 :            :     }
     702         [ #  # ]:          0 :     if( m_aSelection.isDragableObjectSelected()
           [ #  #  #  # ]
                 [ #  # ]
     703                 :          0 :          && !rMEvt.IsRight() )
     704                 :            :     {
     705                 :            :         //start drag
     706         [ #  # ]:          0 :         sal_uInt16  nDrgLog = (sal_uInt16)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width();
     707                 :          0 :         SdrDragMethod* pDragMethod = NULL;
     708                 :            : 
     709                 :            :         //change selection to 3D scene if rotate mode
     710                 :          0 :         SdrDragMode eDragMode = pDrawViewWrapper->GetDragMode();
     711         [ #  # ]:          0 :         if( SDRDRAG_ROTATE==eDragMode )
     712                 :            :         {
     713 [ #  # ][ #  # ]:          0 :             E3dScene* pScene = SelectionHelper::getSceneToRotate( pDrawViewWrapper->getNamedSdrObject( m_aSelection.getSelectedCID() ) );
                 [ #  # ]
     714         [ #  # ]:          0 :             if( pScene )
     715                 :            :             {
     716                 :          0 :                 DragMethod_RotateDiagram::RotationDirection eRotationDirection(DragMethod_RotateDiagram::ROTATIONDIRECTION_FREE);
     717         [ #  # ]:          0 :                 if(pHitSelectionHdl)
     718                 :            :                 {
     719                 :          0 :                     SdrHdlKind eKind = pHitSelectionHdl->GetKind();
     720 [ #  # ][ #  # ]:          0 :                     if( eKind==HDL_UPPER || eKind==HDL_LOWER )
     721                 :          0 :                         eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_X;
     722 [ #  # ][ #  # ]:          0 :                     else if( eKind==HDL_LEFT || eKind==HDL_RIGHT )
     723                 :          0 :                         eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Y;
     724 [ #  # ][ #  # ]:          0 :                     else if( eKind==HDL_UPLFT || eKind==HDL_UPRGT || eKind==HDL_LWLFT || eKind==HDL_LWRGT )
         [ #  # ][ #  # ]
     725                 :          0 :                         eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Z;
     726                 :            :                 }
     727 [ #  # ][ #  # ]:          0 :                 pDragMethod = new DragMethod_RotateDiagram( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel(), eRotationDirection );
         [ #  # ][ #  # ]
     728                 :            :             }
     729                 :            :         }
     730                 :            :         else
     731                 :            :         {
     732 [ #  # ][ #  # ]:          0 :             rtl::OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
     733 [ #  # ][ #  # ]:          0 :             if( aDragMethodServiceName.equals( ObjectIdentifier::getPieSegmentDragMethodServiceName() ) )
     734 [ #  # ][ #  # ]:          0 :                 pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel() );
         [ #  # ][ #  # ]
     735                 :            :         }
     736         [ #  # ]:          0 :         pDrawViewWrapper->SdrView::BegDragObj(aMPos, NULL, pHitSelectionHdl, nDrgLog, pDragMethod);
     737                 :            :     }
     738                 :            : 
     739 [ #  # ][ #  # ]:          0 :     impl_SetMousePointer( rMEvt );
                 [ #  # ]
     740                 :            : }
     741                 :            : 
     742                 :          0 : void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
     743                 :            : {
     744         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     745                 :            : 
     746                 :          0 :     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
     747 [ #  # ][ #  # ]:          0 :     if(!m_pChartWindow || !pDrawViewWrapper)
     748                 :            :         return;
     749                 :            : 
     750 [ #  # ][ #  # ]:          0 :     if( m_pDrawViewWrapper->IsTextEdit() )
     751                 :            :     {
     752 [ #  # ][ #  # ]:          0 :         if( m_pDrawViewWrapper->MouseMove(rMEvt,m_pChartWindow) )
     753                 :            :             return;
     754                 :            :     }
     755                 :            : 
     756 [ #  # ][ #  # ]:          0 :     if(pDrawViewWrapper->IsAction())
     757                 :            :     {
     758 [ #  # ][ #  # ]:          0 :         pDrawViewWrapper->MovAction( m_pChartWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     759                 :            :     }
     760                 :            : 
     761 [ #  # ][ #  # ]:          0 :     impl_SetMousePointer( rMEvt );
                 [ #  # ]
     762                 :            : }
     763                 :          0 : void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
     764                 :            : {
     765                 :          0 : }
     766                 :            : 
     767                 :            : //-----------------
     768                 :            : 
     769                 :          0 : void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
     770                 :            : {
     771 [ #  # ][ #  # ]:          0 :     ControllerLockGuard aCLGuard( getModel() );
     772                 :          0 :     bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
     773                 :          0 :     m_bWaitingForMouseUp = false;
     774                 :          0 :     bool bNotifySelectionChange = false;
     775                 :            :     {
     776         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     777                 :            : 
     778                 :          0 :         DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
     779 [ #  # ][ #  # ]:          0 :         if(!m_pChartWindow || !pDrawViewWrapper)
     780                 :            :             return;
     781                 :            : 
     782         [ #  # ]:          0 :         Point   aMPos   = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel());
     783                 :            : 
     784 [ #  # ][ #  # ]:          0 :         if(pDrawViewWrapper->IsTextEdit())
     785                 :            :         {
     786 [ #  # ][ #  # ]:          0 :             if( pDrawViewWrapper->MouseButtonUp(rMEvt,m_pChartWindow) )
     787                 :            :                 return;
     788                 :            :         }
     789                 :            : 
     790                 :            :         // #i12587# support for shapes in chart
     791 [ #  # ][ #  # ]:          0 :         if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() )
                 [ #  # ]
     792                 :            :         {
     793         [ #  # ]:          0 :             pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND );
     794                 :            :             {
     795         [ #  # ]:          0 :                 HiddenUndoContext aUndoContext( m_xUndoManager );
     796                 :            :                     // don't want the positioning Undo action to appear in the UI
     797 [ #  # ][ #  # ]:          0 :                 impl_switchDiagramPositioningToExcludingPositioning();
     798                 :            :             }
     799         [ #  # ]:          0 :             if ( pDrawViewWrapper->AreObjectsMarked() )
     800                 :            :             {
     801         [ #  # ]:          0 :                 if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT )
     802                 :            :                 {
     803         [ #  # ]:          0 :                     executeDispatch_EditText();
     804                 :            :                 }
     805                 :            :                 else
     806                 :            :                 {
     807         [ #  # ]:          0 :                     SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
     808         [ #  # ]:          0 :                     if ( pObj )
     809                 :            :                     {
     810 [ #  # ][ #  # ]:          0 :                         uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
     811         [ #  # ]:          0 :                         if ( xShape.is() )
     812                 :            :                         {
     813         [ #  # ]:          0 :                             m_aSelection.setSelection( xShape );
     814         [ #  # ]:          0 :                             m_aSelection.applySelection( pDrawViewWrapper );
     815                 :          0 :                         }
     816                 :            :                     }
     817                 :            :                 }
     818                 :            :             }
     819                 :            :             else
     820                 :            :             {
     821         [ #  # ]:          0 :                 m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick );
     822         [ #  # ]:          0 :                 m_aSelection.applySelection( pDrawViewWrapper );
     823                 :          0 :                 setDrawMode( CHARTDRAW_SELECT );
     824                 :            :             }
     825                 :            :         }
     826         [ #  # ]:          0 :         else if ( pDrawViewWrapper->IsDragObj() )
     827                 :            :         {
     828                 :          0 :             bool bDraggingDone = false;
     829                 :          0 :             SdrDragMethod* pDragMethod = pDrawViewWrapper->SdrView::GetDragMethod();
     830         [ #  # ]:          0 :             bool bIsMoveOnly = pDragMethod ? pDragMethod->getMoveOnly() : false;
     831         [ #  # ]:          0 :             DragMethod_Base* pChartDragMethod = dynamic_cast< DragMethod_Base* >(pDragMethod);
     832         [ #  # ]:          0 :             if( pChartDragMethod )
     833                 :            :             {
     834                 :          0 :                 UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(),
     835 [ #  # ][ #  # ]:          0 :                         m_xUndoManager );
     836                 :            : 
     837 [ #  # ][ #  # ]:          0 :                 if( pDrawViewWrapper->EndDragObj(false) )
     838                 :            :                 {
     839                 :          0 :                     bDraggingDone = true;
     840         [ #  # ]:          0 :                     aUndoGuard.commit();
     841         [ #  # ]:          0 :                 }
     842                 :            :             }
     843                 :            : 
     844 [ #  # ][ #  # ]:          0 :             if( !bDraggingDone && pDrawViewWrapper->EndDragObj(false) )
         [ #  # ][ #  # ]
     845                 :            :             {
     846                 :            :                 try
     847                 :            :                 {
     848                 :            :                     //end move or size
     849         [ #  # ]:          0 :                     SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
     850         [ #  # ]:          0 :                     if( pObj )
     851                 :            :                     {
     852         [ #  # ]:          0 :                         Rectangle aObjectRect = pObj->GetSnapRect();
     853 [ #  # ][ #  # ]:          0 :                         awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
     854         [ #  # ]:          0 :                         Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
     855                 :            : 
     856         [ #  # ]:          0 :                         const E3dObject* pE3dObject = dynamic_cast< const E3dObject*>( pObj );
     857         [ #  # ]:          0 :                         if( pE3dObject )
     858 [ #  # ][ #  # ]:          0 :                             aObjectRect = pE3dObject->GetScene()->GetSnapRect();
     859                 :            : 
     860                 :          0 :                         ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
     861 [ #  # ][ #  # ]:          0 :                         if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() )
         [ #  # ][ #  # ]
     862                 :          0 :                             eActionType = ActionDescriptionProvider::RESIZE;
     863                 :            : 
     864 [ #  # ][ #  # ]:          0 :                         ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
     865                 :            : 
     866                 :            :                         UndoGuard aUndoGuard(
     867                 :            :                             ActionDescriptionProvider::createDescription( eActionType, ObjectNameProvider::getName( eObjectType)),
     868 [ #  # ][ #  # ]:          0 :                             m_xUndoManager );
                 [ #  # ]
     869                 :            : 
     870                 :          0 :                         bool bChanged = false;
     871         [ #  # ]:          0 :                         if ( eObjectType == OBJECTTYPE_LEGEND )
     872 [ #  # ][ #  # ]:          0 :                             bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true );
     873                 :            : 
     874                 :            :                         bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
     875                 :          0 :                                         , getModel()
     876                 :          0 :                                         , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
     877 [ #  # ][ #  # ]:          0 :                                         , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
                 [ #  # ]
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :                         if( bMoved || bChanged )
     880                 :            :                         {
     881                 :          0 :                             bDraggingDone = true;
     882         [ #  # ]:          0 :                             aUndoGuard.commit();
     883 [ #  # ][ #  # ]:          0 :                         }
     884                 :            :                     }
     885                 :            :                 }
     886         [ #  # ]:          0 :                 catch( const uno::Exception & ex )
     887                 :            :                 {
     888                 :            :                     ASSERT_EXCEPTION( ex );
     889                 :            :                 }
     890                 :            :                 //all wanted model changes will take effect
     891                 :            :                 //and all unwanted view modifications are cleaned
     892                 :            :             }
     893                 :            : 
     894         [ #  # ]:          0 :             if( !bDraggingDone ) //mouse wasn't moved while dragging
     895                 :            :             {
     896 [ #  # ][ #  # ]:          0 :                 bool bClickedTwiceOnDragableObject = SelectionHelper::isDragableObjectHitTwice( aMPos, m_aSelection.getSelectedCID(), *pDrawViewWrapper );
     897 [ #  # ][ #  # ]:          0 :                 bool bIsRotateable = m_aSelection.isRotateableObjectSelected( getModel() );
     898                 :            : 
     899                 :            :                 //toggel between move and rotate
     900 [ #  # ][ #  # ]:          0 :                 if( bIsRotateable && bClickedTwiceOnDragableObject && SDRDRAG_MOVE==m_eDragMode )
                 [ #  # ]
     901                 :          0 :                     m_eDragMode=SDRDRAG_ROTATE;
     902                 :            :                 else
     903                 :          0 :                     m_eDragMode=SDRDRAG_MOVE;
     904                 :            : 
     905         [ #  # ]:          0 :                 pDrawViewWrapper->SetDragMode(m_eDragMode);
     906                 :            : 
     907 [ #  # ][ #  # ]:          0 :                 if( !m_bWaitingForDoubleClick && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
         [ #  # ][ #  # ]
     908                 :            :                 {
     909         [ #  # ]:          0 :                     this->impl_selectObjectAndNotiy();
     910                 :            :                 }
     911                 :            :             }
     912                 :            :             else
     913         [ #  # ]:          0 :                 m_aSelection.resetPossibleSelectionAfterSingleClickWasEnsured();
     914                 :            :         }
     915 [ #  # ][ #  # ]:          0 :         else if( isDoubleClick(rMEvt) && !bMouseUpWithoutMouseDown /*#i106966#*/ )
                 [ #  # ]
     916                 :            :         {
     917                 :          0 :             Point aMousePixel = rMEvt.GetPosPixel();
     918         [ #  # ]:          0 :             execute_DoubleClick( &aMousePixel );
     919                 :            :         }
     920                 :            : 
     921                 :            :         //@todo ForcePointer(&rMEvt);
     922         [ #  # ]:          0 :         m_pChartWindow->ReleaseMouse();
     923                 :            : 
     924 [ #  # ][ #  # ]:          0 :         if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
     925 [ #  # ][ #  # ]:          0 :             bNotifySelectionChange = true;
     926                 :            :     }
     927                 :            : 
     928         [ #  # ]:          0 :     impl_SetMousePointer( rMEvt );
     929                 :            : 
     930         [ #  # ]:          0 :     if(bNotifySelectionChange)
     931 [ #  # ][ #  # ]:          0 :         impl_notifySelectionChangeListeners();
                 [ #  # ]
     932                 :            : }
     933                 :            : 
     934                 :          0 : void ChartController::execute_DoubleClick( const Point* pMousePixel )
     935                 :            : {
     936                 :          0 :     bool bEditText = false;
     937         [ #  # ]:          0 :     if ( m_aSelection.hasSelection() )
     938                 :            :     {
     939         [ #  # ]:          0 :         ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
     940         [ #  # ]:          0 :         if ( !aCID.isEmpty() )
     941                 :            :         {
     942         [ #  # ]:          0 :             ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
     943         [ #  # ]:          0 :             if ( OBJECTTYPE_TITLE == eObjectType )
     944                 :            :             {
     945                 :          0 :                 bEditText = true;
     946                 :            :             }
     947                 :            :         }
     948                 :            :         else
     949                 :            :         {
     950                 :            :             // #i12587# support for shapes in chart
     951 [ #  # ][ #  # ]:          0 :             SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
     952 [ #  # ][ #  # ]:          0 :             if ( pObj && pObj->ISA( SdrTextObj ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     953                 :            :             {
     954                 :          0 :                 bEditText = true;
     955                 :            :             }
     956                 :          0 :         }
     957                 :            :     }
     958                 :            : 
     959         [ #  # ]:          0 :     if ( bEditText )
     960                 :            :     {
     961                 :          0 :         executeDispatch_EditText( pMousePixel );
     962                 :            :     }
     963                 :            :     else
     964                 :            :     {
     965                 :          0 :         executeDispatch_ObjectProperties();
     966                 :            :     }
     967                 :          0 : }
     968                 :            : 
     969                 :         68 : void ChartController::execute_Resize()
     970                 :            : {
     971         [ +  - ]:         68 :     SolarMutexGuard aGuard;
     972         [ +  - ]:         68 :     if(m_pChartWindow)
     973 [ +  - ][ +  - ]:         68 :         m_pChartWindow->Invalidate();
     974                 :         68 : }
     975                 :          0 : void ChartController::execute_Activate()
     976                 :            : {
     977                 :            :     ///// pDrawViewWrapper->SetEditMode(sal_True);
     978                 :          0 : }
     979                 :          0 : void ChartController::execute_Deactivate()
     980                 :            : {
     981                 :            :     /*
     982                 :            :     pDrawViewWrapper->SetEditMode(sal_False);
     983                 :            :     this->ReleaseMouse();
     984                 :            :     */
     985                 :          0 : }
     986                 :         34 : void ChartController::execute_GetFocus()
     987                 :            : {
     988                 :         34 : }
     989                 :          4 : void ChartController::execute_LoseFocus()
     990                 :            : {
     991                 :            :     //this->ReleaseMouse();
     992                 :          4 : }
     993                 :            : 
     994                 :          0 : void ChartController::execute_Command( const CommandEvent& rCEvt )
     995                 :            : {
     996                 :          0 :     bool bIsAction = false;
     997                 :            :     {
     998         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     999                 :          0 :         DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
    1000 [ #  # ][ #  # ]:          0 :         if(!m_pChartWindow || !pDrawViewWrapper)
    1001                 :          0 :             return;
    1002 [ #  # ][ #  # ]:          0 :         bIsAction = m_pDrawViewWrapper->IsAction();
                 [ #  # ]
    1003                 :            :     }
    1004                 :            : 
    1005                 :            :     // pop-up menu
    1006 [ #  # ][ #  # ]:          0 :     if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
                 [ #  # ]
    1007                 :            :     {
    1008                 :            :         {
    1009         [ #  # ]:          0 :             SolarMutexGuard aGuard;
    1010         [ #  # ]:          0 :             if(m_pChartWindow)
    1011 [ #  # ][ #  # ]:          0 :                 m_pChartWindow->ReleaseMouse();
    1012                 :            :         }
    1013                 :            : 
    1014         [ #  # ]:          0 :         if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
    1015                 :          0 :             impl_notifySelectionChangeListeners();
    1016                 :            : 
    1017         [ #  # ]:          0 :         if ( isShapeContext() )
    1018                 :            :         {
    1019                 :            :             // #i12587# support for shapes in chart
    1020         [ #  # ]:          0 :             PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ?
    1021 [ #  # ][ #  # ]:          0 :                 RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) );
                 [ #  # ]
    1022         [ #  # ]:          0 :             ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
    1023                 :          0 :             Point aPos( rCEvt.GetMousePosPixel() );
    1024         [ #  # ]:          0 :             if( !rCEvt.IsMouseEvent() )
    1025                 :            :             {
    1026         [ #  # ]:          0 :                 SolarMutexGuard aGuard;
    1027         [ #  # ]:          0 :                 if(m_pChartWindow)
    1028 [ #  # ][ #  # ]:          0 :                     aPos = m_pChartWindow->GetPointerState().maPos;
    1029                 :            :             }
    1030 [ #  # ][ #  # ]:          0 :             aContextMenuHelper.completeAndExecute( aPos, aContextMenu );
                 [ #  # ]
    1031                 :            :         }
    1032                 :            :         else
    1033                 :            :         {
    1034                 :            :             // todo: the context menu should be specified by an xml file in uiconfig
    1035                 :            :             uno::Reference< awt::XPopupMenu > xPopupMenu(
    1036 [ #  # ][ #  # ]:          0 :                 m_xCC->getServiceManager()->createInstanceWithContext(
                 [ #  # ]
    1037 [ #  # ][ #  # ]:          0 :                     C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
                 [ #  # ]
    1038         [ #  # ]:          0 :             uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY );
    1039 [ #  # ][ #  # ]:          0 :             if( xPopupMenu.is() && xMenuEx.is())
                 [ #  # ]
    1040                 :            :             {
    1041                 :          0 :                 sal_Int16 nUniqueId = 1;
    1042 [ #  # ][ #  # ]:          0 :                 ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
    1043 [ #  # ][ #  # ]:          0 :                 Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( getModel() );
    1044                 :            : 
    1045 [ #  # ][ #  # ]:          0 :                 OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
    1046         [ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand );
    1047                 :            : 
    1048                 :            :                 //some commands for dataseries and points:
    1049                 :            :                 //-----
    1050 [ #  # ][ #  # ]:          0 :                 if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType )
    1051                 :            :                 {
    1052                 :          0 :                     bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType );
    1053 [ #  # ][ #  # ]:          0 :                     uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
    1054         [ #  # ]:          0 :                     uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
    1055         [ #  # ]:          0 :                     Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) );
    1056         [ #  # ]:          0 :                     bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
    1057         [ #  # ]:          0 :                     Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) );
    1058         [ #  # ]:          0 :                     bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true );
    1059         [ #  # ]:          0 :                     bool bHasXErrorBars = StatisticsHelper::hasErrorBars( xSeries, false );
    1060         [ #  # ]:          0 :                     bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
    1061         [ #  # ]:          0 :                     bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
    1062                 :          0 :                     bool bHasDataLabelAtPoint = false;
    1063                 :          0 :                     sal_Int32 nPointIndex = -1;
    1064         [ #  # ]:          0 :                     if( bIsPoint )
    1065                 :            :                     {
    1066 [ #  # ][ #  # ]:          0 :                         nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
    1067         [ #  # ]:          0 :                         bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
    1068                 :            :                     }
    1069                 :          0 :                     bool bSelectedPointIsFormatted = false;
    1070                 :          0 :                     bool bHasFormattedDataPointsOtherThanSelected = false;
    1071                 :            : 
    1072         [ #  # ]:          0 :                     Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
    1073         [ #  # ]:          0 :                     if( xSeriesProperties.is() )
    1074                 :            :                     {
    1075         [ #  # ]:          0 :                         uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
    1076 [ #  # ][ #  # ]:          0 :                         if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
         [ #  # ][ #  # ]
                 [ #  # ]
    1077                 :            :                         {
    1078         [ #  # ]:          0 :                             if( aAttributedDataPointIndexList.hasElements() )
    1079                 :            :                             {
    1080         [ #  # ]:          0 :                                 if( bIsPoint )
    1081                 :            :                                 {
    1082         [ #  # ]:          0 :                                     ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
    1083         [ #  # ]:          0 :                                     ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
    1084 [ #  # ][ #  # ]:          0 :                                     if( aIt != aIndices.end())
    1085                 :          0 :                                         bSelectedPointIsFormatted = true;
    1086                 :            :                                     else
    1087                 :          0 :                                         bHasFormattedDataPointsOtherThanSelected = true;
    1088                 :            :                                 }
    1089                 :            :                                 else
    1090                 :          0 :                                     bHasFormattedDataPointsOtherThanSelected = true;
    1091                 :            :                             }
    1092         [ #  # ]:          0 :                         }
    1093                 :            :                     }
    1094                 :            : 
    1095         [ #  # ]:          0 :                     if( bIsPoint )
    1096                 :            :                     {
    1097         [ #  # ]:          0 :                         if( bHasDataLabelAtPoint )
    1098 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") );
    1099         [ #  # ]:          0 :                         if( !bHasDataLabelAtPoint )
    1100 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") );
    1101                 :            :                         else
    1102 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") );
    1103         [ #  # ]:          0 :                         if( bSelectedPointIsFormatted )
    1104 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint"));
    1105                 :            : 
    1106 [ #  # ][ #  # ]:          0 :                         xPopupMenu->insertSeparator( -1 );
    1107                 :            : 
    1108 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") );
    1109                 :            :                     }
    1110                 :            : 
    1111         [ #  # ]:          0 :                     Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
    1112 [ #  # ][ #  # ]:          0 :                     if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
         [ #  # ][ #  # ]
    1113                 :            :                     {
    1114                 :            :                         try
    1115                 :            :                         {
    1116         [ #  # ]:          0 :                             Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
    1117         [ #  # ]:          0 :                             if( xChartTypeProp.is() )
    1118                 :            :                             {
    1119                 :          0 :                                 bool bJapaneseStyle = false;
    1120 [ #  # ][ #  # ]:          0 :                                 xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle;
                 [ #  # ]
    1121                 :            : 
    1122         [ #  # ]:          0 :                                 if( bJapaneseStyle )
    1123                 :            :                                 {
    1124 [ #  # ][ #  # ]:          0 :                                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
    1125 [ #  # ][ #  # ]:          0 :                                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
    1126                 :            :                                 }
    1127         [ #  # ]:          0 :                             }
    1128                 :            :                         }
    1129         [ #  # ]:          0 :                         catch( const uno::Exception & ex )
    1130                 :            :                         {
    1131                 :            :                             ASSERT_EXCEPTION( ex );
    1132                 :            :                         }
    1133                 :            :                     }
    1134                 :            : 
    1135         [ #  # ]:          0 :                     if( bHasDataLabelsAtSeries )
    1136 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") );
    1137         [ #  # ]:          0 :                     if( xTrendline.is() )
    1138 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") );
    1139         [ #  # ]:          0 :                     if( bHasEquation )
    1140 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
    1141         [ #  # ]:          0 :                     if( xMeanValue.is() )
    1142 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") );
    1143         [ #  # ]:          0 :                     if( bHasXErrorBars )
    1144 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatXErrorBars") );
    1145         [ #  # ]:          0 :                     if( bHasYErrorBars )
    1146 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") );
    1147                 :            : 
    1148 [ #  # ][ #  # ]:          0 :                     xPopupMenu->insertSeparator( -1 );
    1149                 :            : 
    1150         [ #  # ]:          0 :                     if( !bHasDataLabelsAtSeries )
    1151 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") );
    1152         [ #  # ]:          0 :                     if( !xTrendline.is() )
    1153 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") );
    1154         [ #  # ]:          0 :                     else if( !bHasEquation )
    1155 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
    1156         [ #  # ]:          0 :                     if( !xMeanValue.is() )
    1157 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") );
    1158         [ #  # ]:          0 :                     if( !bHasXErrorBars )
    1159 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertXErrorBars"));
    1160         [ #  # ]:          0 :                     if( !bHasYErrorBars )
    1161 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") );
    1162                 :            : 
    1163                 :            : 
    1164 [ #  # ][ #  # ]:          0 :                     if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
                 [ #  # ]
    1165 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") );
    1166         [ #  # ]:          0 :                     if( xTrendline.is() )
    1167 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") );
    1168         [ #  # ]:          0 :                     if( bHasEquation )
    1169 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
    1170         [ #  # ]:          0 :                     if( xMeanValue.is() )
    1171 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") );
    1172         [ #  # ]:          0 :                     if( bHasXErrorBars )
    1173 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteXErrorBars"));
    1174         [ #  # ]:          0 :                     if( bHasYErrorBars )
    1175 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") );
    1176                 :            : 
    1177         [ #  # ]:          0 :                     if( bHasFormattedDataPointsOtherThanSelected )
    1178 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints"));
    1179                 :            : 
    1180 [ #  # ][ #  # ]:          0 :                     xPopupMenu->insertSeparator( -1 );
    1181                 :            : 
    1182 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow"));
    1183                 :            :                     uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
    1184 [ #  # ][ #  # ]:          0 :                         m_xCC->getServiceManager()->createInstanceWithContext(
                 [ #  # ]
    1185 [ #  # ][ #  # ]:          0 :                             C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
                 [ #  # ]
    1186         [ #  # ]:          0 :                     uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY );
    1187 [ #  # ][ #  # ]:          0 :                     if( xArrangePopupMenu.is() && xArrangeMenuEx.is())
                 [ #  # ]
    1188                 :            :                     {
    1189                 :          0 :                         sal_Int16 nSubId = nUniqueId + 1;
    1190 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") );
    1191 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") );
    1192 [ #  # ][ #  # ]:          0 :                         xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
    1193                 :          0 :                         nUniqueId = nSubId;
    1194                 :            :                     }
    1195                 :          0 :                     ++nUniqueId;
    1196                 :            :                 }
    1197         [ #  # ]:          0 :                 else if( OBJECTTYPE_DATA_CURVE == eObjectType )
    1198                 :            :                 {
    1199 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
    1200 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
    1201 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") );
    1202 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
    1203 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
    1204 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
    1205                 :            :                 }
    1206         [ #  # ]:          0 :                 else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType )
    1207                 :            :                 {
    1208 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
    1209 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
    1210                 :            :                 }
    1211                 :            : 
    1212                 :            :                 //some commands for axes: and grids
    1213                 :            :                 //-----
    1214 [ #  # ][ #  # ]:          0 :                 else if( OBJECTTYPE_AXIS  == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType )
                 [ #  # ]
    1215                 :            :                 {
    1216 [ #  # ][ #  # ]:          0 :                     Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
                 [ #  # ]
    1217 [ #  # ][ #  # ]:          0 :                     if( xAxis.is() && xDiagram.is() )
                 [ #  # ]
    1218                 :            :                     {
    1219                 :          0 :                         sal_Int32 nDimensionIndex = -1;
    1220                 :          0 :                         sal_Int32 nCooSysIndex = -1;
    1221                 :          0 :                         sal_Int32 nAxisIndex = -1;
    1222         [ #  # ]:          0 :                         AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
    1223                 :          0 :                         bool bIsSecondaryAxis = nAxisIndex!=0;
    1224         [ #  # ]:          0 :                         bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
    1225         [ #  # ]:          0 :                         bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
    1226         [ #  # ]:          0 :                         bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
    1227                 :          0 :                         bool bHasTitle = false;
    1228         [ #  # ]:          0 :                         uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
    1229         [ #  # ]:          0 :                         if( xTitled.is())
    1230 [ #  # ][ #  # ]:          0 :                             bHasTitle = !TitleHelper::getCompleteString( xTitled->getTitleObject() ).isEmpty();
                 [ #  # ]
    1231                 :            : 
    1232 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_AXIS  != eObjectType && bIsAxisVisible )
    1233 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") );
    1234 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis )
                 [ #  # ]
    1235 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") );
    1236 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis )
                 [ #  # ]
    1237 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") );
    1238                 :            : 
    1239 [ #  # ][ #  # ]:          0 :                         xPopupMenu->insertSeparator( -1 );
    1240                 :            : 
    1241 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_AXIS  != eObjectType && !bIsAxisVisible )
    1242 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") );
    1243 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis )
                 [ #  # ]
    1244 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") );
    1245 [ #  # ][ #  # ]:          0 :                         if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis )
                 [ #  # ]
    1246 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") );
    1247         [ #  # ]:          0 :                         if( !bHasTitle )
    1248 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") );
    1249                 :            : 
    1250         [ #  # ]:          0 :                         if( bIsAxisVisible )
    1251 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") );
    1252 [ #  # ][ #  # ]:          0 :                         if( bIsMajorGridVisible && !bIsSecondaryAxis )
    1253 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") );
    1254 [ #  # ][ #  # ]:          0 :                         if( bIsMinorGridVisible && !bIsSecondaryAxis )
    1255 [ #  # ][ #  # ]:          0 :                             lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") );
    1256                 :          0 :                     }
    1257                 :            :                 }
    1258                 :            : 
    1259         [ #  # ]:          0 :                 if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType )
    1260 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
    1261         [ #  # ]:          0 :                 else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType )
    1262 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
    1263                 :            : 
    1264 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog"));
    1265                 :            : 
    1266 [ #  # ][ #  # ]:          0 :                 if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType
         [ #  # ][ #  # ]
                 [ #  # ]
    1267                 :            :                     || OBJECTTYPE_DIAGRAM_WALL == eObjectType
    1268                 :            :                     || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType
    1269                 :            :                     || OBJECTTYPE_UNKNOWN == eObjectType )
    1270                 :            :                 {
    1271         [ #  # ]:          0 :                     if( OBJECTTYPE_UNKNOWN != eObjectType )
    1272 [ #  # ][ #  # ]:          0 :                         xPopupMenu->insertSeparator( -1 );
    1273         [ #  # ]:          0 :                     bool bHasLegend = LegendHelper::hasLegend( xDiagram );
    1274 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") );
    1275         [ #  # ]:          0 :                     if( !bHasLegend )
    1276 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") );
    1277 [ #  # ][ #  # ]:          0 :                     lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") );
    1278         [ #  # ]:          0 :                     if( bHasLegend )
    1279 [ #  # ][ #  # ]:          0 :                         lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") );
    1280                 :            :                 }
    1281                 :            :                 //-----
    1282                 :            : 
    1283 [ #  # ][ #  # ]:          0 :                 xPopupMenu->insertSeparator( -1 );
    1284 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType"));
    1285 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges"));
    1286 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData"));
    1287 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D"));
    1288 [ #  # ][ #  # ]:          0 :                 xPopupMenu->insertSeparator( -1 );
    1289 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut"));
    1290 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy"));
    1291 [ #  # ][ #  # ]:          0 :                 lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste"));
    1292                 :            : 
    1293         [ #  # ]:          0 :                 ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
    1294                 :          0 :                 Point aPos( rCEvt.GetMousePosPixel() );
    1295         [ #  # ]:          0 :                 if( !rCEvt.IsMouseEvent() )
    1296                 :            :                 {
    1297         [ #  # ]:          0 :                     SolarMutexGuard aGuard;
    1298         [ #  # ]:          0 :                     if(m_pChartWindow)
    1299 [ #  # ][ #  # ]:          0 :                         aPos = m_pChartWindow->GetPointerState().maPos;
    1300                 :            :                 }
    1301 [ #  # ][ #  # ]:          0 :                 aContextMenuHelper.completeAndExecute( aPos, xPopupMenu );
    1302                 :          0 :             }
    1303                 :            :         }
    1304                 :            :     }
    1305   [ #  #  #  #  :          0 :     else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) ||
             #  #  #  # ]
                 [ #  # ]
    1306                 :          0 :              ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) ||
    1307                 :          0 :              ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) ||
    1308                 :          0 :              ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) )
    1309                 :            :     {
    1310                 :            :         //#i84417# enable editing with IME
    1311         [ #  # ]:          0 :         SolarMutexGuard aGuard;
    1312         [ #  # ]:          0 :         if( m_pDrawViewWrapper )
    1313 [ #  # ][ #  # ]:          0 :             m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
    1314                 :            :     }
    1315                 :            : }
    1316                 :            : 
    1317                 :          0 : bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
    1318                 :            : {
    1319                 :          0 :     bool bReturn=false;
    1320                 :            : 
    1321                 :          0 :     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
    1322 [ #  # ][ #  # ]:          0 :     if(!m_pChartWindow || !pDrawViewWrapper)
    1323                 :          0 :         return bReturn;
    1324                 :            : 
    1325                 :            :     // handle accelerators
    1326 [ #  # ][ #  # ]:          0 :     if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() && m_xCC->getServiceManager().is() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1327                 :            :     {
    1328         [ #  # ]:          0 :         m_apAccelExecute.reset( ::svt::AcceleratorExecute::createAcceleratorHelper());
    1329                 :            :         OSL_ASSERT( m_apAccelExecute.get());
    1330         [ #  # ]:          0 :         if( m_apAccelExecute.get() )
    1331                 :          0 :             m_apAccelExecute->init(
    1332 [ #  # ][ #  # ]:          0 :                 uno::Reference< lang::XMultiServiceFactory >( m_xCC->getServiceManager(), uno::UNO_QUERY ), m_xFrame );
         [ #  # ][ #  # ]
    1333                 :            :     }
    1334                 :            : 
    1335                 :          0 :     KeyCode aKeyCode( rKEvt.GetKeyCode());
    1336                 :          0 :     sal_uInt16 nCode = aKeyCode.GetCode();
    1337                 :          0 :     bool bAlternate = aKeyCode.IsMod2();
    1338                 :            : 
    1339         [ #  # ]:          0 :     if( m_apAccelExecute.get() )
    1340         [ #  # ]:          0 :         bReturn = m_apAccelExecute->execute( aKeyCode );
    1341         [ #  # ]:          0 :     if( bReturn )
    1342                 :          0 :         return bReturn;
    1343                 :            : 
    1344                 :            :     {
    1345         [ #  # ]:          0 :         SolarMutexGuard aGuard;
    1346 [ #  # ][ #  # ]:          0 :         if( pDrawViewWrapper->IsTextEdit() )
    1347                 :            :         {
    1348 [ #  # ][ #  # ]:          0 :             if( pDrawViewWrapper->KeyInput(rKEvt,m_pChartWindow) )
    1349                 :            :             {
    1350                 :          0 :                 bReturn = true;
    1351         [ #  # ]:          0 :                 if( nCode == KEY_ESCAPE )
    1352                 :            :                 {
    1353         [ #  # ]:          0 :                     this->EndTextEdit();
    1354                 :            :                 }
    1355                 :            :             }
    1356         [ #  # ]:          0 :         }
    1357                 :            :     }
    1358                 :            : 
    1359                 :            :     // keyboard accessibility
    1360 [ #  # ][ #  # ]:          0 :     ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
    1361         [ #  # ]:          0 :     if( ! bReturn )
    1362                 :            :     {
    1363                 :            :         // Natvigation (Tab/F3/Home/End)
    1364 [ #  # ][ #  # ]:          0 :         uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
    1365 [ #  # ][ #  # ]:          0 :         ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
         [ #  # ][ #  # ]
    1366         [ #  # ]:          0 :         awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode ));
    1367         [ #  # ]:          0 :         bReturn = aObjNav.handleKeyEvent( aKeyEvent );
    1368         [ #  # ]:          0 :         if( bReturn )
    1369                 :            :         {
    1370         [ #  # ]:          0 :             ObjectIdentifier aNewOID = aObjNav.getCurrentSelection();
    1371                 :          0 :             uno::Any aNewSelection;
    1372 [ #  # ][ #  # ]:          0 :             if ( aNewOID.isValid() && !ObjectHierarchy::isRootNode( aNewOID ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1373                 :            :             {
    1374         [ #  # ]:          0 :                 aNewSelection = aNewOID.getAny();
    1375                 :            :             }
    1376 [ #  # ][ #  # ]:          0 :             if ( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), getModel() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
    1377                 :            :             {
    1378                 :          0 :                 m_eDragMode = SDRDRAG_MOVE;
    1379                 :            :             }
    1380 [ #  # ][ #  # ]:          0 :             bReturn = select( aNewSelection );
    1381 [ #  # ][ #  # ]:          0 :         }
    1382                 :            :     }
    1383                 :            : 
    1384                 :            :     // Position and Size (+/-/arrow-keys) or pie segment dragging
    1385         [ #  # ]:          0 :     if( ! bReturn  )
    1386                 :            :     {
    1387                 :            :         // pie segment dragging
    1388                 :            :         // note: could also be done for data series
    1389   [ #  #  #  # ]:          0 :         if( eObjectType == OBJECTTYPE_DATA_POINT &&
                 [ #  # ]
    1390                 :            :             ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ).equals(
    1391 [ #  # ][ #  # ]:          0 :                 ObjectIdentifier::getPieSegmentDragMethodServiceName()))
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1392                 :            :         {
    1393                 :          0 :             bool bDrag = false;
    1394                 :          0 :             bool bDragInside = false;
    1395 [ #  # ][ #  # ]:          0 :             if( nCode == KEY_ADD ||
    1396                 :            :                 nCode == KEY_SUBTRACT )
    1397                 :            :             {
    1398                 :          0 :                 bDrag = true;
    1399                 :          0 :                 bDragInside = ( nCode == KEY_SUBTRACT );
    1400                 :            :             }
    1401 [ #  # ][ #  # ]:          0 :             else if(
         [ #  # ][ #  # ]
    1402                 :            :                 nCode == KEY_LEFT ||
    1403                 :            :                 nCode == KEY_RIGHT ||
    1404                 :            :                 nCode == KEY_UP ||
    1405                 :            :                 nCode == KEY_DOWN )
    1406                 :            :             {
    1407                 :          0 :                 bDrag = true;
    1408 [ #  # ][ #  # ]:          0 :                 rtl::OUString aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
    1409                 :          0 :                 sal_Int32 nOffsetPercentDummy( 0 );
    1410                 :          0 :                 awt::Point aMinimumPosition( 0, 0 );
    1411                 :          0 :                 awt::Point aMaximumPosition( 0, 0 );
    1412                 :            :                 ObjectIdentifier::parsePieSegmentDragParameterString(
    1413         [ #  # ]:          0 :                     aParameter, nOffsetPercentDummy, aMinimumPosition, aMaximumPosition );
    1414                 :          0 :                 aMaximumPosition.Y -= aMinimumPosition.Y;
    1415                 :          0 :                 aMaximumPosition.X -= aMinimumPosition.X;
    1416                 :            : 
    1417                 :            :                 bDragInside =
    1418                 :            :                     (nCode == KEY_RIGHT && (aMaximumPosition.X < 0)) ||
    1419                 :            :                     (nCode == KEY_LEFT  && (aMaximumPosition.X > 0)) ||
    1420                 :            :                     (nCode == KEY_DOWN  && (aMaximumPosition.Y < 0)) ||
    1421 [ #  # ][ #  # ]:          0 :                     (nCode == KEY_UP    && (aMaximumPosition.Y > 0));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1422                 :            :             }
    1423                 :            : 
    1424         [ #  # ]:          0 :             if( bDrag )
    1425                 :            :             {
    1426         [ #  # ]:          0 :                 double fAmount = bAlternate ? 0.01 : 0.05;
    1427         [ #  # ]:          0 :                 if( bDragInside )
    1428                 :          0 :                     fAmount *= -1.0;
    1429                 :            : 
    1430 [ #  # ][ #  # ]:          0 :                 bReturn = impl_DragDataPoint( m_aSelection.getSelectedCID(), fAmount );
    1431                 :            :             }
    1432                 :            :         }
    1433                 :            :         else
    1434                 :            :         {
    1435                 :            :             // size
    1436 [ #  # ][ #  # ]:          0 :             if( nCode == KEY_ADD ||
    1437                 :            :                 nCode == KEY_SUBTRACT )
    1438                 :            :             {
    1439         [ #  # ]:          0 :                 if( eObjectType == OBJECTTYPE_DIAGRAM )
    1440                 :            :                 {
    1441                 :            :                     // default 1 mm in each direction
    1442                 :          0 :                     double fGrowAmountX = 200.0;
    1443                 :          0 :                     double fGrowAmountY = 200.0;
    1444 [ #  # ][ #  # ]:          0 :                     if( bAlternate && m_pChartWindow )
    1445                 :            :                     {
    1446                 :            :                         // together with Alt-key: 1 px in each direction
    1447         [ #  # ]:          0 :                         SolarMutexGuard aGuard;
    1448         [ #  # ]:          0 :                         if( m_pChartWindow )
    1449                 :            :                         {
    1450         [ #  # ]:          0 :                             Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 2, 2 ));
    1451                 :          0 :                             fGrowAmountX = static_cast< double >( aPixelSize.Width());
    1452                 :          0 :                             fGrowAmountY = static_cast< double >( aPixelSize.Height());
    1453         [ #  # ]:          0 :                         }
    1454                 :            :                     }
    1455         [ #  # ]:          0 :                     if( nCode == KEY_SUBTRACT )
    1456                 :            :                     {
    1457                 :          0 :                         fGrowAmountX = -fGrowAmountX;
    1458                 :          0 :                         fGrowAmountY = -fGrowAmountY;
    1459                 :            :                     }
    1460                 :            :                     bReturn = impl_moveOrResizeObject(
    1461 [ #  # ][ #  # ]:          0 :                         m_aSelection.getSelectedCID(), CENTERED_RESIZE_OBJECT, fGrowAmountX, fGrowAmountY );
    1462                 :          0 :                 }
    1463                 :            :             }
    1464                 :            :             // position
    1465 [ #  # ][ #  # ]:          0 :             else if( nCode == KEY_LEFT  ||
         [ #  # ][ #  # ]
    1466                 :            :                      nCode == KEY_RIGHT ||
    1467                 :            :                      nCode == KEY_UP ||
    1468                 :            :                      nCode == KEY_DOWN )
    1469                 :            :             {
    1470 [ #  # ][ #  # ]:          0 :                 if( m_aSelection.isDragableObjectSelected() )
    1471                 :            :                 {
    1472                 :            :                     // default 1 mm
    1473                 :          0 :                     double fShiftAmountX = 100.0;
    1474                 :          0 :                     double fShiftAmountY = 100.0;
    1475 [ #  # ][ #  # ]:          0 :                     if( bAlternate && m_pChartWindow )
    1476                 :            :                     {
    1477                 :            :                         // together with Alt-key: 1 px
    1478         [ #  # ]:          0 :                         SolarMutexGuard aGuard;
    1479         [ #  # ]:          0 :                         if(m_pChartWindow)
    1480                 :            :                         {
    1481         [ #  # ]:          0 :                             Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 1, 1 ));
    1482                 :          0 :                             fShiftAmountX = static_cast< double >( aPixelSize.Width());
    1483                 :          0 :                             fShiftAmountY = static_cast< double >( aPixelSize.Height());
    1484         [ #  # ]:          0 :                         }
    1485                 :            :                     }
    1486   [ #  #  #  #  :          0 :                     switch( nCode )
                      # ]
    1487                 :            :                     {
    1488                 :            :                         case KEY_LEFT:
    1489                 :          0 :                             fShiftAmountX = -fShiftAmountX;
    1490                 :          0 :                             fShiftAmountY = 0.0;
    1491                 :          0 :                             break;
    1492                 :            :                         case KEY_RIGHT:
    1493                 :          0 :                             fShiftAmountY = 0.0;
    1494                 :          0 :                             break;
    1495                 :            :                         case KEY_UP:
    1496                 :          0 :                             fShiftAmountX = 0.0;
    1497                 :          0 :                             fShiftAmountY = -fShiftAmountY;
    1498                 :          0 :                             break;
    1499                 :            :                         case KEY_DOWN:
    1500                 :          0 :                             fShiftAmountX = 0.0;
    1501                 :          0 :                             break;
    1502                 :            :                     }
    1503 [ #  # ][ #  # ]:          0 :                     if( !m_aSelection.getSelectedCID().isEmpty() )
    1504                 :            :                     {
    1505                 :            :                         //move chart objects
    1506                 :            :                         bReturn = impl_moveOrResizeObject(
    1507 [ #  # ][ #  # ]:          0 :                             m_aSelection.getSelectedCID(), MOVE_OBJECT, fShiftAmountX, fShiftAmountY );
    1508                 :            :                     }
    1509                 :            :                     else
    1510                 :            :                     {
    1511                 :            :                         //move additional shapes
    1512         [ #  # ]:          0 :                         uno::Reference< drawing::XShape > xShape( m_aSelection.getSelectedAdditionalShape() );
    1513         [ #  # ]:          0 :                         if( xShape.is() )
    1514                 :            :                         {
    1515 [ #  # ][ #  # ]:          0 :                             awt::Point aPos( xShape->getPosition() );
    1516 [ #  # ][ #  # ]:          0 :                             awt::Size aSize( xShape->getSize() );
    1517 [ #  # ][ #  # ]:          0 :                             awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
    1518                 :          0 :                             aPos.X = static_cast< long >( static_cast< double >( aPos.X ) + fShiftAmountX );
    1519                 :          0 :                             aPos.Y = static_cast< long >( static_cast< double >( aPos.Y ) + fShiftAmountY );
    1520         [ #  # ]:          0 :                             if( aPos.X + aSize.Width > aPageSize.Width )
    1521                 :          0 :                                 aPos.X = aPageSize.Width - aSize.Width;
    1522         [ #  # ]:          0 :                             if( aPos.X < 0 )
    1523                 :          0 :                                 aPos.X = 0;
    1524         [ #  # ]:          0 :                             if( aPos.Y + aSize.Height > aPageSize.Height )
    1525                 :          0 :                                 aPos.Y = aPageSize.Height - aSize.Height;
    1526         [ #  # ]:          0 :                             if( aPos.Y < 0 )
    1527                 :          0 :                                 aPos.Y = 0;
    1528                 :            : 
    1529 [ #  # ][ #  # ]:          0 :                             xShape->setPosition( aPos );
    1530                 :          0 :                         }
    1531                 :            :                     }
    1532                 :            :                 }
    1533                 :            :             }
    1534                 :            :         }
    1535                 :            :     }
    1536                 :            : 
    1537                 :            :     // text edit
    1538 [ #  # ][ #  # ]:          0 :     if( ! bReturn &&
    1539                 :            :         nCode == KEY_F2 )
    1540                 :            :     {
    1541         [ #  # ]:          0 :         if( OBJECTTYPE_TITLE == eObjectType )
    1542                 :            :         {
    1543         [ #  # ]:          0 :             executeDispatch_EditText();
    1544                 :          0 :             bReturn = true;
    1545                 :            :         }
    1546                 :            :     }
    1547                 :            : 
    1548                 :            :     // deactivate inplace mode (this code should be unnecessary, but
    1549                 :            :     // unfortunately is not)
    1550 [ #  # ][ #  # ]:          0 :     if( ! bReturn &&
    1551                 :            :         nCode == KEY_ESCAPE )
    1552                 :            :     {
    1553                 :            :         uno::Reference< frame::XDispatchHelper > xDispatchHelper(
    1554 [ #  # ][ #  # ]:          0 :             m_xCC->getServiceManager()->createInstanceWithContext(
                 [ #  # ]
    1555 [ #  # ][ #  # ]:          0 :                 C2U("com.sun.star.frame.DispatchHelper"), m_xCC ), uno::UNO_QUERY );
                 [ #  # ]
    1556         [ #  # ]:          0 :         if( xDispatchHelper.is())
    1557                 :            :         {
    1558         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > aArgs;
    1559         [ #  # ]:          0 :             xDispatchHelper->executeDispatch(
    1560                 :            :                 uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
    1561                 :            :                 C2U(".uno:TerminateInplaceActivation"),
    1562                 :            :                 C2U("_parent"),
    1563                 :            :                 frame::FrameSearchFlag::PARENT,
    1564 [ #  # ][ #  # ]:          0 :                 aArgs );
         [ #  # ][ #  # ]
    1565         [ #  # ]:          0 :             bReturn = true;
    1566                 :          0 :         }
    1567                 :            :     }
    1568                 :            : 
    1569 [ #  # ][ #  # ]:          0 :     if( ! bReturn &&
                 [ #  # ]
    1570                 :            :         (nCode == KEY_DELETE || nCode == KEY_BACKSPACE ))
    1571                 :            :     {
    1572         [ #  # ]:          0 :         bReturn = executeDispatch_Delete();
    1573         [ #  # ]:          0 :         if( ! bReturn )
    1574                 :            :         {
    1575         [ #  # ]:          0 :             SolarMutexGuard aGuard;
    1576 [ #  # ][ #  # ]:          0 :             InfoBox( m_pChartWindow, String(SchResId( STR_ACTION_NOTPOSSIBLE ))).Execute();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1577                 :            :         }
    1578                 :            :     }
    1579                 :            : 
    1580                 :          0 :     return bReturn;
    1581                 :            : }
    1582                 :            : 
    1583                 :          0 : bool ChartController::requestQuickHelp(
    1584                 :            :     ::Point aAtLogicPosition,
    1585                 :            :     bool bIsBalloonHelp,
    1586                 :            :     ::rtl::OUString & rOutQuickHelpText,
    1587                 :            :     awt::Rectangle & rOutEqualRect )
    1588                 :            : {
    1589                 :          0 :     uno::Reference< frame::XModel > xChartModel;
    1590 [ #  # ][ #  # ]:          0 :     if( m_aModel.is())
    1591 [ #  # ][ #  # ]:          0 :         xChartModel.set( getModel() );
    1592         [ #  # ]:          0 :     if( !xChartModel.is())
    1593                 :          0 :         return false;
    1594                 :            : 
    1595                 :            :     // help text
    1596                 :          0 :     ::rtl::OUString aCID;
    1597         [ #  # ]:          0 :     if( m_pDrawViewWrapper )
    1598                 :            :     {
    1599                 :            :         aCID = SelectionHelper::getHitObjectCID(
    1600         [ #  # ]:          0 :             aAtLogicPosition, *m_pDrawViewWrapper );
    1601                 :            :     }
    1602                 :          0 :     bool bResult( !aCID.isEmpty());
    1603                 :            : 
    1604         [ #  # ]:          0 :     if( bResult )
    1605                 :            :     {
    1606                 :            :         // get help text
    1607         [ #  # ]:          0 :         rOutQuickHelpText = ObjectNameProvider::getHelpText( aCID, xChartModel, bIsBalloonHelp /* bVerbose */ );
    1608                 :            : 
    1609                 :            :         // set rectangle
    1610                 :            :         ExplicitValueProvider * pValueProvider(
    1611         [ #  # ]:          0 :             ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
    1612         [ #  # ]:          0 :         if( pValueProvider )
    1613         [ #  # ]:          0 :             rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true );
    1614                 :            :     }
    1615                 :            : 
    1616                 :          0 :     return bResult;
    1617                 :            : }
    1618                 :            : 
    1619                 :            : //-----------------------------------------------------------------
    1620                 :            : // XSelectionSupplier (optional interface)
    1621                 :            : //-----------------------------------------------------------------
    1622                 :         34 :         sal_Bool SAL_CALL ChartController
    1623                 :            : ::select( const uno::Any& rSelection )
    1624                 :            :         throw( lang::IllegalArgumentException )
    1625                 :            : {
    1626                 :         34 :     bool bSuccess = false;
    1627                 :            : 
    1628         [ +  - ]:         34 :     if ( rSelection.hasValue() )
    1629                 :            :     {
    1630                 :         34 :         const uno::Type& rType = rSelection.getValueType();
    1631         [ +  - ]:         34 :         if ( rType == ::getCppuType( static_cast< const ::rtl::OUString* >( 0 ) ) )
    1632                 :            :         {
    1633                 :         34 :             ::rtl::OUString aNewCID;
    1634 [ +  - ][ +  - ]:         34 :             if ( ( rSelection >>= aNewCID ) && m_aSelection.setSelection( aNewCID ) )
         [ +  - ][ +  - ]
    1635                 :            :             {
    1636                 :         34 :                 bSuccess = true;
    1637                 :         34 :             }
    1638                 :            :         }
    1639         [ #  # ]:          0 :         else if ( rType == ::getCppuType( static_cast< const uno::Reference< drawing::XShape >* >( 0 ) ) )
    1640                 :            :         {
    1641                 :          0 :             uno::Reference< drawing::XShape > xShape;
    1642 [ #  # ][ #  # ]:          0 :             if ( ( rSelection >>= xShape ) && m_aSelection.setSelection( xShape ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1643                 :            :             {
    1644                 :          0 :                 bSuccess = true;
    1645                 :          0 :             }
    1646                 :            :         }
    1647                 :            :     }
    1648                 :            :     else
    1649                 :            :     {
    1650         [ #  # ]:          0 :         if ( m_aSelection.hasSelection() )
    1651                 :            :         {
    1652                 :          0 :             m_aSelection.clearSelection();
    1653                 :          0 :             bSuccess = true;
    1654                 :            :         }
    1655                 :            :     }
    1656                 :            : 
    1657         [ +  - ]:         34 :     if ( bSuccess )
    1658                 :            :     {
    1659         [ +  - ]:         34 :         SolarMutexGuard aGuard;
    1660 [ -  + ][ #  # ]:         34 :         if ( m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() )
         [ #  # ][ -  + ]
    1661                 :            :         {
    1662         [ #  # ]:          0 :             this->EndTextEdit();
    1663                 :            :         }
    1664         [ +  - ]:         34 :         this->impl_selectObjectAndNotiy();
    1665         [ -  + ]:         34 :         if ( m_pChartWindow )
    1666                 :            :         {
    1667         [ #  # ]:          0 :             m_pChartWindow->Invalidate();
    1668                 :            :         }
    1669         [ +  - ]:         34 :         return sal_True;
    1670                 :            :     }
    1671                 :            : 
    1672                 :         34 :     return sal_False;
    1673                 :            : }
    1674                 :            : 
    1675                 :       5381 :         uno::Any SAL_CALL ChartController
    1676                 :            : ::getSelection() throw(uno::RuntimeException)
    1677                 :            : {
    1678                 :       5381 :     uno::Any aReturn;
    1679 [ +  + ][ +  - ]:       5381 :     if ( m_aSelection.hasSelection() )
    1680                 :            :     {
    1681         [ +  - ]:       5347 :         ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
    1682         [ +  - ]:       5347 :         if ( !aCID.isEmpty() )
    1683                 :            :         {
    1684         [ +  - ]:       5347 :             aReturn = uno::makeAny( aCID );
    1685                 :            :         }
    1686                 :            :         else
    1687                 :            :         {
    1688                 :            :             // #i12587# support for shapes in chart
    1689 [ #  # ][ #  # ]:          0 :             aReturn = uno::makeAny( m_aSelection.getSelectedAdditionalShape() );
    1690                 :       5347 :         }
    1691                 :            :     }
    1692                 :       5381 :     return aReturn;
    1693                 :            : }
    1694                 :            : 
    1695                 :         68 :         void SAL_CALL ChartController
    1696                 :            : ::addSelectionChangeListener( const uno::Reference<
    1697                 :            :         view::XSelectionChangeListener > & xListener )
    1698                 :            :         throw(uno::RuntimeException)
    1699                 :            : {
    1700         [ +  - ]:         68 :     SolarMutexGuard aGuard;
    1701 [ +  - ][ -  + ]:         68 :     if( impl_isDisposedOrSuspended() )//@todo? allow adding of listeners in suspend mode?
    1702                 :         68 :         return; //behave passive if already disposed or suspended
    1703                 :            : 
    1704                 :            :     //--add listener
    1705 [ +  - ][ +  - ]:         68 :     m_aLifeTimeManager.m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
         [ +  - ][ +  - ]
    1706                 :            : }
    1707                 :            : 
    1708                 :          0 :         void SAL_CALL ChartController
    1709                 :            : ::removeSelectionChangeListener( const uno::Reference<
    1710                 :            :         view::XSelectionChangeListener > & xListener )
    1711                 :            :         throw(uno::RuntimeException)
    1712                 :            : {
    1713         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1714 [ #  # ][ #  # ]:          0 :     if( impl_isDisposedOrSuspended() ) //@todo? allow removing of listeners in suspend mode?
    1715                 :          0 :         return; //behave passive if already disposed or suspended
    1716                 :            : 
    1717                 :            :     //--remove listener
    1718 [ #  # ][ #  # ]:          0 :     m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
         [ #  # ][ #  # ]
    1719                 :            : }
    1720                 :            : 
    1721                 :        783 :         void ChartController
    1722                 :            : ::impl_notifySelectionChangeListeners()
    1723                 :            : {
    1724                 :            :     ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
    1725                 :        783 :         .getContainer( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0) );
    1726         [ +  - ]:        783 :     if( pIC )
    1727                 :            :     {
    1728         [ +  - ]:        783 :         uno::Reference< view::XSelectionSupplier > xSelectionSupplier(this);
    1729         [ +  - ]:        783 :         lang::EventObject aEvent( xSelectionSupplier );
    1730         [ +  - ]:        783 :         ::cppu::OInterfaceIteratorHelper aIt( *pIC );
    1731         [ +  + ]:       2315 :         while( aIt.hasMoreElements() )
    1732                 :            :         {
    1733 [ +  - ][ +  - ]:       1532 :             uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
    1734         [ +  - ]:       1532 :             if( xListener.is() )
    1735 [ +  - ][ +  - ]:       1532 :                 xListener->selectionChanged( aEvent );
    1736 [ +  - ][ +  - ]:       2315 :         }
    1737                 :            :     }
    1738                 :        783 : }
    1739                 :            : 
    1740                 :        783 : void ChartController::impl_selectObjectAndNotiy()
    1741                 :            : {
    1742                 :            :     {
    1743         [ +  - ]:        783 :         SolarMutexGuard aGuard;
    1744                 :        783 :         DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
    1745         [ +  + ]:        783 :         if( pDrawViewWrapper )
    1746                 :            :         {
    1747         [ +  - ]:        749 :             pDrawViewWrapper->SetDragMode( m_eDragMode );
    1748         [ +  - ]:        749 :             m_aSelection.applySelection( m_pDrawViewWrapper );
    1749         [ +  - ]:        783 :         }
    1750                 :            :     }
    1751                 :        783 :     impl_notifySelectionChangeListeners();
    1752                 :        783 : }
    1753                 :            : 
    1754                 :          0 : bool ChartController::impl_moveOrResizeObject(
    1755                 :            :     const ::rtl::OUString & rCID,
    1756                 :            :     eMoveOrResizeType eType,
    1757                 :            :     double fAmountLogicX,
    1758                 :            :     double fAmountLogicY )
    1759                 :            : {
    1760                 :          0 :     bool bResult = false;
    1761                 :          0 :     bool bNeedShift = true;
    1762                 :          0 :     bool bNeedResize = ( eType == CENTERED_RESIZE_OBJECT );
    1763                 :            : 
    1764         [ #  # ]:          0 :     uno::Reference< frame::XModel > xChartModel( getModel() );
    1765                 :            :     uno::Reference< beans::XPropertySet > xObjProp(
    1766         [ #  # ]:          0 :         ObjectIdentifier::getObjectPropertySet( rCID, xChartModel ));
    1767         [ #  # ]:          0 :     if( xObjProp.is())
    1768                 :            :     {
    1769         [ #  # ]:          0 :         awt::Size aRefSize = ChartModelHelper::getPageSize( xChartModel );
    1770                 :            : 
    1771                 :          0 :         chart2::RelativePosition aRelPos;
    1772                 :          0 :         chart2::RelativeSize     aRelSize;
    1773 [ #  # ][ #  # ]:          0 :         bool bDeterminePos  = !(xObjProp->getPropertyValue( C2U("RelativePosition")) >>= aRelPos);
         [ #  # ][ #  # ]
    1774 [ #  # ][ #  # ]:          0 :         bool bDetermineSize = !bNeedResize || !(xObjProp->getPropertyValue( C2U("RelativeSize")) >>= aRelSize);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    1775                 :            : 
    1776 [ #  # ][ #  # ]:          0 :         if( ( bDeterminePos || bDetermineSize ) &&
         [ #  # ][ #  # ]
    1777                 :            :             ( aRefSize.Width > 0 && aRefSize.Height > 0 ) )
    1778                 :            :         {
    1779                 :            :             ExplicitValueProvider * pValueProvider(
    1780         [ #  # ]:          0 :                 ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
    1781         [ #  # ]:          0 :             if( pValueProvider )
    1782                 :            :             {
    1783         [ #  # ]:          0 :                 awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID ));
    1784                 :          0 :                 double fWidth = static_cast< double >( aRefSize.Width );
    1785                 :          0 :                 double fHeight = static_cast< double >( aRefSize.Height );
    1786         [ #  # ]:          0 :                 if( bDetermineSize )
    1787                 :            :                 {
    1788                 :          0 :                     aRelSize.Primary   = static_cast< double >( aRect.Width ) / fWidth;
    1789                 :          0 :                     aRelSize.Secondary = static_cast< double >( aRect.Height ) / fHeight;
    1790                 :            :                 }
    1791         [ #  # ]:          0 :                 if( bDeterminePos )
    1792                 :            :                 {
    1793 [ #  # ][ #  # ]:          0 :                     if( bNeedResize && aRelSize.Primary > 0.0 && aRelSize.Secondary > 0.0 )
                 [ #  # ]
    1794                 :            :                     {
    1795                 :            :                         aRelPos.Primary   = (static_cast< double >( aRect.X ) / fWidth) +
    1796                 :          0 :                             (aRelSize.Primary / 2.0);
    1797                 :            :                         aRelPos.Secondary = (static_cast< double >( aRect.Y ) / fHeight) +
    1798                 :          0 :                             (aRelSize.Secondary / 2.0);
    1799                 :          0 :                         aRelPos.Anchor = drawing::Alignment_CENTER;
    1800                 :            :                     }
    1801                 :            :                     else
    1802                 :            :                     {
    1803                 :          0 :                         aRelPos.Primary   = static_cast< double >( aRect.X ) / fWidth;
    1804                 :          0 :                         aRelPos.Secondary = static_cast< double >( aRect.Y ) / fHeight;
    1805                 :          0 :                         aRelPos.Anchor = drawing::Alignment_TOP_LEFT;
    1806                 :            :                     }
    1807                 :            :                 }
    1808                 :            :             }
    1809                 :            :         }
    1810                 :            : 
    1811         [ #  # ]:          0 :         if( eType == CENTERED_RESIZE_OBJECT )
    1812         [ #  # ]:          0 :             bResult = lcl_GrowAndShiftLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
    1813         [ #  # ]:          0 :         else if( eType == MOVE_OBJECT )
    1814         [ #  # ]:          0 :             bResult = lcl_MoveObjectLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
    1815                 :            : 
    1816         [ #  # ]:          0 :         if( bResult )
    1817                 :            :         {
    1818                 :          0 :             ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
    1819         [ #  # ]:          0 :             if( bNeedResize )
    1820                 :          0 :                 eActionType = ActionDescriptionProvider::RESIZE;
    1821                 :            : 
    1822         [ #  # ]:          0 :             ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
    1823                 :            :             UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
    1824 [ #  # ][ #  # ]:          0 :                     eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager );
                 [ #  # ]
    1825                 :            :             {
    1826         [ #  # ]:          0 :                 ControllerLockGuard aCLGuard( xChartModel );
    1827         [ #  # ]:          0 :                 if( bNeedShift )
    1828 [ #  # ][ #  # ]:          0 :                     xObjProp->setPropertyValue( C2U("RelativePosition"), uno::makeAny( aRelPos ));
         [ #  # ][ #  # ]
    1829 [ #  # ][ #  # ]:          0 :                 if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set
    1830 [ #  # ][ #  # ]:          0 :                     xObjProp->setPropertyValue( C2U("RelativeSize"), uno::makeAny( aRelSize ));
         [ #  # ][ #  # ]
                 [ #  # ]
    1831                 :            :             }
    1832 [ #  # ][ #  # ]:          0 :             aUndoGuard.commit();
    1833                 :            :         }
    1834                 :            :     }
    1835                 :          0 :     return bResult;
    1836                 :            : }
    1837                 :            : 
    1838                 :          0 : bool ChartController::impl_DragDataPoint( const ::rtl::OUString & rCID, double fAdditionalOffset )
    1839                 :            : {
    1840                 :          0 :     bool bResult = false;
    1841 [ #  # ][ #  # ]:          0 :     if( fAdditionalOffset < -1.0 || fAdditionalOffset > 1.0 || fAdditionalOffset == 0.0 )
                 [ #  # ]
    1842                 :          0 :         return bResult;
    1843                 :            : 
    1844         [ #  # ]:          0 :     sal_Int32 nDataPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rCID );
    1845                 :            :     uno::Reference< chart2::XDataSeries > xSeries(
    1846 [ #  # ][ #  # ]:          0 :         ObjectIdentifier::getDataSeriesForCID( rCID, getModel() ));
    1847         [ #  # ]:          0 :     if( xSeries.is())
    1848                 :            :     {
    1849                 :            :         try
    1850                 :            :         {
    1851 [ #  # ][ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex( nDataPointIndex ));
    1852                 :          0 :             double fOffset = 0.0;
    1853   [ #  #  #  # ]:          0 :             if( xPointProp.is() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1854 [ #  # ][ #  # ]:          0 :                 (xPointProp->getPropertyValue( C2U("Offset" )) >>= fOffset ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1855                 :            :                 (( fAdditionalOffset > 0.0 && fOffset < 1.0 ) || (fOffset > 0.0)) )
    1856                 :            :             {
    1857                 :          0 :                 fOffset += fAdditionalOffset;
    1858         [ #  # ]:          0 :                 if( fOffset > 1.0 )
    1859                 :          0 :                     fOffset = 1.0;
    1860         [ #  # ]:          0 :                 else if( fOffset < 0.0 )
    1861                 :          0 :                     fOffset = 0.0;
    1862 [ #  # ][ #  # ]:          0 :                 xPointProp->setPropertyValue( C2U("Offset"), uno::makeAny( fOffset ));
         [ #  # ][ #  # ]
    1863                 :          0 :                 bResult = true;
    1864         [ #  # ]:          0 :             }
    1865                 :            :         }
    1866         [ #  # ]:          0 :         catch( const uno::Exception & ex )
    1867                 :            :         {
    1868                 :            :             ASSERT_EXCEPTION( ex );
    1869                 :            :         }
    1870                 :            :     }
    1871                 :            : 
    1872                 :          0 :     return bResult;
    1873                 :            : }
    1874                 :            : 
    1875                 :          0 : void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
    1876                 :            : {
    1877         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1878 [ #  # ][ #  # ]:          0 :     if( m_pDrawViewWrapper && m_pChartWindow )
    1879                 :            :     {
    1880         [ #  # ]:          0 :         Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
    1881                 :          0 :         sal_uInt16 nModifier = rEvent.GetModifier();
    1882                 :          0 :         sal_Bool bLeftDown = rEvent.IsLeft();
    1883                 :            : 
    1884 [ #  # ][ #  # ]:          0 :         if ( m_pDrawViewWrapper->IsTextEdit() )
    1885                 :            :         {
    1886 [ #  # ][ #  # ]:          0 :             if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
    1887                 :            :             {
    1888                 :            :                 m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer(
    1889 [ #  # ][ #  # ]:          0 :                     aMousePos, m_pChartWindow, nModifier, bLeftDown ) );
    1890                 :            :                 return;
    1891                 :            :             }
    1892                 :            :         }
    1893 [ #  # ][ #  # ]:          0 :         else if( m_pDrawViewWrapper->IsAction() )
    1894                 :            :         {
    1895                 :            :             return;//don't change pointer during running action
    1896                 :            :         }
    1897                 :            : 
    1898                 :          0 :         SdrHdl* pHitSelectionHdl = 0;
    1899 [ #  # ][ #  # ]:          0 :         if( m_aSelection.isResizeableObjectSelected() )
    1900         [ #  # ]:          0 :             pHitSelectionHdl = m_pDrawViewWrapper->PickHandle( aMousePos );
    1901                 :            : 
    1902         [ #  # ]:          0 :         if( pHitSelectionHdl )
    1903                 :            :         {
    1904                 :            : 
    1905                 :            :             Pointer aPointer = m_pDrawViewWrapper->GetPreferedPointer(
    1906         [ #  # ]:          0 :                 aMousePos, m_pChartWindow, nModifier, bLeftDown );
    1907                 :          0 :             bool bForceArrowPointer = false;
    1908                 :            : 
    1909         [ #  # ]:          0 :             ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
    1910                 :            : 
    1911   [ #  #  #  # ]:          0 :             switch( aPointer.GetStyle())
    1912                 :            :             {
    1913                 :            :                 case POINTER_NSIZE:
    1914                 :            :                 case POINTER_SSIZE:
    1915                 :            :                 case POINTER_WSIZE:
    1916                 :            :                 case POINTER_ESIZE:
    1917                 :            :                 case POINTER_NWSIZE:
    1918                 :            :                 case POINTER_NESIZE:
    1919                 :            :                 case POINTER_SWSIZE:
    1920                 :            :                 case POINTER_SESIZE:
    1921 [ #  # ][ #  # ]:          0 :                     if( ! m_aSelection.isResizeableObjectSelected() )
    1922                 :          0 :                         bForceArrowPointer = true;
    1923                 :          0 :                     break;
    1924                 :            :                 case POINTER_MOVE:
    1925 [ #  # ][ #  # ]:          0 :                     if ( !aOID.isDragableObject() )
    1926                 :          0 :                         bForceArrowPointer = true;
    1927                 :          0 :                     break;
    1928                 :            :                 case POINTER_MOVEPOINT:
    1929                 :            :                 case POINTER_MOVEBEZIERWEIGHT:
    1930                 :            :                     // there is no point-editing in a chart
    1931                 :            :                     // the POINTER_MOVEBEZIERWEIGHT appears in 3d data points
    1932                 :          0 :                     bForceArrowPointer = true;
    1933                 :          0 :                     break;
    1934                 :            :                 default:
    1935                 :          0 :                     break;
    1936                 :            :             }
    1937                 :            : 
    1938         [ #  # ]:          0 :             if( bForceArrowPointer )
    1939         [ #  # ]:          0 :                 m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
    1940                 :            :             else
    1941 [ #  # ][ #  # ]:          0 :                 m_pChartWindow->SetPointer( aPointer );
    1942                 :            :         }
    1943                 :            :         else
    1944                 :            :         {
    1945                 :            :             // #i12587# support for shapes in chart
    1946 [ #  # ][ #  # ]:          0 :             if ( m_eDrawMode == CHARTDRAW_INSERT &&
         [ #  # ][ #  # ]
    1947 [ #  # ][ #  # ]:          0 :                  ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
    1948                 :            :             {
    1949                 :          0 :                 PointerStyle ePointerStyle = POINTER_DRAW_RECT;
    1950                 :          0 :                 SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
    1951   [ #  #  #  #  :          0 :                 switch ( eKind )
                #  #  # ]
    1952                 :            :                 {
    1953                 :            :                     case OBJ_LINE:
    1954                 :            :                         {
    1955                 :          0 :                             ePointerStyle = POINTER_DRAW_LINE;
    1956                 :            :                         }
    1957                 :          0 :                         break;
    1958                 :            :                     case OBJ_RECT:
    1959                 :            :                     case OBJ_CUSTOMSHAPE:
    1960                 :            :                         {
    1961                 :          0 :                             ePointerStyle = POINTER_DRAW_RECT;
    1962                 :            :                         }
    1963                 :          0 :                         break;
    1964                 :            :                     case OBJ_CIRC:
    1965                 :            :                         {
    1966                 :          0 :                             ePointerStyle = POINTER_DRAW_ELLIPSE;
    1967                 :            :                         }
    1968                 :          0 :                         break;
    1969                 :            :                     case OBJ_FREELINE:
    1970                 :            :                         {
    1971                 :          0 :                             ePointerStyle = POINTER_DRAW_POLYGON;
    1972                 :            :                         }
    1973                 :          0 :                         break;
    1974                 :            :                     case OBJ_TEXT:
    1975                 :            :                         {
    1976                 :          0 :                             ePointerStyle = POINTER_DRAW_TEXT;
    1977                 :            :                         }
    1978                 :          0 :                         break;
    1979                 :            :                     case OBJ_CAPTION:
    1980                 :            :                         {
    1981                 :          0 :                             ePointerStyle = POINTER_DRAW_CAPTION;
    1982                 :            :                         }
    1983                 :          0 :                         break;
    1984                 :            :                     default:
    1985                 :            :                         {
    1986                 :          0 :                             ePointerStyle = POINTER_DRAW_RECT;
    1987                 :            :                         }
    1988                 :          0 :                         break;
    1989                 :            :                 }
    1990         [ #  # ]:          0 :                 m_pChartWindow->SetPointer( Pointer( ePointerStyle ) );
    1991                 :            :                 return;
    1992                 :            :             }
    1993                 :            : 
    1994                 :            :             ::rtl::OUString aHitObjectCID(
    1995                 :            :                 SelectionHelper::getHitObjectCID(
    1996         [ #  # ]:          0 :                     aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ ));
    1997                 :            : 
    1998 [ #  # ][ #  # ]:          0 :             if( m_pDrawViewWrapper->IsTextEdit() )
    1999                 :            :             {
    2000 [ #  # ][ #  # ]:          0 :                 if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) )
    2001                 :            :                 {
    2002         [ #  # ]:          0 :                     m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
    2003                 :            :                     return;
    2004                 :            :                 }
    2005                 :            :             }
    2006                 :            : 
    2007         [ #  # ]:          0 :             if( aHitObjectCID.isEmpty() )
    2008                 :            :             {
    2009                 :            :                 //additional shape was hit
    2010         [ #  # ]:          0 :                 m_pChartWindow->SetPointer( POINTER_MOVE );
    2011                 :            :             }
    2012 [ #  # ][ #  # ]:          0 :             else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
    2013                 :            :             {
    2014 [ #  # ][ #  # ]:          0 :                 if( (m_eDragMode == SDRDRAG_ROTATE)
                 [ #  # ]
    2015                 :            :                     && SelectionHelper::isRotateableObject( aHitObjectCID
    2016 [ #  # ][ #  # ]:          0 :                         , getModel() ) )
         [ #  # ][ #  # ]
    2017         [ #  # ]:          0 :                     m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) );
    2018                 :            :                 else
    2019                 :            :                 {
    2020         [ #  # ]:          0 :                     ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID );
    2021         [ #  # ]:          0 :                     if( eHitObjectType == OBJECTTYPE_DATA_POINT )
    2022                 :            :                     {
    2023 [ #  # ][ #  # ]:          0 :                         if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID())
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    2024 [ #  # ][ #  # ]:          0 :                             && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) )
         [ #  # ][ #  # ]
    2025                 :            :                         {
    2026         [ #  # ]:          0 :                             m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
    2027                 :            :                             return;
    2028                 :            :                         }
    2029                 :            :                     }
    2030         [ #  # ]:          0 :                     m_pChartWindow->SetPointer( POINTER_MOVE );
    2031                 :            :                 }
    2032                 :            :             }
    2033                 :            :             else
    2034 [ #  # ][ #  # ]:          0 :                 m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
    2035                 :            :         }
    2036 [ #  # ][ #  # ]:          0 :     }
    2037                 :            : }
    2038                 :            : 
    2039                 :            : //.............................................................................
    2040                 :            : } //namespace chart
    2041                 :            : //.............................................................................
    2042                 :            : 
    2043                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10