LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/dialogs - dlg_InsertErrorBars.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-12-27 Functions: 0 7 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 "dlg_InsertErrorBars.hxx"
      22             : #include "dlg_InsertErrorBars.hrc"
      23             : #include "res_ErrorBar.hxx"
      24             : #include "ResourceIds.hrc"
      25             : #include "ResId.hxx"
      26             : #include "Strings.hrc"
      27             : #include "chartview/ExplicitValueProvider.hxx"
      28             : #include "ChartModelHelper.hxx"
      29             : #include "ObjectIdentifier.hxx"
      30             : #include "DiagramHelper.hxx"
      31             : #include "AxisHelper.hxx"
      32             : #include "ObjectNameProvider.hxx"
      33             : 
      34             : #include <com/sun/star/chart2/XAxis.hpp>
      35             : #include <com/sun/star/chart2/XDiagram.hpp>
      36             : 
      37             : using ::rtl::OUString;
      38             : using ::com::sun::star::uno::Reference;
      39             : using namespace ::com::sun::star;
      40             : using namespace ::com::sun::star::chart2;
      41             : 
      42             : //.............................................................................
      43             : namespace chart
      44             : {
      45             : //.............................................................................
      46             : 
      47           0 : InsertErrorBarsDialog::InsertErrorBarsDialog(
      48             :     Window* pParent, const SfxItemSet& rMyAttrs,
      49             :     const uno::Reference< chart2::XChartDocument > & xChartDocument,
      50             :     ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) :
      51             :         ModalDialog( pParent, SchResId( DLG_DATA_YERRORBAR )),
      52             :         rInAttrs( rMyAttrs ),
      53             :         aBtnOK( this, SchResId( BTN_OK )),
      54             :         aBtnCancel( this, SchResId( BTN_CANCEL )),
      55             :         aBtnHelp( this, SchResId( BTN_HELP )),
      56             :         m_apErrorBarResources( new ErrorBarResources(
      57             :                                    this, this, rInAttrs,
      58           0 :                                    /* bNoneAvailable = */ true, eType ))
      59             : {
      60           0 :     FreeResource();
      61           0 :     ObjectType objType = eType == ErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X;
      62             : 
      63           0 :     this->SetText( ObjectNameProvider::getName_ObjectForAllSeries(objType) );
      64             : 
      65           0 :     m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
      66           0 : }
      67             : 
      68           0 : InsertErrorBarsDialog::~InsertErrorBarsDialog()
      69             : {
      70           0 : }
      71             : 
      72           0 : void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
      73             : {
      74           0 :     m_apErrorBarResources->FillItemSet(rOutAttrs);
      75           0 : }
      76             : 
      77           0 : void InsertErrorBarsDialog::DataChanged( const DataChangedEvent& rDCEvt )
      78             : {
      79           0 :     ModalDialog::DataChanged( rDCEvt );
      80             : 
      81           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
      82           0 :         m_apErrorBarResources->FillValueSets();
      83           0 : }
      84             : 
      85           0 : void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
      86             : {
      87           0 :     m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
      88           0 : }
      89             : 
      90           0 : double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
      91             :     const Reference< frame::XModel >& xChartModel,
      92             :     const Reference< uno::XInterface >& xChartView,
      93             :     const OUString& rSelectedObjectCID )
      94             : {
      95           0 :     double fStepWidth = 0.001;
      96             : 
      97           0 :     ExplicitValueProvider* pExplicitValueProvider( ExplicitValueProvider::getExplicitValueProvider(xChartView) );
      98           0 :     if( pExplicitValueProvider )
      99             :     {
     100           0 :         Reference< XAxis > xAxis;
     101           0 :         Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
     102           0 :         Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
     103           0 :         xAxis = DiagramHelper::getAttachedAxis( xSeries, xDiagram );
     104           0 :         if(!xAxis.is())
     105           0 :             xAxis = AxisHelper::getAxis( 1/*nDimensionIndex*/, true/*bMainAxis*/, xDiagram );
     106           0 :         if(xAxis.is())
     107             :         {
     108           0 :             ExplicitScaleData aExplicitScale;
     109           0 :             ExplicitIncrementData aExplicitIncrement;
     110           0 :             pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement );
     111             : 
     112           0 :             fStepWidth = aExplicitIncrement.Distance;
     113           0 :             if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
     114           0 :                 fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
     115             :             else
     116           0 :                 fStepWidth/=10;
     117           0 :         }
     118             :     }
     119             : 
     120           0 :     return fStepWidth;
     121             : }
     122             : 
     123             : //.............................................................................
     124             : } //namespace chart
     125             : //.............................................................................
     126             : 
     127             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10