LCOV - code coverage report
Current view: top level - chart2/source/controller/dialogs - TitleDialogData.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 40 0.0 %
Date: 2014-04-11 Functions: 0 3 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 "TitleDialogData.hxx"
      21             : #include "TitleHelper.hxx"
      22             : #include "ChartModelHelper.hxx"
      23             : #include "AxisHelper.hxx"
      24             : 
      25             : namespace chart
      26             : {
      27             : using namespace ::com::sun::star;
      28             : using namespace ::com::sun::star::chart2;
      29             : 
      30           0 : TitleDialogData::TitleDialogData( ReferenceSizeProvider* pRefSizeProvider )
      31             :         : aPossibilityList(7)
      32             :         , aExistenceList(7)
      33             :         , aTextList(7)
      34           0 :         , apReferenceSizeProvider( pRefSizeProvider )
      35             : {
      36           0 :     sal_Int32 nN = 0;
      37           0 :     for(nN=7;nN--;)
      38           0 :         aPossibilityList[nN]=sal_True;
      39           0 :     for(nN=7;nN--;)
      40           0 :         aExistenceList[nN]=sal_False;
      41           0 : }
      42             : 
      43           0 : void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChartModel )
      44             : {
      45           0 :     uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(xChartModel);
      46             : 
      47             :     //get possibilities
      48           0 :     uno::Sequence< sal_Bool > aAxisPossibilityList;
      49           0 :     AxisHelper::getAxisOrGridPossibilities( aAxisPossibilityList, xDiagram );
      50           0 :     this->aPossibilityList[2]=aAxisPossibilityList[0];//x axis title
      51           0 :     this->aPossibilityList[3]=aAxisPossibilityList[1];//y axis title
      52           0 :     this->aPossibilityList[4]=aAxisPossibilityList[2];//z axis title
      53           0 :     this->aPossibilityList[5]=aAxisPossibilityList[3];//secondary x axis title
      54           0 :     this->aPossibilityList[6]=aAxisPossibilityList[4];//secondary y axis title
      55             : 
      56             :     //find out which title exsist and get their text
      57             :     //main title:
      58           0 :     for( sal_Int32 nTitleIndex = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN);
      59             :          nTitleIndex < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
      60             :          nTitleIndex++)
      61             :     {
      62             :         uno::Reference< XTitle > xTitle =  TitleHelper::getTitle(
      63           0 :             static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel );
      64           0 :         this->aExistenceList[nTitleIndex] = xTitle.is();
      65           0 :         this->aTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle );
      66           0 :     }
      67           0 : }
      68             : 
      69           0 : bool TitleDialogData::writeDifferenceToModel(
      70             :                           const uno::Reference< frame::XModel >& xChartModel
      71             :                         , const uno::Reference< uno::XComponentContext >& xContext
      72             :                         , TitleDialogData* pOldState )
      73             : {
      74           0 :     bool bChanged = false;
      75           0 :     for( sal_Int32 nN = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN );
      76             :          nN < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
      77             :          nN++)
      78             :     {
      79           0 :         if( !pOldState || ( pOldState->aExistenceList[nN] != this->aExistenceList[nN] ) )
      80             :         {
      81           0 :             if(this->aExistenceList[nN])
      82             :             {
      83             :                 TitleHelper::createTitle(
      84           0 :                     static_cast< TitleHelper::eTitleType >( nN ), this->aTextList[nN], xChartModel, xContext,
      85           0 :                     apReferenceSizeProvider.get() );
      86           0 :                 bChanged = true;
      87             :             }
      88             :             else
      89             :             {
      90           0 :                 TitleHelper::removeTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel );
      91           0 :                 bChanged = true;
      92             :             }
      93             :         }
      94           0 :         else if( !pOldState || ( pOldState->aTextList[nN] != this->aTextList[nN] ) )
      95             :         {
      96             :             //change content
      97             :             uno::Reference< XTitle > xTitle(
      98           0 :                 TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) );
      99           0 :             if(xTitle.is())
     100             :             {
     101           0 :                 TitleHelper::setCompleteString( this->aTextList[nN], xTitle, xContext );
     102           0 :                 bChanged = true;
     103           0 :             }
     104             :         }
     105             :     }
     106           0 :     return bChanged;
     107             : }
     108             : 
     109             : } //namespace chart
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10