LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - AxisWrapper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 251 0.0 %
Date: 2014-04-14 Functions: 0 34 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             : 
      20             : #include "AxisWrapper.hxx"
      21             : #include "AxisHelper.hxx"
      22             : #include "TitleHelper.hxx"
      23             : #include "Chart2ModelContact.hxx"
      24             : #include "ContainerHelper.hxx"
      25             : #include "macros.hxx"
      26             : #include "WrappedDirectStateProperty.hxx"
      27             : #include "GridWrapper.hxx"
      28             : #include "TitleWrapper.hxx"
      29             : #include "DisposeHelper.hxx"
      30             : 
      31             : #include <comphelper/InlineContainer.hxx>
      32             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      33             : #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
      34             : #include <com/sun/star/chart/ChartAxisPosition.hpp>
      35             : #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
      36             : #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
      37             : 
      38             : #include "CharacterProperties.hxx"
      39             : #include "LinePropertiesHelper.hxx"
      40             : #include "UserDefinedProperties.hxx"
      41             : #include "WrappedCharacterHeightProperty.hxx"
      42             : #include "WrappedTextRotationProperty.hxx"
      43             : #include "WrappedGapwidthProperty.hxx"
      44             : #include "WrappedScaleProperty.hxx"
      45             : #include "WrappedDefaultProperty.hxx"
      46             : #include "WrappedNumberFormatProperty.hxx"
      47             : #include "WrappedScaleTextProperties.hxx"
      48             : 
      49             : #include <algorithm>
      50             : #include <rtl/ustrbuf.hxx>
      51             : #include <rtl/math.hxx>
      52             : 
      53             : using namespace ::com::sun::star;
      54             : using namespace ::com::sun::star::chart2;
      55             : using namespace ::chart::ContainerHelper;
      56             : 
      57             : using ::com::sun::star::beans::Property;
      58             : using ::osl::MutexGuard;
      59             : using ::com::sun::star::uno::Reference;
      60             : using ::com::sun::star::uno::Sequence;
      61             : using ::com::sun::star::uno::Any;
      62             : 
      63             : namespace
      64             : {
      65           0 : static const OUString lcl_aServiceName( "com.sun.star.comp.chart.Axis" );
      66             : 
      67             : enum
      68             : {
      69             :     PROP_AXIS_MAX,
      70             :     PROP_AXIS_MIN,
      71             :     PROP_AXIS_STEPMAIN,
      72             :     PROP_AXIS_STEPHELP, //deprecated property use 'StepHelpCount' instead
      73             :     PROP_AXIS_STEPHELP_COUNT,
      74             :     PROP_AXIS_AUTO_MAX,
      75             :     PROP_AXIS_AUTO_MIN,
      76             :     PROP_AXIS_AUTO_STEPMAIN,
      77             :     PROP_AXIS_AUTO_STEPHELP,
      78             :     PROP_AXIS_TYPE,
      79             :     PROP_AXIS_TIME_INCREMENT,
      80             :     PROP_AXIS_EXPLICIT_TIME_INCREMENT,
      81             :     PROP_AXIS_LOGARITHMIC,
      82             :     PROP_AXIS_REVERSEDIRECTION,
      83             :     PROP_AXIS_VISIBLE,
      84             :     PROP_AXIS_CROSSOVER_POSITION,
      85             :     PROP_AXIS_CROSSOVER_VALUE,
      86             :     PROP_AXIS_ORIGIN,
      87             :     PROP_AXIS_AUTO_ORIGIN,
      88             :     PROP_AXIS_MARKS,
      89             :     PROP_AXIS_HELPMARKS,
      90             :     PROP_AXIS_MARK_POSITION,
      91             :     PROP_AXIS_DISPLAY_LABELS,
      92             :     PROP_AXIS_NUMBERFORMAT,
      93             :     PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
      94             :     PROP_AXIS_LABEL_POSITION,
      95             :     PROP_AXIS_TEXT_ROTATION,
      96             :     PROP_AXIS_ARRANGE_ORDER,
      97             :     PROP_AXIS_TEXTBREAK,
      98             :     PROP_AXIS_CAN_OVERLAP,
      99             :     PROP_AXIS_STACKEDTEXT,
     100             :     PROP_AXIS_OVERLAP,
     101             :     PROP_AXIS_GAP_WIDTH,
     102             :     PROP_AXIS_DISPLAY_UNITS,
     103             :     PROP_AXIS_BUILTINUNIT
     104             : };
     105             : 
     106           0 : void lcl_AddPropertiesToVector(
     107             :     ::std::vector< Property > & rOutProperties )
     108             : {
     109             :     //Properties for scaling:
     110             :     rOutProperties.push_back(
     111             :         Property( "Max",
     112             :                   PROP_AXIS_MAX,
     113           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     114             :                   beans::PropertyAttribute::BOUND
     115           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     116             : 
     117             :     rOutProperties.push_back(
     118             :         Property( "Min",
     119             :                   PROP_AXIS_MIN,
     120           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     121             :                   beans::PropertyAttribute::BOUND
     122           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     123             : 
     124             :     rOutProperties.push_back(
     125             :         Property( "StepMain",
     126             :                   PROP_AXIS_STEPMAIN,
     127           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     128             :                   beans::PropertyAttribute::BOUND
     129           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     130             : 
     131             :     rOutProperties.push_back(
     132             :         Property( "StepHelpCount",
     133             :                   PROP_AXIS_STEPHELP_COUNT,
     134           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     135             :                   beans::PropertyAttribute::BOUND
     136           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     137             : 
     138             :     //deprecated property use 'StepHelpCount' instead
     139             :     rOutProperties.push_back(
     140             :         Property( "StepHelp",
     141             :                   PROP_AXIS_STEPHELP,
     142           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     143             :                   beans::PropertyAttribute::BOUND
     144           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     145             : 
     146             :     rOutProperties.push_back(
     147             :         Property( "AutoMax",
     148             :                   PROP_AXIS_AUTO_MAX,
     149           0 :                   ::getBooleanCppuType(),
     150             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     151           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     152             : 
     153             :     rOutProperties.push_back(
     154             :         Property( "AutoMin",
     155             :                   PROP_AXIS_AUTO_MIN,
     156           0 :                   ::getBooleanCppuType(),
     157             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     158           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     159             : 
     160             :     rOutProperties.push_back(
     161             :         Property( "AutoStepMain",
     162             :                   PROP_AXIS_AUTO_STEPMAIN,
     163           0 :                   ::getBooleanCppuType(),
     164             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     165           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     166             : 
     167             :     rOutProperties.push_back(
     168             :         Property( "AutoStepHelp",
     169             :                   PROP_AXIS_AUTO_STEPHELP,
     170           0 :                   ::getBooleanCppuType(),
     171             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     172           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     173             : 
     174             :     rOutProperties.push_back(
     175             :         Property( "AxisType",
     176             :                   PROP_AXIS_TYPE,
     177           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), //type com::sun::star::chart::ChartAxisType
     178             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     179           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     180             : 
     181             :     rOutProperties.push_back(
     182             :         Property( "TimeIncrement",
     183             :                   PROP_AXIS_TIME_INCREMENT,
     184           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)),
     185             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     186           0 :                   beans::PropertyAttribute::MAYBEVOID ));
     187             : 
     188             :     rOutProperties.push_back(
     189             :         Property( "ExplicitTimeIncrement",
     190             :                   PROP_AXIS_EXPLICIT_TIME_INCREMENT,
     191           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)),
     192             :                   beans::PropertyAttribute::READONLY |
     193           0 :                   beans::PropertyAttribute::MAYBEVOID ));
     194             : 
     195             :     rOutProperties.push_back(
     196             :         Property( "Logarithmic",
     197             :                   PROP_AXIS_LOGARITHMIC,
     198           0 :                   ::getBooleanCppuType(),
     199             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     200           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     201             : 
     202             :     rOutProperties.push_back(
     203             :         Property( "ReverseDirection",
     204             :                   PROP_AXIS_REVERSEDIRECTION,
     205           0 :                   ::getBooleanCppuType(),
     206             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     207           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     208             : 
     209             :     //todo: this property is missing in the API
     210             :     rOutProperties.push_back(
     211             :         Property( "Visible",
     212             :                   PROP_AXIS_VISIBLE,
     213           0 :                   ::getBooleanCppuType(),
     214             :                   beans::PropertyAttribute::BOUND
     215           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     216             : 
     217             :     rOutProperties.push_back(
     218             :         Property( "CrossoverPosition",
     219             :                   PROP_AXIS_CROSSOVER_POSITION,
     220           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)),
     221           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     222             : 
     223             :     rOutProperties.push_back(
     224             :         Property( "CrossoverValue",
     225             :                   PROP_AXIS_CROSSOVER_VALUE,
     226           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     227           0 :                   beans::PropertyAttribute::MAYBEVOID ));
     228             : 
     229             :     rOutProperties.push_back(
     230             :         Property( "Origin",
     231             :                   PROP_AXIS_ORIGIN,
     232           0 :                   ::getCppuType( reinterpret_cast< const double * >(0)),
     233             :                   beans::PropertyAttribute::BOUND
     234           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     235             : 
     236             :     rOutProperties.push_back(
     237             :         Property( "AutoOrigin",
     238             :                   PROP_AXIS_AUTO_ORIGIN,
     239           0 :                   ::getBooleanCppuType(),
     240             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     241           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     242             : 
     243             :     //Properties for interval marks:
     244             :     rOutProperties.push_back(
     245             :         Property( "Marks",
     246             :                   PROP_AXIS_MARKS,
     247           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     248             :                   beans::PropertyAttribute::BOUND
     249           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     250             : 
     251             :     rOutProperties.push_back(
     252             :         Property( "HelpMarks",
     253             :                   PROP_AXIS_HELPMARKS,
     254           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     255             :                   beans::PropertyAttribute::BOUND
     256           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     257             : 
     258             :     rOutProperties.push_back(
     259             :         Property( "MarkPosition",
     260             :                   PROP_AXIS_MARK_POSITION,
     261           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)),
     262           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     263             : 
     264             :     //Properties for labels:
     265             :     rOutProperties.push_back(
     266             :         Property( "DisplayLabels",
     267             :                   PROP_AXIS_DISPLAY_LABELS,
     268           0 :                   ::getBooleanCppuType(),
     269             :                   beans::PropertyAttribute::BOUND
     270           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     271             : 
     272             :     rOutProperties.push_back(
     273             :         Property( "NumberFormat",
     274             :                   PROP_AXIS_NUMBERFORMAT,
     275           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     276             :                   beans::PropertyAttribute::BOUND
     277           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     278             : 
     279             :     rOutProperties.push_back(
     280             :         Property( "LinkNumberFormatToSource",
     281             :                   PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
     282           0 :                   ::getBooleanCppuType(),
     283             :                   beans::PropertyAttribute::BOUND
     284           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     285             : 
     286             :     rOutProperties.push_back(
     287             :         Property( "LabelPosition",
     288             :                   PROP_AXIS_LABEL_POSITION,
     289           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)),
     290           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     291             : 
     292             :     rOutProperties.push_back(
     293             :         Property( "TextRotation",
     294             :                   PROP_AXIS_TEXT_ROTATION,
     295           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     296             :                   beans::PropertyAttribute::BOUND
     297           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     298             : 
     299             :     rOutProperties.push_back(
     300             :         Property( "ArrangeOrder",
     301             :                   PROP_AXIS_ARRANGE_ORDER,
     302           0 :                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisArrangeOrderType * >(0)),
     303             :                   beans::PropertyAttribute::BOUND
     304           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     305             : 
     306             :     rOutProperties.push_back(
     307             :         Property( "TextBreak",
     308             :                   PROP_AXIS_TEXTBREAK,
     309           0 :                   ::getBooleanCppuType(),
     310             :                   beans::PropertyAttribute::BOUND
     311           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     312             : 
     313             :     rOutProperties.push_back(
     314             :         Property( "TextCanOverlap",
     315             :                   PROP_AXIS_CAN_OVERLAP,
     316           0 :                   ::getBooleanCppuType(),
     317             :                   beans::PropertyAttribute::BOUND
     318           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     319             : 
     320             :     rOutProperties.push_back(
     321             :         Property( "StackedText",
     322             :                   PROP_AXIS_STACKEDTEXT,
     323           0 :                   ::getBooleanCppuType(),
     324             :                   beans::PropertyAttribute::BOUND
     325           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     326             : 
     327             :     // Properties related to bar charts:
     328             :     rOutProperties.push_back(
     329             :         Property( "Overlap",
     330             :                   PROP_AXIS_OVERLAP,
     331           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     332             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     333           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     334             : 
     335             :     rOutProperties.push_back(
     336             :         Property( "GapWidth",
     337             :                   PROP_AXIS_GAP_WIDTH,
     338           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     339             :                   //#i111967# no PropertyChangeEvent is fired on change so far
     340           0 :                   beans::PropertyAttribute::MAYBEDEFAULT ));
     341             : 
     342             :     //Properties for display units:
     343             :     rOutProperties.push_back(
     344             :         Property( "DisplayUnits",
     345             :                   PROP_AXIS_DISPLAY_UNITS,
     346           0 :                   ::getBooleanCppuType(),
     347             :                   beans::PropertyAttribute::BOUND
     348           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     349             : 
     350             :     //Properties for labels:
     351             :     rOutProperties.push_back(
     352             :         Property( "BuiltInUnit",
     353             :                   PROP_AXIS_BUILTINUNIT,
     354           0 :                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
     355             :                   beans::PropertyAttribute::BOUND
     356           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     357           0 : }
     358             : 
     359             : struct StaticAxisWrapperPropertyArray_Initializer
     360             : {
     361           0 :     Sequence< Property >* operator()()
     362             :     {
     363           0 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
     364           0 :         return &aPropSeq;
     365             :     }
     366             : 
     367             : private:
     368           0 :     Sequence< Property > lcl_GetPropertySequence()
     369             :     {
     370           0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
     371           0 :         lcl_AddPropertiesToVector( aProperties );
     372           0 :         ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
     373           0 :         ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
     374           0 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
     375           0 :         ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
     376             : 
     377             :         ::std::sort( aProperties.begin(), aProperties.end(),
     378           0 :                      ::chart::PropertyNameLess() );
     379             : 
     380           0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
     381             :     }
     382             : };
     383             : 
     384             : struct StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer >
     385             : {
     386             : };
     387             : 
     388             : } // anonymous namespace
     389             : 
     390             : namespace chart
     391             : {
     392             : namespace wrapper
     393             : {
     394             : 
     395           0 : AxisWrapper::AxisWrapper(
     396             :     tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
     397             :         m_spChart2ModelContact( spChart2ModelContact ),
     398             :         m_aEventListenerContainer( m_aMutex ),
     399           0 :         m_eType( eType )
     400             : {
     401           0 : }
     402             : 
     403           0 : AxisWrapper::~AxisWrapper()
     404             : {
     405           0 : }
     406             : 
     407             : // ____ chart::XAxis ____
     408           0 : Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle() throw (uno::RuntimeException, std::exception)
     409             : {
     410           0 :     if( !m_xAxisTitle.is() )
     411             :     {
     412           0 :         TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE    );
     413           0 :         switch( m_eType )
     414             :         {
     415             :             case X_AXIS:
     416           0 :                 eTitleType = TitleHelper::X_AXIS_TITLE;
     417           0 :                 break;
     418             :             case Y_AXIS:
     419           0 :                 eTitleType = TitleHelper::Y_AXIS_TITLE;
     420           0 :                 break;
     421             :             case Z_AXIS:
     422           0 :                 eTitleType = TitleHelper::Z_AXIS_TITLE;
     423           0 :                 break;
     424             :             case SECOND_X_AXIS:
     425           0 :                 eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
     426           0 :                 break;
     427             :             case SECOND_Y_AXIS:
     428           0 :                 eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
     429           0 :                 break;
     430             :             default:
     431           0 :                 return 0;
     432             :         }
     433           0 :         m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact );
     434             :     }
     435           0 :     return m_xAxisTitle;
     436             : }
     437           0 : Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid() throw (uno::RuntimeException, std::exception)
     438             : {
     439           0 :     if( !m_xMajorGrid.is() )
     440             :     {
     441           0 :         GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
     442           0 :         switch( m_eType )
     443             :         {
     444             :             case X_AXIS:
     445           0 :                 eGridType = GridWrapper::X_MAJOR_GRID;
     446           0 :                 break;
     447             :             case Y_AXIS:
     448           0 :                 eGridType = GridWrapper::Y_MAJOR_GRID;
     449           0 :                 break;
     450             :             case Z_AXIS:
     451           0 :                 eGridType = GridWrapper::Z_MAJOR_GRID;
     452           0 :                 break;
     453             :             default:
     454           0 :                 return 0;
     455             :         }
     456           0 :         m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
     457             :     }
     458           0 :     return m_xMajorGrid;
     459             : }
     460           0 : Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid() throw (uno::RuntimeException, std::exception)
     461             : {
     462           0 :     if( !m_xMinorGrid.is() )
     463             :     {
     464           0 :         GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
     465           0 :         switch( m_eType )
     466             :         {
     467             :             case X_AXIS:
     468           0 :                 eGridType = GridWrapper::X_MINOR_GRID;
     469           0 :                 break;
     470             :             case Y_AXIS:
     471           0 :                 eGridType = GridWrapper::Y_MINOR_GRID;
     472           0 :                 break;
     473             :             case Z_AXIS:
     474           0 :                 eGridType = GridWrapper::Z_MINOR_GRID;
     475           0 :                 break;
     476             :             default:
     477           0 :                 return 0;
     478             :         }
     479           0 :         m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
     480             :     }
     481           0 :     return m_xMinorGrid;
     482             : }
     483             : 
     484             : // ____ XShape ____
     485           0 : awt::Point SAL_CALL AxisWrapper::getPosition()
     486             :     throw (uno::RuntimeException, std::exception)
     487             : {
     488           0 :     awt::Point aResult( m_spChart2ModelContact->GetAxisPosition( this->getAxis() ) );
     489           0 :     return aResult;
     490             : }
     491             : 
     492           0 : void SAL_CALL AxisWrapper::setPosition( const awt::Point& /*aPosition*/ )
     493             :     throw (uno::RuntimeException, std::exception)
     494             : {
     495             :     OSL_FAIL( "trying to set position of Axis" );
     496           0 : }
     497             : 
     498           0 : awt::Size SAL_CALL AxisWrapper::getSize()
     499             :     throw (uno::RuntimeException, std::exception)
     500             : {
     501           0 :     awt::Size aSize( m_spChart2ModelContact->GetAxisSize( this->getAxis() ) );
     502           0 :     return aSize;
     503             : }
     504             : 
     505           0 : void SAL_CALL AxisWrapper::setSize( const awt::Size& /*aSize*/ )
     506             :     throw (beans::PropertyVetoException,
     507             :            uno::RuntimeException, std::exception)
     508             : {
     509             :     OSL_FAIL( "trying to set size of Axis" );
     510           0 : }
     511             : 
     512             : // ____ XShapeDescriptor (base of XShape) ____
     513           0 : OUString SAL_CALL AxisWrapper::getShapeType()
     514             :     throw (uno::RuntimeException, std::exception)
     515             : {
     516           0 :     return OUString("com.sun.star.chart.ChartAxis");
     517             : }
     518             : 
     519             : // ____ XNumberFormatsSupplier ____
     520           0 : uno::Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getNumberFormatSettings()
     521             :     throw (uno::RuntimeException, std::exception)
     522             : {
     523           0 :     Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
     524           0 :     if( xNumSuppl.is() )
     525           0 :         return xNumSuppl->getNumberFormatSettings();
     526             : 
     527           0 :     return uno::Reference< beans::XPropertySet >();
     528             : }
     529             : 
     530           0 : uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats()
     531             :     throw (uno::RuntimeException, std::exception)
     532             : {
     533           0 :     Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
     534           0 :     if( xNumSuppl.is() )
     535           0 :         return xNumSuppl->getNumberFormats();
     536             : 
     537           0 :     return uno::Reference< util::XNumberFormats >();
     538             : }
     539             : 
     540           0 : void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis )
     541             : {
     542           0 :     switch( eType )
     543             :     {
     544             :         case X_AXIS:
     545           0 :             rnDimensionIndex = 0; rbMainAxis = sal_True; break;
     546             :         case Y_AXIS:
     547           0 :             rnDimensionIndex = 1; rbMainAxis = sal_True; break;
     548             :         case Z_AXIS:
     549           0 :             rnDimensionIndex = 2; rbMainAxis = sal_True; break;
     550             :         case SECOND_X_AXIS:
     551           0 :             rnDimensionIndex = 0; rbMainAxis = sal_False; break;
     552             :         case SECOND_Y_AXIS:
     553           0 :             rnDimensionIndex = 1; rbMainAxis = sal_False; break;
     554             :     }
     555           0 : }
     556             : 
     557             : // ____ XComponent ____
     558           0 : void SAL_CALL AxisWrapper::dispose()
     559             :     throw (uno::RuntimeException, std::exception)
     560             : {
     561           0 :     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
     562           0 :     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
     563             : 
     564           0 :     DisposeHelper::DisposeAndClear( m_xAxisTitle );
     565           0 :     DisposeHelper::DisposeAndClear( m_xMajorGrid );
     566           0 :     DisposeHelper::DisposeAndClear( m_xMinorGrid );
     567             : 
     568           0 :     clearWrappedPropertySet();
     569           0 : }
     570             : 
     571           0 : void SAL_CALL AxisWrapper::addEventListener(
     572             :     const Reference< lang::XEventListener >& xListener )
     573             :     throw (uno::RuntimeException, std::exception)
     574             : {
     575           0 :     m_aEventListenerContainer.addInterface( xListener );
     576           0 : }
     577             : 
     578           0 : void SAL_CALL AxisWrapper::removeEventListener(
     579             :     const Reference< lang::XEventListener >& aListener )
     580             :     throw (uno::RuntimeException, std::exception)
     581             : {
     582           0 :     m_aEventListenerContainer.removeInterface( aListener );
     583           0 : }
     584             : 
     585             : //ReferenceSizePropertyProvider
     586           0 : void AxisWrapper::updateReferenceSize()
     587             : {
     588           0 :     Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
     589           0 :     if( xProp.is() )
     590             :     {
     591           0 :         if( xProp->getPropertyValue("ReferencePageSize").hasValue() )
     592           0 :             xProp->setPropertyValue("ReferencePageSize", uno::makeAny(
     593           0 :             m_spChart2ModelContact->GetPageSize() ));
     594           0 :     }
     595           0 : }
     596           0 : Any AxisWrapper::getReferenceSize()
     597             : {
     598           0 :     Any aRet;
     599           0 :     Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
     600           0 :     if( xProp.is() )
     601           0 :         aRet = xProp->getPropertyValue("ReferencePageSize");
     602           0 :     return aRet;
     603             : }
     604           0 : awt::Size AxisWrapper::getCurrentSizeForReference()
     605             : {
     606           0 :     return m_spChart2ModelContact->GetPageSize();
     607             : }
     608             : 
     609           0 : Reference< chart2::XAxis > AxisWrapper::getAxis()
     610             : {
     611           0 :     Reference< chart2::XAxis > xAxis;
     612             :     try
     613             :     {
     614           0 :         sal_Int32 nDimensionIndex = 0;
     615           0 :         sal_Bool  bMainAxis = sal_True;
     616           0 :         AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
     617             : 
     618           0 :         Reference< XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     619           0 :         xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
     620           0 :         if( !xAxis.is() )
     621             :         {
     622           0 :             xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, m_spChart2ModelContact->m_xContext );
     623           0 :             Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
     624           0 :             if( xProp.is() )
     625           0 :                 xProp->setPropertyValue("Show", uno::makeAny( sal_False ) );
     626           0 :         }
     627             :     }
     628           0 :     catch( const uno::Exception & ex )
     629             :     {
     630             :         ASSERT_EXCEPTION( ex );
     631             :     }
     632           0 :     return xAxis;
     633             : }
     634             : 
     635             : // WrappedPropertySet
     636           0 : Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
     637             : {
     638           0 :     return Reference< beans::XPropertySet >( this->getAxis(), uno::UNO_QUERY );
     639             : }
     640             : 
     641           0 : const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
     642             : {
     643           0 :     return *StaticAxisWrapperPropertyArray::get();
     644             : }
     645             : 
     646           0 : const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties()
     647             : {
     648           0 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     649             : 
     650           0 :     aWrappedProperties.push_back( new WrappedTextRotationProperty() );
     651           0 :     aWrappedProperties.push_back( new WrappedProperty("Marks","MajorTickmarks") );
     652           0 :     aWrappedProperties.push_back( new WrappedProperty("HelpMarks","MinorTickmarks") );
     653           0 :     aWrappedProperties.push_back( new WrappedProperty("TextCanOverlap","TextOverlap") );
     654           0 :     aWrappedProperties.push_back( new WrappedProperty("ArrangeOrder","ArrangeOrder") );
     655           0 :     aWrappedProperties.push_back( new WrappedProperty("Visible","Show") );
     656           0 :     aWrappedProperties.push_back( new WrappedDirectStateProperty("DisplayLabels","DisplayLabels") );
     657           0 :     aWrappedProperties.push_back( new WrappedDirectStateProperty("TextBreak","TextBreak") );
     658           0 :     WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
     659           0 :     aWrappedProperties.push_back( pWrappedNumberFormatProperty );
     660           0 :     aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
     661           0 :     aWrappedProperties.push_back( new WrappedProperty("StackedText","StackCharacters") );
     662           0 :     aWrappedProperties.push_back( new WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") );
     663             :     {
     664           0 :         WrappedGapwidthProperty* pWrappedGapwidthProperty( new WrappedGapwidthProperty( m_spChart2ModelContact ) );
     665           0 :         WrappedBarOverlapProperty* pWrappedBarOverlapProperty( new WrappedBarOverlapProperty( m_spChart2ModelContact ) );
     666           0 :         sal_Int32 nDimensionIndex = 0;
     667           0 :         sal_Bool  bMainAxis = sal_True;
     668           0 :         sal_Int32 nAxisIndex = 0;
     669           0 :         AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
     670           0 :         if( !bMainAxis )
     671           0 :             nAxisIndex = 1;
     672           0 :         pWrappedGapwidthProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
     673           0 :         pWrappedBarOverlapProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
     674           0 :         aWrappedProperties.push_back( pWrappedGapwidthProperty );
     675           0 :         aWrappedProperties.push_back( pWrappedBarOverlapProperty );
     676             :     }
     677             : 
     678           0 :     WrappedScaleProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
     679             : 
     680           0 :     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     681           0 :     WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
     682             : 
     683           0 :     return aWrappedProperties;
     684             : }
     685             : 
     686           0 : Sequence< OUString > AxisWrapper::getSupportedServiceNames_Static()
     687             : {
     688           0 :     Sequence< OUString > aServices( 3 );
     689           0 :     aServices[ 0 ] = "com.sun.star.chart.ChartAxis";
     690           0 :     aServices[ 1 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
     691           0 :     aServices[ 2 ] = "com.sun.star.style.CharacterProperties";
     692             : 
     693           0 :     return aServices;
     694             : }
     695             : 
     696             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     697           0 : APPHELPER_XSERVICEINFO_IMPL( AxisWrapper, lcl_aServiceName );
     698             : 
     699             : } //  namespace wrapper
     700           0 : } //  namespace chart
     701             : 
     702             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10