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

Generated by: LCOV version 1.10