LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbachart.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 366 0.0 %
Date: 2014-04-14 Functions: 0 35 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "vbachart.hxx"
      20             : #include <com/sun/star/beans/XPropertySet.hpp>
      21             : #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
      22             : #include <com/sun/star/chart/XAxisXSupplier.hpp>
      23             : #include <com/sun/star/chart/XAxisYSupplier.hpp>
      24             : #include <com/sun/star/chart/XAxisZSupplier.hpp>
      25             : #include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
      26             : #include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
      27             : #include <com/sun/star/chart/XChartDataArray.hpp>
      28             : #include <com/sun/star/chart/ChartSymbolType.hpp>
      29             : #include <com/sun/star/chart/ChartSolidType.hpp>
      30             : #include <com/sun/star/chart/ChartDataRowSource.hpp>
      31             : #include <com/sun/star/chart/ChartDataCaption.hpp>
      32             : #include <ooo/vba/excel/XlChartType.hpp>
      33             : #include <ooo/vba/excel/XlRowCol.hpp>
      34             : #include <ooo/vba/excel/XlAxisType.hpp>
      35             : #include <ooo/vba/excel/XlAxisGroup.hpp>
      36             : 
      37             : #include <basic/sberrors.hxx>
      38             : #include "vbachartobject.hxx"
      39             : #include "vbarange.hxx"
      40             : #include "vbacharttitle.hxx"
      41             : #include "vbaaxes.hxx"
      42             : 
      43             : using namespace ::com::sun::star;
      44             : using namespace ::ooo::vba;
      45             : using namespace ::ooo::vba::excel::XlChartType;
      46             : using namespace ::ooo::vba::excel::XlRowCol;
      47             : using namespace ::ooo::vba::excel::XlAxisType;
      48             : using namespace ::ooo::vba::excel::XlAxisGroup;
      49             : 
      50           0 : const OUString CHART_NAME("Name");
      51             : // #TODO move this constant to vbaseries.[ch]xx ( when it exists )
      52           0 : const OUString DEFAULTSERIESPREFIX("Series");
      53           0 : const OUString DATAROWSOURCE("DataRowSource");
      54           0 : const OUString UPDOWN("UpDown");
      55           0 : const OUString VOLUME("Volume");
      56           0 : const OUString LINES("Lines");
      57           0 : const OUString SPLINETYPE("SplineType");
      58           0 : const OUString SYMBOLTYPE("SymbolType");
      59           0 : const OUString DEEP("Deep");
      60           0 : const OUString SOLIDTYPE("SolidType");
      61           0 : const OUString VERTICAL("Vertical");
      62           0 : const OUString PERCENT("Percent");
      63           0 : const OUString STACKED("Stacked");
      64           0 : const OUString DIM3D("Dim3D");
      65           0 : const OUString HASMAINTITLE("HasMainTitle");
      66           0 : const OUString HASLEGEND("HasLegend");
      67             : 
      68           0 : ScVbaChart::ScVbaChart( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::lang::XComponent >& _xChartComponent, const css::uno::Reference< css::table::XTableChart >& _xTableChart ) : ChartImpl_BASE( _xParent, _xContext ), mxTableChart( _xTableChart )
      69             : {
      70           0 :     mxChartDocument.set( _xChartComponent, uno::UNO_QUERY_THROW ) ;
      71             :     // #TODO is is possible that the XPropertySet interface is not set
      72             :     // code in setPlotBy seems to indicate that this is possible? but
      73             :     // additionally there is no check in most of the places where it is used
      74             :     // ( and therefore could possibly be NULL )
      75             :     // I'm going to let it throw for the moment ( npower )
      76           0 :     mxDiagramPropertySet.set( mxChartDocument->getDiagram(), uno::UNO_QUERY_THROW );
      77           0 :     mxChartPropertySet.set( _xChartComponent, uno::UNO_QUERY_THROW ) ;
      78           0 : }
      79             : 
      80             : OUString SAL_CALL
      81           0 : ScVbaChart::getName() throw (css::uno::RuntimeException, std::exception)
      82             : {
      83           0 :     OUString sName;
      84           0 :     uno::Reference< beans::XPropertySet > xProps( mxChartDocument, uno::UNO_QUERY_THROW );
      85             :     try
      86             :     {
      87           0 :         xProps->getPropertyValue( CHART_NAME ) >>= sName;
      88             :     }
      89           0 :     catch( const uno::Exception & ) // swallow exceptions
      90             :     {
      91             :     }
      92           0 :     return sName;
      93             : }
      94             : 
      95             : uno::Any  SAL_CALL
      96           0 : ScVbaChart::SeriesCollection(const uno::Any&) throw (uno::RuntimeException, std::exception)
      97             : {
      98           0 :     return uno::Any();
      99             : }
     100             : 
     101             : ::sal_Int32 SAL_CALL
     102           0 : ScVbaChart::getChartType() throw ( uno::RuntimeException, script::BasicErrorException, std::exception)
     103             : {
     104           0 :     sal_Int32 nChartType = -1;
     105             :     try
     106             :     {
     107           0 :         OUString sDiagramType = mxChartDocument->getDiagram()->getDiagramType();
     108           0 :         if ( sDiagramType == "com.sun.star.chart.AreaDiagram" )
     109             :         {
     110           0 :             if (is3D())
     111             :             {
     112           0 :                 nChartType = getStackedType(xl3DAreaStacked, xl3DAreaStacked100, xl3DArea);
     113             :             }
     114             :             else
     115             :             {
     116           0 :                 nChartType = getStackedType(xlAreaStacked, xlAreaStacked100, xlArea);
     117             :             }
     118             :         }
     119           0 :         else if ( sDiagramType == "com.sun.star.chart.PieDiagram" )
     120             :         {
     121           0 :             if (is3D())
     122           0 :                 nChartType = xl3DPie;
     123             :             else
     124           0 :                 nChartType = xlPie;                 /*TODO XlChartType  xlPieExploded, XlChartType xlPieOfPie */
     125             :         }
     126           0 :         else if ( sDiagramType == "com.sun.star.chart.BarDiagram" )
     127             :         {
     128           0 :             sal_Int32 nSolidType = chart::ChartSolidType::RECTANGULAR_SOLID;
     129           0 :             if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SOLIDTYPE))
     130             :             {       //in 2D diagrams 'SolidType' may not be set
     131           0 :                 if (is3D())
     132           0 :                     mxDiagramPropertySet->getPropertyValue(SOLIDTYPE) >>= nSolidType;
     133             :             }
     134           0 :             switch (nSolidType)
     135             :             {
     136             :                 case chart::ChartSolidType::CONE:
     137           0 :                     nChartType = getSolidType(xlConeCol, xlConeColStacked, xlConeColStacked100, xlConeColClustered, xlConeBarStacked, xlConeBarStacked100, xlConeBarClustered);
     138           0 :                     break;
     139             :                 case chart::ChartSolidType::CYLINDER:
     140           0 :                     nChartType = getSolidType(xlCylinderCol, xlCylinderColStacked, xlCylinderColStacked100, xlCylinderColClustered, xlCylinderBarStacked, xlCylinderBarStacked100, xlCylinderBarClustered);
     141           0 :                     break;
     142             :                 case chart::ChartSolidType::PYRAMID:
     143           0 :                     nChartType = getSolidType(xlPyramidCol, xlPyramidColStacked, xlPyramidColStacked100, xlPyramidColClustered, xlPyramidBarStacked, xlPyramidBarStacked100, xlPyramidBarClustered);
     144           0 :                     break;
     145             :                 default: // RECTANGULAR_SOLID
     146           0 :                     if (is3D())
     147             :                     {
     148           0 :                         nChartType = getSolidType(xl3DColumn, xl3DColumnStacked, xl3DColumnStacked100, xl3DColumnClustered, xl3DBarStacked, xl3DBarStacked100, xl3DBarClustered);
     149             :                     }
     150             :                     else
     151             :                     {
     152           0 :                         nChartType = getSolidType(xlColumnClustered,  xlColumnStacked, xlColumnStacked100, xlColumnClustered, xlBarStacked, xlBarStacked100, xlBarClustered);
     153             :                     }
     154           0 :                     break;
     155             :                 }
     156             :             }
     157           0 :         else if ( sDiagramType == "com.sun.star.chart.StockDiagram" )
     158             :         {
     159           0 :             sal_Bool bVolume = false;
     160           0 :             mxDiagramPropertySet->getPropertyValue(VOLUME) >>= bVolume;
     161           0 :             if (bVolume)
     162             :             {
     163           0 :                 nChartType = getStockUpDownValue(xlStockVOHLC, xlStockVHLC);
     164             :             }
     165             :             else
     166             :             {
     167           0 :                 nChartType = getStockUpDownValue(xlStockOHLC, xlStockHLC);
     168             :             }
     169             :         }
     170           0 :         else if ( sDiagramType == "com.sun.star.chart.XYDiagram" )
     171             :         {
     172           0 :             sal_Bool bHasLines = false;
     173           0 :             mxDiagramPropertySet->getPropertyValue(LINES) >>= bHasLines;
     174           0 :             sal_Int32 nSplineType = 0;
     175           0 :             mxDiagramPropertySet->getPropertyValue(SPLINETYPE) >>= nSplineType;
     176           0 :             if (nSplineType == 1)
     177             :             {
     178           0 :                 nChartType = getMarkerType(xlXYScatterSmooth, xlXYScatterSmoothNoMarkers);
     179             :             }
     180           0 :             else if (bHasLines)
     181             :             {
     182           0 :                 nChartType = getMarkerType(xlXYScatterLines, xlXYScatterLinesNoMarkers);
     183             :             }
     184             :             else
     185             :             {
     186           0 :                 nChartType = xlXYScatter;
     187             :             }
     188             :         }
     189           0 :         else if ( sDiagramType == "com.sun.star.chart.LineDiagram" )
     190             :         {
     191           0 :             if (is3D())
     192             :             {
     193           0 :                 nChartType = xl3DLine;
     194             :             }
     195           0 :             else if (hasMarkers())
     196             :             {
     197           0 :                 nChartType = getStackedType(xlLineMarkersStacked, xlLineMarkersStacked100, xlLineMarkers);
     198             :             }
     199             :             else
     200             :             {
     201           0 :                 nChartType = getStackedType(xlLineStacked, xlLineStacked100, xlLine);
     202             :             }
     203             :         }
     204           0 :         else if ( sDiagramType == "com.sun.star.chart.DonutDiagram" )
     205             :         {
     206           0 :             nChartType = xlDoughnut;                    // TODO DoughnutExploded ??
     207             :         }
     208           0 :         else if ( sDiagramType == "com.sun.star.chart.NetDiagram" )
     209             :         {
     210           0 :             nChartType = getMarkerType(xlRadarMarkers, xlRadar);
     211           0 :         }
     212             :     }
     213           0 :     catch ( const uno::Exception& )
     214             :     {
     215           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     216             :     }
     217           0 :     return nChartType;
     218             : }
     219             : 
     220             : void SAL_CALL
     221           0 : ScVbaChart::setChartType( ::sal_Int32 _nChartType ) throw ( uno::RuntimeException, script::BasicErrorException, std::exception)
     222             : {
     223             : try
     224             : {
     225           0 :     switch (_nChartType)
     226             :     {
     227             :         case xlColumnClustered:
     228             :         case xlColumnStacked:
     229             :         case xlColumnStacked100:
     230             :         case xl3DColumnClustered:
     231             :         case xl3DColumnStacked:
     232             :         case xl3DColumnStacked100:
     233             :         case xl3DColumn:
     234             :         case xlBarClustered:
     235             :         case xlBarStacked:
     236             :         case xlBarStacked100:
     237             :         case xl3DBarClustered:
     238             :         case xl3DBarStacked:
     239             :         case xl3DBarStacked100:
     240             :         case xlConeColClustered:
     241             :         case xlConeColStacked:
     242             :         case xlConeColStacked100:
     243             :         case xlConeBarClustered:
     244             :         case xlConeBarStacked:
     245             :         case xlConeBarStacked100:
     246             :         case xlConeCol:
     247             :         case xlPyramidColClustered:
     248             :         case xlPyramidColStacked:
     249             :         case xlPyramidColStacked100:
     250             :         case xlPyramidBarClustered:
     251             :         case xlPyramidBarStacked:
     252             :         case xlPyramidBarStacked100:
     253             :         case xlPyramidCol:
     254             :         case xlCylinderColClustered:
     255             :         case xlCylinderColStacked:
     256             :         case xlCylinderColStacked100:
     257             :         case xlCylinderBarClustered:
     258             :         case xlCylinderBarStacked:
     259             :         case xlCylinderBarStacked100:
     260             :         case xlCylinderCol:
     261             :         case xlSurface: // not possible
     262             :         case xlSurfaceWireframe:
     263             :         case xlSurfaceTopView:
     264             :         case xlSurfaceTopViewWireframe:
     265           0 :             setDiagram( OUString("com.sun.star.chart.BarDiagram"));
     266           0 :             break;
     267             :         case xlLine:
     268             :         case xl3DLine:
     269             :         case xlLineStacked:
     270             :         case xlLineStacked100:
     271             :         case xlLineMarkers:
     272             :         case xlLineMarkersStacked:
     273             :         case xlLineMarkersStacked100:
     274           0 :             setDiagram( OUString("com.sun.star.chart.LineDiagram"));
     275           0 :             break;
     276             :         case xl3DArea:
     277             :         case xlArea:
     278             :         case xlAreaStacked:
     279             :         case xlAreaStacked100:
     280             :         case xl3DAreaStacked:
     281             :         case xl3DAreaStacked100:
     282           0 :             setDiagram( OUString("com.sun.star.chart.AreaDiagram") );
     283           0 :             break;
     284             :         case xlDoughnut:
     285             :         case xlDoughnutExploded:
     286           0 :             setDiagram( OUString("com.sun.star.chart.DonutDiagram") );
     287           0 :             break;
     288             :         case xlStockHLC:
     289             :         case xlStockOHLC:
     290             :         case xlStockVHLC:
     291             :         case xlStockVOHLC:
     292           0 :             setDiagram( OUString("com.sun.star.chart.StockDiagram"));
     293           0 :             mxDiagramPropertySet->setPropertyValue( UPDOWN, uno::makeAny(sal_Bool((_nChartType == xlStockOHLC) || (_nChartType == xlStockVOHLC))));
     294           0 :             mxDiagramPropertySet->setPropertyValue(VOLUME, uno::makeAny(sal_Bool((_nChartType == xlStockVHLC) || (_nChartType == xlStockVOHLC))));
     295           0 :             break;
     296             : 
     297             :         case xlPieOfPie:                            // not possible
     298             :         case xlPieExploded: // SegmentOffset an ChartDataPointProperties ->am XDiagram abholen //wie macht Excel das?
     299             :         case xl3DPieExploded:
     300             :         case xl3DPie:
     301             :         case xlPie:
     302             :         case xlBarOfPie:                            // not possible (Zoom pie)
     303           0 :             setDiagram( OUString("com.sun.star.chart.PieDiagram"));
     304           0 :             break;
     305             : 
     306             :         case xlRadar:
     307             :         case xlRadarMarkers:
     308             :         case xlRadarFilled:
     309           0 :             setDiagram( OUString("com.sun.star.chart.NetDiagram"));
     310           0 :             break;
     311             :         case xlXYScatter:
     312             :         case xlBubble:                      // not possible
     313             :         case xlBubble3DEffect:              // not possible
     314             :         case xlXYScatterLines:
     315             :         case xlXYScatterLinesNoMarkers:
     316             :         case xlXYScatterSmooth:
     317             :         case xlXYScatterSmoothNoMarkers:
     318           0 :             setDiagram( OUString("com.sun.star.chart.XYDiagram"));
     319           0 :             switch(_nChartType)
     320             :             {
     321             :                 case xlXYScatter:
     322             :                 case xlBubble:                      // not possible
     323             :                 case xlBubble3DEffect:              // not possible
     324           0 :                     mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( sal_False ));
     325           0 :                     break;
     326             :                 case xlXYScatterLines:
     327             :                 case xlXYScatterLinesNoMarkers:
     328           0 :                     mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( sal_True ));
     329           0 :                     break;
     330             :                 case xlXYScatterSmooth:
     331             :                 case xlXYScatterSmoothNoMarkers:
     332           0 :                     mxDiagramPropertySet->setPropertyValue(SPLINETYPE, uno::makeAny( sal_Int32(1)));
     333           0 :                     break;
     334             :                 default:
     335           0 :                     break;
     336             :             }
     337           0 :             break;
     338             :         default:
     339           0 :             throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_CONVERSION, OUString() );
     340             :     }
     341             : 
     342           0 :     switch (_nChartType)
     343             :     {
     344             :         case xlLineMarkers:
     345             :         case xlLineMarkersStacked:
     346             :         case xlLineMarkersStacked100:
     347             :         case xlRadarMarkers:
     348             :         case xlXYScatterLines:
     349             :         case xlXYScatterSmooth:
     350             :         case xlXYScatter:
     351             :         case xlBubble:                      // not possible
     352             :         case xlBubble3DEffect:              // not possible
     353           0 :             mxDiagramPropertySet->setPropertyValue(SYMBOLTYPE, uno::makeAny( chart::ChartSymbolType::AUTO));
     354           0 :             break;
     355             :         default:
     356           0 :             if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SYMBOLTYPE))
     357             :             {
     358           0 :                 mxDiagramPropertySet->setPropertyValue(SYMBOLTYPE, uno::makeAny(chart::ChartSymbolType::NONE));
     359             :             }
     360           0 :             break;
     361             :     }
     362             : 
     363           0 :     switch (_nChartType)
     364             :     {
     365             :         case xlConeCol:
     366             :         case xlPyramidCol:
     367             :         case xlCylinderCol:
     368             :         case xl3DColumn:
     369             :         case xlSurface:                         // not possible
     370             :         case xlSurfaceWireframe:
     371             :         case xlSurfaceTopView:
     372             :         case xlSurfaceTopViewWireframe:
     373           0 :             mxDiagramPropertySet->setPropertyValue(DEEP,uno::makeAny( sal_True ));
     374           0 :             break;
     375             :         default:
     376           0 :                 if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DEEP))
     377             :                 {
     378           0 :                     mxDiagramPropertySet->setPropertyValue(DEEP, uno::makeAny( sal_False));
     379             :                 }
     380           0 :                 break;
     381             :         }
     382             : 
     383             : 
     384           0 :         switch (_nChartType)
     385             :         {
     386             :                 case xlConeColClustered:
     387             :                 case xlConeColStacked:
     388             :                 case xlConeColStacked100:
     389             :                 case xlConeBarClustered:
     390             :                 case xlConeBarStacked:
     391             :                 case xlConeBarStacked100:
     392             :                 case xlConeCol:
     393           0 :                         mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::CONE));
     394           0 :                         break;
     395             :                 case xlPyramidColClustered:
     396             :                 case xlPyramidColStacked:
     397             :                 case xlPyramidColStacked100:
     398             :                 case xlPyramidBarClustered:
     399             :                 case xlPyramidBarStacked:
     400             :                 case xlPyramidBarStacked100:
     401             :                 case xlPyramidCol:
     402           0 :                         mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::PYRAMID));
     403           0 :                         break;
     404             :                 case xlCylinderColClustered:
     405             :                 case xlCylinderColStacked:
     406             :                 case xlCylinderColStacked100:
     407             :                 case xlCylinderBarClustered:
     408             :                 case xlCylinderBarStacked:
     409             :                 case xlCylinderBarStacked100:
     410             :                 case xlCylinderCol:
     411           0 :                         mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::CYLINDER));
     412           0 :                         break;
     413             :                 default:
     414           0 :                     if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SOLIDTYPE))
     415             :                     {
     416           0 :                             mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::RECTANGULAR_SOLID));
     417             :                     }
     418           0 :                     break;
     419             :         }
     420             : 
     421           0 :         switch ( _nChartType)
     422             :         {
     423             :             case xlConeCol:
     424             :             case xlConeColClustered:
     425             :             case xlConeColStacked:
     426             :             case xlConeColStacked100:
     427             :             case xlPyramidColClustered:
     428             :             case xlPyramidColStacked:
     429             :             case xlPyramidColStacked100:
     430             :             case xlCylinderColClustered:
     431             :             case xlCylinderColStacked:
     432             :             case xlCylinderColStacked100:
     433             :             case xlColumnClustered:
     434             :             case xlColumnStacked:
     435             :             case xlColumnStacked100:
     436             :             case xl3DColumnClustered:
     437             :             case xl3DColumnStacked:
     438             :             case xl3DColumnStacked100:
     439             :             case xlSurface: // not possible
     440             :             case xlSurfaceWireframe:
     441             :             case xlSurfaceTopView:
     442             :             case xlSurfaceTopViewWireframe:
     443           0 :                 mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny( sal_True));
     444           0 :                 break;
     445             :             default:
     446           0 :                 if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(VERTICAL))
     447             :                 {
     448           0 :                     mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny(sal_False));
     449             :                 }
     450           0 :                 break;
     451             :         }
     452             : 
     453           0 :         switch (_nChartType)
     454             :         {
     455             :             case xlColumnStacked:
     456             :             case xl3DColumnStacked:
     457             :             case xlBarStacked:
     458             :             case xl3DBarStacked:
     459             :             case xlLineStacked:
     460             :             case xlLineMarkersStacked:
     461             :             case xlAreaStacked:
     462             :             case xl3DAreaStacked:
     463             :             case xlCylinderColStacked:
     464             :             case xlCylinderBarStacked:
     465             :             case xlConeColStacked:
     466             :             case xlConeBarStacked:
     467             :             case xlPyramidColStacked:
     468             :             case xlPyramidBarStacked:
     469           0 :                 mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False ));
     470           0 :                 mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_True ));
     471           0 :                 break;
     472             :             case xlPyramidColStacked100:
     473             :             case xlPyramidBarStacked100:
     474             :             case xlConeColStacked100:
     475             :             case xlConeBarStacked100:
     476             :             case xlCylinderBarStacked100:
     477             :             case xlCylinderColStacked100:
     478             :             case xl3DAreaStacked100:
     479             :             case xlLineMarkersStacked100:
     480             :             case xlAreaStacked100:
     481             :             case xlLineStacked100:
     482             :             case xl3DBarStacked100:
     483             :             case xlBarStacked100:
     484             :             case xl3DColumnStacked100:
     485             :             case xlColumnStacked100:
     486           0 :                 mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_True));
     487           0 :                 mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_True ));
     488           0 :                 break;
     489             :             default:
     490           0 :                 mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False));
     491           0 :                 mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_False));
     492           0 :                 break;
     493             :         }
     494           0 :         switch (_nChartType)
     495             :         {
     496             :             case xl3DArea:
     497             :             case xl3DAreaStacked:
     498             :             case xl3DAreaStacked100:
     499             :             case xl3DBarClustered:
     500             :             case xl3DBarStacked:
     501             :             case xl3DBarStacked100:
     502             :             case xl3DColumn:
     503             :             case xl3DColumnClustered:
     504             :             case xl3DColumnStacked:
     505             :             case xl3DColumnStacked100:
     506             :             case xl3DLine:
     507             :             case xl3DPie:
     508             :             case xl3DPieExploded:
     509             :             case xlConeColClustered:
     510             :             case xlConeColStacked:
     511             :             case xlConeColStacked100:
     512             :             case xlConeBarClustered:
     513             :             case xlConeBarStacked:
     514             :             case xlConeBarStacked100:
     515             :             case xlConeCol:
     516             :             case xlPyramidColClustered:
     517             :             case xlPyramidColStacked:
     518             :             case xlPyramidColStacked100:
     519             :             case xlPyramidBarClustered:
     520             :             case xlPyramidBarStacked:
     521             :             case xlPyramidBarStacked100:
     522             :             case xlPyramidCol:
     523             :             case xlCylinderColClustered:
     524             :             case xlCylinderColStacked:
     525             :             case xlCylinderColStacked100:
     526             :             case xlCylinderBarClustered:
     527             :             case xlCylinderBarStacked:
     528             :             case xlCylinderBarStacked100:
     529             :             case xlCylinderCol:
     530           0 :                 mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( sal_True));
     531           0 :                 break;
     532             :             default:
     533           0 :                 if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DIM3D))
     534             :                 {
     535           0 :                     mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( sal_False));
     536             :                 }
     537           0 :                 break;
     538             :         }
     539             :     }
     540           0 :     catch ( const uno::Exception& )
     541             :     {
     542           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     543             :     }
     544           0 : }
     545             : 
     546             : void SAL_CALL
     547           0 : ScVbaChart::Activate() throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     548             : {
     549             :     // #TODO how are Chart sheets handled ( I know we don't even consider
     550             :     // them in the worksheets/sheets collections ), but.....???
     551             :     // note: in vba for excel the parent of a Chart sheet is a workbook,
     552             :     // e.g. 'ThisWorkbook'
     553           0 :     uno::Reference< XHelperInterface > xParent( getParent() );
     554           0 :     ScVbaChartObject* pChartObj = static_cast< ScVbaChartObject* >( xParent.get() );
     555           0 :     if ( pChartObj )
     556           0 :         pChartObj->Activate();
     557             :     else
     558           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString( "no ChartObject as parent" ) );
     559           0 : }
     560             : 
     561             : void SAL_CALL
     562           0 : ScVbaChart::setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange >& _xCalcRange, const css::uno::Any& _aPlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     563             : {
     564             :     try
     565             :     {
     566           0 :         uno::Sequence< table::CellRangeAddress > mRangeAddresses(1);
     567           0 :         table::CellRangeAddress mSingleRangeAddress;
     568             : 
     569           0 :         uno::Reference< sheet::XCellRangeAddressable > xAddressable( _xCalcRange->getCellRange(), uno::UNO_QUERY_THROW );
     570           0 :         mSingleRangeAddress = xAddressable->getRangeAddress();
     571             : 
     572           0 :         mRangeAddresses[0] = mSingleRangeAddress;
     573             : 
     574           0 :         mxTableChart->setRanges(mRangeAddresses);
     575             : 
     576           0 :         sal_Bool bsetRowHeaders = false;
     577           0 :         sal_Bool bsetColumnHeaders = false;
     578             : 
     579           0 :         ScVbaRange* pRange = static_cast< ScVbaRange* >( _xCalcRange.get() );
     580           0 :         if ( pRange )
     581             :         {
     582           0 :             ScDocument* pDoc = pRange->getScDocument();
     583           0 :             if ( pDoc )
     584             :             {
     585           0 :                 bsetRowHeaders = pDoc->HasRowHeader(  static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );
     586           0 :                 bsetColumnHeaders =  pDoc->HasColHeader(  static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ));
     587             : ;
     588             :             }
     589             :         }
     590           0 :         mxTableChart->setHasRowHeaders(bsetRowHeaders);
     591           0 :         mxTableChart->setHasColumnHeaders(bsetColumnHeaders);
     592             : 
     593           0 :         if ((!bsetColumnHeaders) || (!bsetRowHeaders))
     594             :         {
     595           0 :             uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
     596           0 :             if (!bsetColumnHeaders)
     597             :             {
     598           0 :                 xChartDataArray->setColumnDescriptions( getDefaultSeriesDescriptions(xChartDataArray->getColumnDescriptions().getLength() ));
     599             :             }
     600           0 :             if (!bsetRowHeaders)
     601             :             {
     602           0 :                 xChartDataArray->setRowDescriptions(getDefaultSeriesDescriptions(xChartDataArray->getRowDescriptions().getLength() ));
     603           0 :             }
     604             :         }
     605             : 
     606           0 :         if ( _aPlotBy.hasValue() )
     607             :         {
     608           0 :             sal_Int32 nVal = 0;
     609           0 :             _aPlotBy >>= nVal;
     610           0 :             setPlotBy( nVal );
     611             :         }
     612             :         else
     613             :         {
     614           0 :             sal_Int32 nRows =  mSingleRangeAddress.EndRow - mSingleRangeAddress.StartRow;
     615           0 :             sal_Int32 nCols = mSingleRangeAddress.EndColumn - mSingleRangeAddress.StartColumn;
     616             :             // AutoDetect emulation
     617           0 :             if ( nRows > nCols )
     618           0 :                 setPlotBy( xlColumns );
     619           0 :             else if ( nRows <= nCols )
     620           0 :                 setPlotBy( xlRows );
     621           0 :         }
     622             :     }
     623           0 :     catch (const uno::Exception&)
     624             :     {
     625           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     626             :     }
     627           0 : }
     628             : 
     629             : uno::Sequence< OUString >
     630           0 : ScVbaChart::getDefaultSeriesDescriptions( sal_Int32 _nCount )
     631             : {
     632           0 :     uno::Sequence< OUString > sDescriptions ( _nCount );
     633           0 :     sal_Int32 nLen = sDescriptions.getLength();
     634           0 :     for (sal_Int32 i = 0; i < nLen; i++)
     635             :     {
     636           0 :         sDescriptions[i] = DEFAULTSERIESPREFIX + OUString::number(i+1);
     637             :     }
     638           0 :     return sDescriptions;
     639             : }
     640             : 
     641             : void
     642           0 : ScVbaChart::setDefaultChartType() throw ( script::BasicErrorException )
     643             : {
     644           0 :     setChartType( xlColumnClustered );
     645           0 : }
     646             : 
     647             : void
     648           0 : ScVbaChart::setPlotBy( ::sal_Int32 _nPlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     649             : {
     650             :     try
     651             :     {
     652           0 :         if ( !mxDiagramPropertySet.is() )
     653           0 :             setDefaultChartType();
     654           0 :         switch (_nPlotBy)
     655             :         {
     656             :             case xlRows:
     657           0 :                 mxDiagramPropertySet->setPropertyValue( DATAROWSOURCE,  uno::makeAny( chart::ChartDataRowSource_ROWS ) );
     658           0 :                 break;
     659             :             case xlColumns:
     660           0 :                 mxDiagramPropertySet->setPropertyValue( DATAROWSOURCE, uno::makeAny( chart::ChartDataRowSource_COLUMNS) );
     661           0 :                 break;
     662             :             default:
     663           0 :                 throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     664             :         }
     665             :     }
     666           0 :     catch (const uno::Exception&)
     667             :     {
     668           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     669             :     }
     670           0 : }
     671             : 
     672             : ::sal_Int32 SAL_CALL
     673           0 : ScVbaChart::getPlotBy(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     674             : {
     675             :     try
     676             :     {
     677             :         chart::ChartDataRowSource aChartDataRowSource;
     678           0 :         mxDiagramPropertySet->getPropertyValue(DATAROWSOURCE) >>= aChartDataRowSource;
     679           0 :         if (aChartDataRowSource == chart::ChartDataRowSource_COLUMNS)
     680             :         {
     681           0 :             return xlColumns;
     682             :         }
     683             :         else
     684             :         {
     685           0 :             return xlRows;
     686             :         }
     687             :     }
     688           0 :     catch (const uno::Exception&)
     689             :     {
     690           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     691             :     }
     692             : }
     693             : 
     694             : void
     695           0 : ScVbaChart::setDiagram( const OUString& _sDiagramType ) throw( script::BasicErrorException )
     696             : {
     697             :     try
     698             :     {
     699           0 :         uno::Reference< lang::XMultiServiceFactory > xMSF( mxChartDocument, uno::UNO_QUERY_THROW );
     700           0 :         uno::Reference< chart::XDiagram > xDiagram( xMSF->createInstance( _sDiagramType ), uno::UNO_QUERY_THROW  );
     701           0 :         mxChartDocument->setDiagram( xDiagram );
     702           0 :         mxDiagramPropertySet.set( xDiagram, uno::UNO_QUERY_THROW );
     703             :     }
     704           0 :     catch ( const uno::Exception& )
     705             :     {
     706           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     707             :     }
     708           0 : }
     709             : 
     710             : // #TODO find out why we have Location/getLocation ? there is afaiks no
     711             : // Location property, just a Location function for the Chart object
     712             : sal_Int32 SAL_CALL
     713           0 : ScVbaChart::Location() throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     714             : {
     715           0 :     return getLocation();
     716             : }
     717             : 
     718             : sal_Int32 SAL_CALL
     719           0 : ScVbaChart::getLocation() throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     720             : {
     721           0 :      return -1;
     722             : }
     723             : 
     724             : void SAL_CALL
     725           0 : ScVbaChart::setLocation( ::sal_Int32 /*where*/, const css::uno::Any& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     726             : {
     727             :     // Helper api just stubs out the code <shrug>
     728             :     // #TODO come back and make sense out of this
     729             : //        String sheetName = null;
     730             : //
     731             : //        if ((name != null) && name instanceof String) {
     732             : //            sheetName = (String) name;
     733             : //        }
     734             : //        XSpreadsheetDocument xShDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface( XSpreadsheetDocument.class,getXModel() );
     735             : //        com.sun.star.sheet.XSpreadsheets xSheets = xShDoc.Sheets();
     736             : //
     737             : //        switch (where) {
     738             : //        case ClLocationType.clLocationAsObject_value: //{
     739             : //
     740             : //            if (sheetName == null) {
     741             : //                DebugHelper.writeInfo("Can't embed in Chart without knowing SheetName");
     742             : //                return;
     743             : //            }
     744             : //
     745             : //            try {
     746             : //                Any any = (Any) xSheets.getByName(sheetName);
     747             : //                chartSheet = (XSpreadsheet) any.getObject();
     748             : //
     749             : //                // chartSheet = (XSpreadsheet) xSheets.getByName( sheetName );
     750             : //            } catch (NoSuchElementException e) {
     751             : //                // TODO Auto-generated catch block
     752             : //                e.printStackTrace();
     753             : //
     754             : //                return;
     755             : //            } catch (WrappedTargetException e) {
     756             : //                // TODO Auto-generated catch block
     757             : //                e.printStackTrace();
     758             : //
     759             : //                return;
     760             : //            } catch (java.lang.Exception e) {
     761             : //                e.printStackTrace();
     762             : //            }
     763             : //
     764             : //            XTableChartsSupplier xTCS = (XTableChartsSupplier) UnoRuntime.queryInterface( XTableChartsSupplier.class, chartSheet);
     765             : //            XTableCharts xTableCharts = xTCS.getCharts();
     766             : //            XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xTableCharts);
     767             : //            int numCharts = xIA.getCount();
     768             : //            chartName = "Chart " + (numCharts + 1);
     769             : //
     770             : //            //}
     771             : //            break;
     772             : //
     773             : //        case ClLocationType.clLocationAsNewSheet_value:
     774             : //        case ClLocationType.clLocationAutomatic_value:default: //{
     775             : //            chartName = "Chart 1"; // Since it's a new sheet, it's the first on it...
     776             : //
     777             : //            XIndexAccess xSheetIA = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xSheets);
     778             : //
     779             : //            short newSheetNum = (short) (xSheetIA.getCount() + 1);
     780             : //
     781             : //            if (sheetName == null){
     782             : //                sheetName = "ChartSheet " + newSheetNum; // Why not?
     783             : //            }
     784             : //            // DPK TODO : Probably should use Sheets to create this!
     785             : //            xSheets.insertNewByName(sheetName, newSheetNum);
     786             : //
     787             : //            try {
     788             : //                chartSheet =
     789             : //                    (XSpreadsheet) xSheets.getByName(sheetName);
     790             : //            } catch (NoSuchElementException e) {
     791             : //                // TODO Auto-generated catch block
     792             : //                e.printStackTrace();
     793             : //
     794             : //                return;
     795             : //            } catch (WrappedTargetException e) {
     796             : //                // TODO Auto-generated catch block
     797             : //                e.printStackTrace();
     798             : //
     799             : //                return;
     800             : //            }
     801             : //
     802             : //            //}
     803             : //            break;
     804             : //        }
     805             : //
     806             : //        // Last thing should be a call to createChartForReal(), one of them
     807             : //        // should succeed.
     808             : //        createChartForReal();
     809             : 
     810           0 : }
     811             : 
     812             : sal_Bool SAL_CALL
     813           0 : ScVbaChart::getHasTitle(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     814             : {
     815           0 :     sal_Bool bHasTitle = false;
     816             :     try
     817             :     {
     818           0 :         mxChartPropertySet->getPropertyValue(HASMAINTITLE) >>= bHasTitle;
     819             :     }
     820           0 :     catch (const uno::Exception&)
     821             :     {
     822           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     823             :     }
     824           0 :     return bHasTitle;
     825             : }
     826             : 
     827             : void SAL_CALL
     828           0 : ScVbaChart::setHasTitle( sal_Bool bTitle ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     829             : {
     830             :     try
     831             :     {
     832           0 :         mxChartPropertySet->setPropertyValue(HASMAINTITLE, uno::makeAny( bTitle ));
     833             :     }
     834           0 :     catch (const uno::Exception&)
     835             :     {
     836           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     837             :     }
     838             : 
     839           0 : }
     840             : 
     841             : sal_Bool SAL_CALL
     842           0 : ScVbaChart::getHasLegend(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     843             : {
     844           0 :     sal_Bool bHasLegend = false;
     845             :     try
     846             :     {
     847           0 :         mxChartPropertySet->getPropertyValue(HASLEGEND) >>= bHasLegend;
     848             :     }
     849           0 :     catch (const uno::Exception&)
     850             :     {
     851           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     852             :     }
     853           0 :     return bHasLegend;
     854             : }
     855             : 
     856             : void SAL_CALL
     857           0 : ScVbaChart::setHasLegend( sal_Bool bLegend ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     858             : {
     859             :     try
     860             :     {
     861           0 :         mxChartPropertySet->setPropertyValue(HASLEGEND, uno::makeAny(bLegend));
     862             :     }
     863           0 :     catch (const uno::Exception&)
     864             :     {
     865           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     866             :     }
     867           0 : }
     868             : 
     869             : uno::Reference< excel::XChartTitle > SAL_CALL
     870           0 : ScVbaChart::getChartTitle(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     871             : {
     872           0 :     uno::Reference< drawing::XShape > xTitleShape = mxChartDocument->getTitle();
     873             :     // #TODO check parent
     874           0 :     return new ScVbaChartTitle(this, mxContext, xTitleShape);
     875             : }
     876             : 
     877             : uno::Any SAL_CALL
     878           0 : ScVbaChart::Axes( const uno::Any& Type, const uno::Any& AxisGroup ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     879             : {
     880             :     // mmm chart probably is the parent, #TODO check parent
     881           0 :     uno::Reference< excel::XAxes > xAxes = new ScVbaAxes( this, mxContext, this );
     882           0 :     if ( !Type.hasValue() )
     883           0 :         return uno::makeAny( xAxes );
     884           0 :     return xAxes->Item( Type, AxisGroup );
     885             : }
     886             : bool
     887           0 : ScVbaChart::is3D() throw ( uno::RuntimeException )
     888             : {
     889             :     // #TODO perhaps provide limited Debughelper functionality
     890           0 :     sal_Bool is3d = false;
     891           0 :     mxDiagramPropertySet->getPropertyValue(DIM3D) >>= is3d;
     892           0 :     return is3d;
     893             : }
     894             : 
     895             : sal_Int32
     896           0 : ScVbaChart::getStackedType( sal_Int32 _nStacked, sal_Int32 _n100PercentStacked, sal_Int32 _nUnStacked ) throw ( uno::RuntimeException )
     897             : {
     898             :     // #TODO perhaps provide limited Debughelper functionality
     899           0 :     if (isStacked())
     900             :     {
     901           0 :         if (is100PercentStacked())
     902           0 :             return _n100PercentStacked;
     903             :         else
     904           0 :             return _nStacked;
     905             :     }
     906             :     else
     907           0 :         return _nUnStacked;
     908             : }
     909             : 
     910             : bool
     911           0 : ScVbaChart::isStacked() throw ( uno::RuntimeException )
     912             : {
     913             :     // #TODO perhaps provide limited Debughelper functionality
     914           0 :     sal_Bool bStacked = false;
     915           0 :     mxDiagramPropertySet->getPropertyValue(STACKED) >>= bStacked;
     916           0 :     return bStacked;
     917             : }
     918             : 
     919             : bool
     920           0 : ScVbaChart::is100PercentStacked() throw ( uno::RuntimeException )
     921             : {
     922             :     // #TODO perhaps provide limited Debughelper functionality
     923           0 :     sal_Bool b100Percent = false;
     924           0 :     mxDiagramPropertySet->getPropertyValue(PERCENT) >>= b100Percent;
     925           0 :     return b100Percent;
     926             : }
     927             : 
     928             : sal_Int32
     929           0 : ScVbaChart::getSolidType(sal_Int32 _nDeep, sal_Int32 _nVertiStacked, sal_Int32 _nVerti100PercentStacked, sal_Int32 _nVertiUnStacked, sal_Int32 _nHoriStacked, sal_Int32 _nHori100PercentStacked, sal_Int32 _nHoriUnStacked) throw ( script::BasicErrorException )
     930             : {
     931           0 :     sal_Bool bIsVertical = true;
     932             :     try
     933             :     {
     934           0 :         mxDiagramPropertySet->getPropertyValue(VERTICAL) >>= bIsVertical;
     935           0 :         sal_Bool bIsDeep = false;
     936           0 :         mxDiagramPropertySet->getPropertyValue(DEEP) >>= bIsDeep;
     937             : 
     938           0 :         if (bIsDeep)
     939             :         {
     940           0 :             return _nDeep;
     941             :         }
     942             :         else
     943             :         {
     944           0 :             if (bIsVertical)
     945             :             {
     946           0 :                 return getStackedType(_nVertiStacked, _nVerti100PercentStacked, _nVertiUnStacked);
     947             :             }
     948             :             else
     949             :             {
     950           0 :                 return getStackedType(_nHoriStacked, _nHori100PercentStacked, _nHoriUnStacked);
     951             :             }
     952             :         }
     953             :     }
     954           0 :     catch (const uno::Exception&)
     955             :     {
     956           0 :         throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     957             :     }
     958             : }
     959             : 
     960             : 
     961             : sal_Int32
     962           0 : ScVbaChart::getStockUpDownValue(sal_Int32 _nUpDown, sal_Int32 _nNotUpDown) throw (script::BasicErrorException)
     963             : {
     964           0 :     sal_Bool bUpDown = false;
     965             :     try
     966             :     {
     967           0 :         mxDiagramPropertySet->getPropertyValue(UPDOWN) >>= bUpDown;
     968           0 :         if (bUpDown)
     969             :         {
     970           0 :             return _nUpDown;
     971             :         }
     972             :         else
     973             :         {
     974           0 :             return _nNotUpDown;
     975             :         }
     976             :     }
     977           0 :     catch (const uno::Exception&)
     978             :     {
     979           0 :         OUString aTemp;    // temporary needed for g++ 3.3.5
     980           0 :         script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     981             :     }
     982           0 :     return _nNotUpDown;
     983             : }
     984             : 
     985             : bool
     986           0 : ScVbaChart::hasMarkers() throw ( script::BasicErrorException )
     987             : {
     988           0 :     bool bHasMarkers = false;
     989             :     try
     990             :     {
     991           0 :         sal_Int32 nSymbol=0;
     992           0 :         mxDiagramPropertySet->getPropertyValue(SYMBOLTYPE) >>= nSymbol;
     993           0 :         bHasMarkers = nSymbol != chart::ChartSymbolType::NONE;
     994             :     }
     995           0 :     catch (const uno::Exception&)
     996             :     {
     997           0 :         OUString aTemp;    // temporary needed for g++ 3.3.5
     998           0 :         script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     999             :     }
    1000           0 :     return bHasMarkers;
    1001             : }
    1002             : 
    1003             : sal_Int32
    1004           0 : ScVbaChart::getMarkerType(sal_Int32 _nWithMarkers, sal_Int32 _nWithoutMarkers) throw ( script::BasicErrorException )
    1005             : {
    1006           0 :     if (hasMarkers())
    1007           0 :         return _nWithMarkers;
    1008           0 :     return _nWithoutMarkers;
    1009             : }
    1010             : 
    1011             : void
    1012           0 : ScVbaChart::assignDiagramAttributes()
    1013             : {
    1014           0 :     xAxisXSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
    1015           0 :     xAxisYSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
    1016           0 :     xAxisZSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
    1017           0 :     xTwoAxisXSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
    1018           0 :     xTwoAxisYSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
    1019           0 : }
    1020             : 
    1021             : 
    1022             : uno::Reference< beans::XPropertySet >
    1023           0 : ScVbaChart::getAxisPropertySet(sal_Int32 _nAxisType, sal_Int32 _nAxisGroup) throw ( script::BasicErrorException )
    1024             : {
    1025           0 :     assignDiagramAttributes();
    1026           0 :     uno::Reference< beans::XPropertySet > xAxisProps;
    1027           0 :     switch(_nAxisType)
    1028             :     {
    1029             :         case xlCategory:
    1030           0 :             if (_nAxisGroup == xlPrimary)
    1031             :             {
    1032           0 :                 xAxisProps = xAxisXSupplier->getXAxis();
    1033             :             }
    1034           0 :             else if (_nAxisGroup == xlSecondary)
    1035             :             {
    1036           0 :                 xAxisProps = xTwoAxisXSupplier->getSecondaryXAxis();
    1037             :             }
    1038           0 :             break;
    1039             :         case xlSeriesAxis:
    1040           0 :             xAxisProps = xAxisZSupplier->getZAxis();
    1041           0 :             break;
    1042             :         case xlValue:
    1043           0 :             if (_nAxisGroup == xlPrimary)
    1044           0 :                 xAxisProps = xAxisYSupplier->getYAxis();
    1045           0 :             else if (_nAxisGroup == xlSecondary)
    1046           0 :                 xAxisProps = xTwoAxisYSupplier->getSecondaryYAxis();
    1047           0 :             break;
    1048             :         default:
    1049           0 :             return xAxisProps;
    1050             :         }
    1051           0 :     return xAxisProps;
    1052             : }
    1053             : 
    1054             : 
    1055             : OUString
    1056           0 : ScVbaChart::getServiceImplName()
    1057             : {
    1058           0 :     return OUString("ScVbaChart");
    1059             : }
    1060             : 
    1061             : uno::Sequence< OUString >
    1062           0 : ScVbaChart::getServiceNames()
    1063             : {
    1064           0 :     static uno::Sequence< OUString > aServiceNames;
    1065           0 :     if ( aServiceNames.getLength() == 0 )
    1066             :     {
    1067           0 :         aServiceNames.realloc( 1 );
    1068           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.Chart";
    1069             :     }
    1070           0 :     return aServiceNames;
    1071           0 : }
    1072             : 
    1073             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10