LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/dialogs - tp_Wizard_TitlesAndObjects.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 68 0.0 %
Date: 2012-12-17 Functions: 0 9 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 "tp_Wizard_TitlesAndObjects.hxx"
      22             : #include "tp_Wizard_TitlesAndObjects.hrc"
      23             : #include "Strings.hrc"
      24             : #include "res_Titles.hxx"
      25             : #include "res_LegendPosition.hxx"
      26             : #include "ResId.hxx"
      27             : #include "HelpIds.hrc"
      28             : #include "macros.hxx"
      29             : #include "ChartModelHelper.hxx"
      30             : #include "AxisHelper.hxx"
      31             : #include "LegendHelper.hxx"
      32             : #include "NoWarningThisInCTOR.hxx"
      33             : #include "ControllerLockGuard.hxx"
      34             : 
      35             : //.............................................................................
      36             : namespace chart
      37             : {
      38             : //.............................................................................
      39             : using namespace ::com::sun::star;
      40             : using namespace ::com::sun::star::chart2;
      41             : 
      42             : 
      43           0 : TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
      44             :         , const uno::Reference< XChartDocument >& xChartModel
      45             :         , const uno::Reference< uno::XComponentContext >& xContext )
      46             :         : OWizardPage( pParent, SchResId(TP_WIZARD_TITLEANDOBJECTS) )
      47             :         , m_aFT_TitleDescription( this, SchResId( FT_TITLEDESCRIPTION ) )
      48             :         , m_aFL_Vertical( this, SchResId( FL_VERTICAL ) )
      49           0 :         , m_apTitleResources( new TitleResources(this,false) )
      50           0 :         , m_apLegendPositionResources( new LegendPositionResources(this,xContext) )
      51             :         , m_aFL_Grids( this, SchResId( FL_GRIDS ) )
      52             :         , m_aCB_Grid_X( this, SchResId( CB_X_SECONDARY ) )
      53             :         , m_aCB_Grid_Y( this, SchResId( CB_Y_SECONDARY ) )
      54             :         , m_aCB_Grid_Z( this, SchResId( CB_Z_SECONDARY ) )
      55             :         , m_xChartModel( xChartModel )
      56             :         , m_xCC( xContext )
      57             :         , m_bCommitToModel( true )
      58           0 :         , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
      59             : {
      60           0 :     FreeResource();
      61             : 
      62           0 :     this->SetText( String( SchResId( STR_PAGE_CHART_ELEMENTS ) ) );
      63             : 
      64           0 :     Font aFont( m_aFT_TitleDescription.GetControlFont() );
      65           0 :     aFont.SetWeight( WEIGHT_BOLD );
      66           0 :     m_aFT_TitleDescription.SetControlFont( aFont );
      67             : 
      68           0 :     m_aCB_Grid_X.SetHelpId( HID_SCH_CB_XGRID );
      69           0 :     m_aCB_Grid_Y.SetHelpId( HID_SCH_CB_YGRID );
      70           0 :     m_aCB_Grid_Z.SetHelpId( HID_SCH_CB_ZGRID );
      71             : 
      72           0 :     m_apTitleResources->SetUpdateDataHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
      73           0 :     m_apLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
      74             : 
      75           0 :     m_aCB_Grid_X.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
      76           0 :     m_aCB_Grid_Y.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
      77           0 :     m_aCB_Grid_Z.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
      78           0 : }
      79             : 
      80           0 : TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
      81             : {
      82           0 : }
      83             : 
      84           0 : void TitlesAndObjectsTabPage::initializePage()
      85             : {
      86           0 :     m_bCommitToModel = false;
      87             : 
      88             :     //init titles
      89             :     {
      90           0 :         TitleDialogData aTitleInput;
      91           0 :         aTitleInput.readFromModel( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
      92           0 :         m_apTitleResources->writeToResources( aTitleInput );
      93             :     }
      94             : 
      95             :     //init legend
      96             :     {
      97           0 :         m_apLegendPositionResources->writeToResources( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
      98             :     }
      99             : 
     100             :     //init grid checkboxes
     101             :     {
     102           0 :         uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel );
     103           0 :         uno::Sequence< sal_Bool > aPossibilityList;
     104           0 :         uno::Sequence< sal_Bool > aExistenceList;
     105           0 :         AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, sal_False );
     106           0 :         AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, sal_False );
     107           0 :         m_aCB_Grid_X.Enable( aPossibilityList[0] );
     108           0 :         m_aCB_Grid_Y.Enable( aPossibilityList[1] );
     109           0 :         m_aCB_Grid_Z.Enable( aPossibilityList[2] );
     110           0 :         m_aCB_Grid_X.Check( aExistenceList[0] );
     111           0 :         m_aCB_Grid_Y.Check( aExistenceList[1] );
     112           0 :         m_aCB_Grid_Z.Check( aExistenceList[2] );
     113             :     }
     114             : 
     115           0 :     m_bCommitToModel = true;
     116           0 : }
     117             : 
     118           0 : sal_Bool TitlesAndObjectsTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
     119             : {
     120           0 :     if( m_apTitleResources->IsModified() ) //titles may have changed in the meanwhile
     121           0 :         commitToModel();
     122           0 :     return sal_True;//return false if this page should not be left
     123             : }
     124             : 
     125           0 : void TitlesAndObjectsTabPage::commitToModel()
     126             : {
     127           0 :     m_aTimerTriggeredControllerLock.startTimer();
     128           0 :     uno::Reference< frame::XModel >  xModel( m_xChartModel, uno::UNO_QUERY);
     129             : 
     130           0 :     ControllerLockGuard aLockedControllers( xModel );
     131             : 
     132             :     //commit title changes to model
     133             :     {
     134           0 :         TitleDialogData aTitleOutput;
     135           0 :         m_apTitleResources->readFromResources( aTitleOutput );
     136           0 :         aTitleOutput.writeDifferenceToModel( xModel, m_xCC );
     137           0 :         m_apTitleResources->ClearModifyFlag();
     138             :     }
     139             : 
     140             :     //commit legend changes to model
     141             :     {
     142           0 :         m_apLegendPositionResources->writeToModel( xModel );
     143             :     }
     144             : 
     145             :     //commit grid changes to model
     146             :     {
     147           0 :         uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
     148           0 :         uno::Sequence< sal_Bool > aOldExistenceList;
     149           0 :         AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, sal_False );
     150           0 :         uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
     151           0 :         aNewExistenceList[0]=m_aCB_Grid_X.IsChecked();
     152           0 :         aNewExistenceList[1]=m_aCB_Grid_Y.IsChecked();
     153           0 :         aNewExistenceList[2]=m_aCB_Grid_Z.IsChecked();
     154             :         AxisHelper::changeVisibilityOfGrids( xDiagram
     155           0 :                 , aOldExistenceList, aNewExistenceList, m_xCC );
     156           0 :     }
     157           0 : }
     158             : 
     159           0 : IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeHdl)
     160             : {
     161           0 :     if( m_bCommitToModel )
     162           0 :         commitToModel();
     163           0 :     return 0;
     164             : }
     165             : 
     166           0 : bool TitlesAndObjectsTabPage::canAdvance() const
     167             : {
     168           0 :     return false;
     169             : }
     170             : 
     171             : 
     172             : //.............................................................................
     173             : } //namespace chart
     174             : //.............................................................................
     175             : 
     176             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10