LCOV - code coverage report
Current view: top level - chart2/source/controller/dialogs - tp_Scale.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 458 0.0 %
Date: 2012-08-25 Functions: 0 25 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 850 0.0 %

           Branch data     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 "tp_Scale.hxx"
      21                 :            : #include "tp_Scale.hrc"
      22                 :            : 
      23                 :            : #include "ResId.hxx"
      24                 :            : #include "Strings.hrc"
      25                 :            : #include "chartview/ChartSfxItemIds.hxx"
      26                 :            : #include "NoWarningThisInCTOR.hxx"
      27                 :            : #include "AxisHelper.hxx"
      28                 :            : 
      29                 :            : #include <svx/svxids.hrc>
      30                 :            : #include <rtl/math.hxx>
      31                 :            : // header for class SvxDoubleItem
      32                 :            : #include <svx/chrtitem.hxx>
      33                 :            : // header for class SfxBoolItem
      34                 :            : #include <svl/eitem.hxx>
      35                 :            : // header for SfxInt32Item
      36                 :            : #include <svl/intitem.hxx>
      37                 :            : 
      38                 :            : // header for class WarningBox
      39                 :            : #include <vcl/msgbox.hxx>
      40                 :            : 
      41                 :            : // header for class SvNumberformat
      42                 :            : #include <svl/zformat.hxx>
      43                 :            : 
      44                 :            : #include <svtools/controldims.hrc>
      45                 :            : 
      46                 :            : #include <com/sun/star/chart2/AxisType.hpp>
      47                 :            : 
      48                 :            : using namespace ::com::sun::star;
      49                 :            : 
      50                 :            : //.............................................................................
      51                 :            : namespace chart
      52                 :            : {
      53                 :            : //.............................................................................
      54                 :            : 
      55                 :            : namespace
      56                 :            : {
      57                 :            : 
      58                 :          0 : void lcl_placeControlAtX( Control& rControl, long nNewXPos )
      59                 :            : {
      60         [ #  # ]:          0 :     Point aPos( rControl.GetPosPixel() );
      61                 :          0 :     aPos.X() = nNewXPos;
      62         [ #  # ]:          0 :     rControl.SetPosPixel(aPos);
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : void lcl_placeControlAtY( Control& rControl, long nNewYPos )
      66                 :            : {
      67         [ #  # ]:          0 :     Point aPos( rControl.GetPosPixel() );
      68                 :          0 :     aPos.Y() = nNewYPos;
      69         [ #  # ]:          0 :     rControl.SetPosPixel(aPos);
      70                 :          0 : }
      71                 :            : 
      72                 :          0 : void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
      73                 :            : {
      74         [ #  # ]:          0 :     Point aPos( rEdit.GetPosPixel() );
      75                 :          0 :     long nShift = nNewXPos - aPos.X();
      76                 :          0 :     aPos.X() = nNewXPos;
      77         [ #  # ]:          0 :     rEdit.SetPosPixel(aPos);
      78                 :            : 
      79         [ #  # ]:          0 :     aPos = rAuto.GetPosPixel();
      80                 :          0 :     aPos.X() += nShift;
      81         [ #  # ]:          0 :     rAuto.SetPosPixel(aPos);
      82                 :          0 : }
      83                 :            : 
      84                 :          0 : long lcl_getLabelDistance( Control& rControl )
      85                 :            : {
      86         [ #  # ]:          0 :     return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
      87                 :            : }
      88                 :            : 
      89                 :          0 : void lcl_setValue( FormattedField& rFmtField, double fValue )
      90                 :            : {
      91                 :          0 :     rFmtField.SetValue( fValue );
      92                 :          0 :     rFmtField.SetDefaultValue( fValue );
      93                 :          0 : }
      94                 :            : 
      95                 :            : }
      96                 :            : 
      97                 :          0 : ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
      98                 :            :     SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs),
      99                 :            : 
     100                 :            :     aFlScale(this, SchResId(FL_SCALE)),
     101                 :            : 
     102                 :            :     aCbxReverse(this, SchResId(CBX_REVERSE)),
     103                 :            :     aCbxLogarithm(this, SchResId(CBX_LOGARITHM)),
     104                 :            : 
     105                 :            :     m_aTxt_AxisType(this, SchResId (TXT_AXIS_TYPE)),
     106                 :            :     m_aLB_AxisType(this, SchResId(LB_AXIS_TYPE)),
     107                 :            : 
     108                 :            :     aTxtMin (this, SchResId (TXT_MIN)),
     109                 :            :     aFmtFldMin(this, SchResId(EDT_MIN)),
     110                 :            :     aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)),
     111                 :            : 
     112                 :            :     aTxtMax(this, SchResId (TXT_MAX)),
     113                 :            :     aFmtFldMax(this, SchResId(EDT_MAX)),
     114                 :            :     aCbxAutoMax(this, SchResId(CBX_AUTO_MAX)),
     115                 :            : 
     116                 :            :     m_aTxt_TimeResolution(this, SchResId (TXT_TIME_RESOLUTION)),
     117                 :            :     m_aLB_TimeResolution(this, SchResId(LB_TIME_RESOLUTION)),
     118                 :            :     m_aCbx_AutoTimeResolution(this, SchResId(CBX_AUTO_TIME_RESOLUTION)),
     119                 :            : 
     120                 :            :     aTxtMain (this, SchResId (TXT_STEP_MAIN)),
     121                 :            :     aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)),
     122                 :            :     m_aMt_MainDateStep(this, SchResId(MT_MAIN_DATE_STEP)),
     123                 :            :     m_aLB_MainTimeUnit(this, SchResId(LB_MAIN_TIME_UNIT)),
     124                 :            :     aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)),
     125                 :            : 
     126                 :            :     aTxtHelpCount (this, SchResId (TXT_STEP_HELP_COUNT)),
     127                 :            :     aTxtHelp (this, SchResId (TXT_STEP_HELP)),
     128                 :            :     aMtStepHelp (this, SchResId (MT_STEPHELP)),
     129                 :            :     m_aLB_HelpTimeUnit(this, SchResId(LB_HELP_TIME_UNIT)),
     130                 :            :     aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)),
     131                 :            : 
     132                 :            :     aTxtOrigin (this, SchResId (TXT_ORIGIN)),
     133                 :            :     aFmtFldOrigin(this, SchResId(EDT_ORIGIN)),
     134                 :            :     aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)),
     135                 :            : 
     136                 :            :     fMin(0.0),
     137                 :            :     fMax(0.0),
     138                 :            :     fStepMain(0.0),
     139                 :            :     nStepHelp(0),
     140                 :            :     fOrigin(0.0),
     141                 :            :     m_nTimeResolution(1),
     142                 :            :     m_nMainTimeUnit(1),
     143                 :            :     m_nHelpTimeUnit(1),
     144                 :            :     m_nAxisType(chart2::AxisType::REALNUMBER),
     145                 :            :     m_bAllowDateAxis(false),
     146                 :            :     pNumFormatter(NULL),
     147 [ #  # ][ #  # ]:          0 :     m_bShowAxisOrigin(false)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     148                 :            : {
     149         [ #  # ]:          0 :     FreeResource();
     150                 :          0 :     SetExchangeSupport();
     151                 :            : 
     152         [ #  # ]:          0 :     aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     153         [ #  # ]:          0 :     aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     154         [ #  # ]:          0 :     aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     155         [ #  # ]:          0 :     aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     156         [ #  # ]:          0 :     aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     157         [ #  # ]:          0 :     m_aCbx_AutoTimeResolution.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
     158                 :            : 
     159         [ #  # ]:          0 :     m_aLB_AxisType.SetDropDownLineCount(3);
     160         [ #  # ]:          0 :     m_aLB_AxisType.SetSelectHdl(LINK(this, ScaleTabPage, SelectAxisTypeHdl));
     161                 :            : 
     162         [ #  # ]:          0 :     m_aLB_TimeResolution.SetDropDownLineCount(3);
     163         [ #  # ]:          0 :     m_aLB_MainTimeUnit.SetDropDownLineCount(3);
     164         [ #  # ]:          0 :     m_aLB_HelpTimeUnit.SetDropDownLineCount(3);
     165                 :            : 
     166         [ #  # ]:          0 :     aFmtFldMin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
     167         [ #  # ]:          0 :     aFmtFldMax.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
     168         [ #  # ]:          0 :     aFmtFldStepMain.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
     169         [ #  # ]:          0 :     aFmtFldOrigin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
     170                 :            : 
     171         [ #  # ]:          0 :     HideAllControls();
     172                 :          0 : }
     173                 :            : 
     174                 :          0 : IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied )
     175                 :            : {
     176         [ #  # ]:          0 :     if( pFmtFied )
     177                 :          0 :         pFmtFied->SetDefaultValue( pFmtFied->GetValue() );
     178                 :          0 :     return 0;
     179                 :            : }
     180                 :            : 
     181                 :          0 : void ScaleTabPage::StateChanged( StateChangedType nType )
     182                 :            : {
     183                 :          0 :     TabPage::StateChanged( nType );
     184                 :            : 
     185         [ #  # ]:          0 :     if( nType == STATE_CHANGE_INITSHOW )
     186                 :          0 :         AdjustControlPositions();
     187                 :          0 : }
     188                 :            : 
     189                 :          0 : void ScaleTabPage::AdjustControlPositions()
     190                 :            : {
     191                 :            :     //optimize position of the controls
     192 [ #  # ][ #  # ]:          0 :     long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() );
                 [ #  # ]
     193 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth );
     194 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth );
     195 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( aTxtHelpCount.CalcMinimumSize().Width(), nLabelWidth );
     196 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth );
     197 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( m_aTxt_TimeResolution.CalcMinimumSize().Width(), nLabelWidth );
     198 [ #  # ][ #  # ]:          0 :     nLabelWidth = ::std::max( m_aTxt_AxisType.CalcMinimumSize().Width(), nLabelWidth );
     199                 :          0 :     nLabelWidth+=1;
     200                 :            : 
     201         [ #  # ]:          0 :     long nLabelDistance = lcl_getLabelDistance(aTxtMin);
     202         [ #  # ]:          0 :     long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance;
     203                 :            : 
     204                 :            :     //ensure that the auto checkboxes are wide enough and have correct size for calculation
     205 [ #  # ][ #  # ]:          0 :     aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() );
     206 [ #  # ][ #  # ]:          0 :     aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() );
     207 [ #  # ][ #  # ]:          0 :     aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() );
     208 [ #  # ][ #  # ]:          0 :     aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() );
     209 [ #  # ][ #  # ]:          0 :     aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() );
     210 [ #  # ][ #  # ]:          0 :     m_aCbx_AutoTimeResolution.SetSizePixel( m_aCbx_AutoTimeResolution.CalcMinimumSize() );
     211                 :            : 
     212                 :            :     //ensure new pos is ok
     213 [ #  # ][ #  # ]:          0 :     long nWidthOfOtherControls = m_aLB_MainTimeUnit.GetPosPixel().X() + m_aLB_MainTimeUnit.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
                 [ #  # ]
     214         [ #  # ]:          0 :     long nDialogWidth = GetSizePixel().Width();
     215                 :            : 
     216                 :          0 :     long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls;
     217         [ #  # ]:          0 :     if(nLeftSpace>=0)
     218                 :            :     {
     219         [ #  # ]:          0 :         Size aSize( aTxtMin.GetSizePixel() );
     220                 :          0 :         aSize.Width() = nLabelWidth;
     221         [ #  # ]:          0 :         aTxtMin.SetSizePixel(aSize);
     222         [ #  # ]:          0 :         aTxtMax.SetSizePixel(aSize);
     223         [ #  # ]:          0 :         aTxtMain.SetSizePixel(aSize);
     224         [ #  # ]:          0 :         aTxtHelp.SetSizePixel(aSize);
     225         [ #  # ]:          0 :         aTxtHelpCount.SetSizePixel(aSize);
     226         [ #  # ]:          0 :         aTxtOrigin.SetSizePixel(aSize);
     227         [ #  # ]:          0 :         m_aTxt_TimeResolution.SetSizePixel(aSize);
     228         [ #  # ]:          0 :         m_aTxt_AxisType.SetSizePixel(aSize);
     229                 :            : 
     230         [ #  # ]:          0 :         long nOrgAutoCheckX = aCbxAutoMin.GetPosPixel().X();
     231         [ #  # ]:          0 :         lcl_placeControlAtX( aCbxAutoStepMain, nOrgAutoCheckX );
     232         [ #  # ]:          0 :         lcl_placeControlAtX( aCbxAutoStepHelp, nOrgAutoCheckX );
     233                 :            : 
     234         [ #  # ]:          0 :         lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos );
     235         [ #  # ]:          0 :         lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos );
     236         [ #  # ]:          0 :         lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos );
     237 [ #  # ][ #  # ]:          0 :         lcl_placeControlAtX( m_aMt_MainDateStep, aFmtFldStepMain.GetPosPixel().X() );
     238         [ #  # ]:          0 :         lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos );
     239         [ #  # ]:          0 :         lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos );
     240         [ #  # ]:          0 :         lcl_shiftControls( m_aLB_TimeResolution, m_aCbx_AutoTimeResolution, nNewXPos );
     241         [ #  # ]:          0 :         lcl_placeControlAtX( m_aLB_AxisType, nNewXPos );
     242                 :            : 
     243 [ #  # ][ #  # ]:          0 :         nNewXPos = aCbxAutoStepMain.GetPosPixel().X() + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
     244         [ #  # ]:          0 :         lcl_placeControlAtX( m_aLB_MainTimeUnit, nNewXPos );
     245         [ #  # ]:          0 :         lcl_placeControlAtX( m_aLB_HelpTimeUnit, nNewXPos );
     246                 :            :     }
     247         [ #  # ]:          0 :     PlaceIntervalControlsAccordingToAxisType();
     248                 :          0 : }
     249                 :            : 
     250                 :          0 : void ScaleTabPage::PlaceIntervalControlsAccordingToAxisType()
     251                 :            : {
     252 [ #  # ][ #  # ]:          0 :     long nMinX = std::min( aCbxAutoStepMain.GetPosPixel().X(), m_aLB_MainTimeUnit.GetPosPixel().X() );
     253                 :          0 :     long nLabelDistance = lcl_getLabelDistance(aTxtMin);
     254                 :          0 :     long nListWidth = m_aLB_MainTimeUnit.GetSizePixel().Width();
     255                 :            : 
     256         [ #  # ]:          0 :     if( chart2::AxisType::DATE == m_nAxisType )
     257                 :            :     {
     258                 :          0 :         lcl_placeControlAtX( m_aLB_MainTimeUnit, nMinX );
     259                 :          0 :         lcl_placeControlAtX( m_aLB_HelpTimeUnit, nMinX );
     260                 :          0 :         long nSecondX = nMinX + nListWidth + nLabelDistance;
     261                 :          0 :         lcl_placeControlAtX( aCbxAutoStepMain, nSecondX );
     262                 :          0 :         lcl_placeControlAtX( aCbxAutoStepHelp, nSecondX );
     263                 :            : 
     264         [ #  # ]:          0 :         long nOne = m_aMt_MainDateStep.LogicToPixel( Size(0, 1), MapMode(MAP_APPFONT) ).Height();
     265                 :            : 
     266                 :          0 :         long nYMajor = m_aMt_MainDateStep.GetPosPixel().Y();
     267                 :          0 :         lcl_placeControlAtY( aCbxAutoStepMain , nYMajor+(3*nOne));
     268                 :          0 :         lcl_placeControlAtY( aTxtMain , nYMajor+nOne+nOne);
     269                 :            : 
     270                 :          0 :         long nYMinor = m_aLB_HelpTimeUnit.GetPosPixel().Y();
     271                 :          0 :         lcl_placeControlAtY( aMtStepHelp , nYMinor );
     272                 :          0 :         lcl_placeControlAtY( aCbxAutoStepHelp , nYMinor+(3*nOne));
     273                 :            :     }
     274                 :            :     else
     275                 :            :     {
     276                 :          0 :         lcl_placeControlAtX( aCbxAutoStepMain, nMinX );
     277                 :          0 :         lcl_placeControlAtX( aCbxAutoStepHelp, nMinX );
     278                 :          0 :         long nSecondX = nMinX + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
     279                 :          0 :         long nSecondXMax = GetSizePixel().Width() - nListWidth;
     280         [ #  # ]:          0 :         if( nSecondX > nSecondXMax )
     281                 :          0 :             nSecondX = nSecondXMax;
     282                 :          0 :         lcl_placeControlAtX( m_aLB_MainTimeUnit, nSecondX );
     283                 :          0 :         lcl_placeControlAtX( m_aLB_HelpTimeUnit, nSecondX );
     284                 :            :     }
     285                 :          0 : }
     286                 :            : 
     287                 :          0 : void ScaleTabPage::EnableControls()
     288                 :            : {
     289 [ #  # ][ #  # ]:          0 :     bool bValueAxis = chart2::AxisType::REALNUMBER == m_nAxisType || chart2::AxisType::PERCENT == m_nAxisType || chart2::AxisType::DATE == m_nAxisType;
                 [ #  # ]
     290                 :          0 :     bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
     291                 :            : 
     292                 :          0 :     m_aTxt_AxisType.Show(m_bAllowDateAxis);
     293                 :          0 :     m_aLB_AxisType.Show(m_bAllowDateAxis);
     294                 :            : 
     295 [ #  # ][ #  # ]:          0 :     aCbxLogarithm.Show( bValueAxis && !bDateAxis );
     296                 :          0 :     aTxtMin.Show( bValueAxis );
     297                 :          0 :     aFmtFldMin.Show( bValueAxis );
     298                 :          0 :     aCbxAutoMin.Show( bValueAxis );
     299                 :          0 :     aTxtMax.Show( bValueAxis );
     300                 :          0 :     aFmtFldMax.Show( bValueAxis );
     301                 :          0 :     aCbxAutoMax.Show( bValueAxis );
     302                 :          0 :     aTxtMain.Show( bValueAxis );
     303                 :          0 :     aFmtFldStepMain.Show( bValueAxis );
     304                 :          0 :     aCbxAutoStepMain.Show( bValueAxis );
     305                 :          0 :     aTxtHelp.Show( bValueAxis );
     306                 :          0 :     aTxtHelpCount.Show( bValueAxis );
     307                 :          0 :     aMtStepHelp.Show( bValueAxis );
     308                 :          0 :     aCbxAutoStepHelp.Show( bValueAxis );
     309                 :            : 
     310 [ #  # ][ #  # ]:          0 :     aTxtOrigin.Show( m_bShowAxisOrigin && bValueAxis );
     311 [ #  # ][ #  # ]:          0 :     aFmtFldOrigin.Show( m_bShowAxisOrigin && bValueAxis );
     312 [ #  # ][ #  # ]:          0 :     aCbxAutoOrigin.Show( m_bShowAxisOrigin && bValueAxis );
     313                 :            : 
     314 [ #  # ][ #  # ]:          0 :     aTxtHelpCount.Show( bValueAxis && !bDateAxis );
     315                 :          0 :     aTxtHelp.Show( bDateAxis );
     316                 :            : 
     317                 :          0 :     m_aTxt_TimeResolution.Show( bDateAxis );
     318                 :          0 :     m_aLB_TimeResolution.Show( bDateAxis );
     319                 :          0 :     m_aCbx_AutoTimeResolution.Show( bDateAxis );
     320                 :            : 
     321                 :          0 :     bool bWasDateAxis = m_aMt_MainDateStep.IsVisible();
     322         [ #  # ]:          0 :     if( bWasDateAxis != bDateAxis )
     323                 :            :     {
     324                 :            :         //transport value from one to other control
     325         [ #  # ]:          0 :         if( bWasDateAxis )
     326                 :          0 :             lcl_setValue( aFmtFldStepMain, m_aMt_MainDateStep.GetValue() );
     327                 :            :         else
     328                 :          0 :             m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(aFmtFldStepMain.GetValue()) );
     329                 :            :     }
     330 [ #  # ][ #  # ]:          0 :     aFmtFldStepMain.Show( bValueAxis && !bDateAxis );
     331                 :          0 :     m_aMt_MainDateStep.Show( bDateAxis );
     332                 :            : 
     333                 :          0 :     m_aLB_MainTimeUnit.Show( bDateAxis );
     334                 :          0 :     m_aLB_HelpTimeUnit.Show( bDateAxis );
     335                 :            : 
     336                 :          0 :     EnableValueHdl(&aCbxAutoMin);
     337                 :          0 :     EnableValueHdl(&aCbxAutoMax);
     338                 :          0 :     EnableValueHdl(&aCbxAutoStepMain);
     339                 :          0 :     EnableValueHdl(&aCbxAutoStepHelp);
     340                 :          0 :     EnableValueHdl(&aCbxAutoOrigin);
     341                 :          0 :     EnableValueHdl(&m_aCbx_AutoTimeResolution);
     342                 :          0 : }
     343                 :            : 
     344                 :          0 : IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx )
     345                 :            : {
     346 [ #  # ][ #  # ]:          0 :     bool bEnable = pCbx && !pCbx->IsChecked() && pCbx->IsEnabled();
                 [ #  # ]
     347         [ #  # ]:          0 :     if (pCbx == &aCbxAutoMin)
     348                 :            :     {
     349                 :          0 :         aFmtFldMin.Enable( bEnable );
     350                 :            :     }
     351         [ #  # ]:          0 :     else if (pCbx == &aCbxAutoMax)
     352                 :            :     {
     353                 :          0 :         aFmtFldMax.Enable( bEnable );
     354                 :            :     }
     355         [ #  # ]:          0 :     else if (pCbx == &aCbxAutoStepMain)
     356                 :            :     {
     357                 :          0 :         aFmtFldStepMain.Enable( bEnable );
     358                 :          0 :         m_aMt_MainDateStep.Enable( bEnable );
     359                 :          0 :         m_aLB_MainTimeUnit.Enable( bEnable );
     360                 :            :     }
     361         [ #  # ]:          0 :     else if (pCbx == &aCbxAutoStepHelp)
     362                 :            :     {
     363                 :          0 :         aMtStepHelp.Enable( bEnable );
     364                 :          0 :         m_aLB_HelpTimeUnit.Enable( bEnable );
     365                 :            :     }
     366         [ #  # ]:          0 :     else if (pCbx == &m_aCbx_AutoTimeResolution)
     367                 :            :     {
     368                 :          0 :         m_aLB_TimeResolution.Enable( bEnable );
     369                 :            :     }
     370         [ #  # ]:          0 :     else if (pCbx == &aCbxAutoOrigin)
     371                 :            :     {
     372                 :          0 :         aFmtFldOrigin.Enable( bEnable );
     373                 :            :     }
     374                 :          0 :     return 0;
     375                 :            : }
     376                 :            : 
     377                 :            : enum AxisTypeListBoxEntry
     378                 :            : {
     379                 :            :     TYPE_AUTO=0,
     380                 :            :     TYPE_TEXT=1,
     381                 :            :     TYPE_DATE=2
     382                 :            : };
     383                 :            : 
     384                 :          0 : IMPL_LINK_NOARG(ScaleTabPage, SelectAxisTypeHdl)
     385                 :            : {
     386                 :          0 :     sal_uInt16 nPos = m_aLB_AxisType.GetSelectEntryPos();
     387         [ #  # ]:          0 :     if( nPos==TYPE_DATE )
     388                 :          0 :         m_nAxisType = chart2::AxisType::DATE;
     389                 :            :     else
     390                 :          0 :         m_nAxisType = chart2::AxisType::CATEGORY;
     391         [ #  # ]:          0 :     if( chart2::AxisType::DATE == m_nAxisType )
     392                 :          0 :         aCbxLogarithm.Check(false);
     393                 :          0 :     EnableControls();
     394                 :          0 :     PlaceIntervalControlsAccordingToAxisType();
     395                 :          0 :     SetNumFormat();
     396                 :          0 :     return 0;
     397                 :            : }
     398                 :            : 
     399                 :          0 : SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
     400                 :            : {
     401         [ #  # ]:          0 :     return new ScaleTabPage(pWindow, rOutAttrs);
     402                 :            : }
     403                 :            : 
     404                 :          0 : sal_Bool ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
     405                 :            : {
     406                 :            :     OSL_PRECOND( pNumFormatter, "No NumberFormatter available" );
     407                 :            : 
     408         [ #  # ]:          0 :     rOutAttrs.Put(SfxInt32Item(SCHATTR_AXISTYPE, m_nAxisType));
     409         [ #  # ]:          0 :     if(m_bAllowDateAxis)
     410         [ #  # ]:          0 :         rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, TYPE_AUTO==m_aLB_AxisType.GetSelectEntryPos()));
     411                 :            : 
     412                 :          0 :     bool bAutoScale = false;
     413         [ #  # ]:          0 :     if( m_nAxisType==chart2::AxisType::CATEGORY )
     414                 :          0 :         bAutoScale = true;//reset scaling for category charts
     415                 :            : 
     416 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN      ,bAutoScale || aCbxAutoMin.IsChecked()));
                 [ #  # ]
     417 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX      ,bAutoScale || aCbxAutoMax.IsChecked()));
                 [ #  # ]
     418 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || aCbxAutoStepHelp.IsChecked()));
                 [ #  # ]
     419 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN   ,bAutoScale || aCbxAutoOrigin.IsChecked()));
                 [ #  # ]
     420         [ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM     ,aCbxLogarithm.IsChecked()));
     421         [ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_REVERSE       ,aCbxReverse.IsChecked()));
     422         [ #  # ]:          0 :     rOutAttrs.Put(SvxDoubleItem(fMax     , SCHATTR_AXIS_MAX));
     423         [ #  # ]:          0 :     rOutAttrs.Put(SvxDoubleItem(fMin     , SCHATTR_AXIS_MIN));
     424         [ #  # ]:          0 :     rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp));
     425         [ #  # ]:          0 :     rOutAttrs.Put(SvxDoubleItem(fOrigin  , SCHATTR_AXIS_ORIGIN));
     426                 :            : 
     427 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || aCbxAutoStepMain.IsChecked()));
                 [ #  # ]
     428         [ #  # ]:          0 :     rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
     429                 :            : 
     430 [ #  # ][ #  # ]:          0 :     rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_aCbx_AutoTimeResolution.IsChecked()));
                 [ #  # ]
     431         [ #  # ]:          0 :     rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,m_nTimeResolution));
     432                 :            : 
     433         [ #  # ]:          0 :     rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,m_nMainTimeUnit));
     434         [ #  # ]:          0 :     rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,m_nHelpTimeUnit));
     435                 :            : 
     436                 :          0 :     return sal_True;
     437                 :            : }
     438                 :            : 
     439                 :          0 : void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
     440                 :            : {
     441                 :            :     OSL_PRECOND( pNumFormatter, "No NumberFormatter available" );
     442         [ #  # ]:          0 :     if(!pNumFormatter)
     443                 :          0 :         return;
     444                 :            : 
     445                 :          0 :     const SfxPoolItem *pPoolItem = NULL;
     446 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_ALLOW_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
     447                 :          0 :         m_bAllowDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
     448                 :          0 :     m_nAxisType=chart2::AxisType::REALNUMBER;
     449 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, sal_True, &pPoolItem) == SFX_ITEM_SET)
     450                 :          0 :         m_nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
     451 [ #  # ][ #  # ]:          0 :     if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis )
     452                 :          0 :         m_nAxisType=chart2::AxisType::CATEGORY;
     453         [ #  # ]:          0 :     if( m_bAllowDateAxis )
     454                 :            :     {
     455                 :          0 :         bool bAutoDateAxis = false;
     456 [ #  # ][ #  # ]:          0 :         if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
     457                 :          0 :             bAutoDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
     458                 :            : 
     459                 :          0 :         sal_uInt16 nPos = 0;
     460         [ #  # ]:          0 :         if( m_nAxisType==chart2::AxisType::DATE )
     461                 :          0 :             nPos=TYPE_DATE;
     462         [ #  # ]:          0 :         else if( bAutoDateAxis )
     463                 :          0 :             nPos=TYPE_AUTO;
     464                 :            :         else
     465                 :          0 :             nPos=TYPE_TEXT;
     466         [ #  # ]:          0 :         m_aLB_AxisType.SelectEntryPos( nPos );
     467                 :            :     }
     468                 :            : 
     469         [ #  # ]:          0 :     if( m_bAllowDateAxis )
     470         [ #  # ]:          0 :         aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:MayBeDateAxis");
     471 [ #  # ][ #  # ]:          0 :     else if( m_nAxisType==chart2::AxisType::CATEGORY || m_nAxisType==chart2::AxisType::SERIES )
     472         [ #  # ]:          0 :         aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:Category");
     473                 :            : 
     474         [ #  # ]:          0 :     PlaceIntervalControlsAccordingToAxisType();
     475                 :            : 
     476         [ #  # ]:          0 :     aCbxAutoMin.Check( true );
     477         [ #  # ]:          0 :     aCbxAutoMax.Check( true );
     478         [ #  # ]:          0 :     aCbxAutoStepMain.Check( true );
     479         [ #  # ]:          0 :     aCbxAutoStepHelp.Check( true );
     480         [ #  # ]:          0 :     aCbxAutoOrigin.Check( true );
     481         [ #  # ]:          0 :     m_aCbx_AutoTimeResolution.Check( true );
     482                 :            : 
     483 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,sal_True,&pPoolItem) == SFX_ITEM_SET)
     484         [ #  # ]:          0 :         aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     485                 :            : 
     486 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
     487                 :            :     {
     488                 :          0 :         fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
     489         [ #  # ]:          0 :         lcl_setValue( aFmtFldMin, fMin );
     490                 :            :     }
     491                 :            : 
     492 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
     493         [ #  # ]:          0 :         aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     494                 :            : 
     495 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
     496                 :            :     {
     497                 :          0 :         fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue();
     498         [ #  # ]:          0 :         lcl_setValue( aFmtFldMax, fMax );
     499                 :            :     }
     500                 :            : 
     501 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
     502         [ #  # ]:          0 :         aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     503                 :            : 
     504 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
     505                 :            :     {
     506                 :          0 :         fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue();
     507         [ #  # ]:          0 :         lcl_setValue( aFmtFldStepMain, fStepMain );
     508         [ #  # ]:          0 :         m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(fStepMain) );
     509                 :            :     }
     510 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET)
     511         [ #  # ]:          0 :         aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     512 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,sal_True, &pPoolItem) == SFX_ITEM_SET)
     513         [ #  # ]:          0 :         aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     514 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,sal_True, &pPoolItem) == SFX_ITEM_SET)
     515         [ #  # ]:          0 :         aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     516 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET)
     517                 :            :     {
     518                 :          0 :         nStepHelp = ((const SfxInt32Item*)pPoolItem)->GetValue();
     519         [ #  # ]:          0 :         aMtStepHelp.SetValue( nStepHelp );
     520                 :            :     }
     521 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
     522         [ #  # ]:          0 :         aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     523 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
     524                 :            :     {
     525                 :          0 :         fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
     526         [ #  # ]:          0 :         lcl_setValue( aFmtFldOrigin, fOrigin );
     527                 :            :     }
     528                 :            : 
     529 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
     530         [ #  # ]:          0 :         m_aCbx_AutoTimeResolution.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
     531 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
     532                 :            :     {
     533                 :          0 :         m_nTimeResolution = ((const SfxInt32Item*)pPoolItem)->GetValue();
     534         [ #  # ]:          0 :         m_aLB_TimeResolution.SelectEntryPos( m_nTimeResolution );
     535                 :            :     }
     536                 :            : 
     537 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
     538                 :            :     {
     539                 :          0 :         m_nMainTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
     540         [ #  # ]:          0 :         m_aLB_MainTimeUnit.SelectEntryPos( m_nMainTimeUnit );
     541                 :            :     }
     542 [ #  # ][ #  # ]:          0 :     if (rInAttrs.GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
     543                 :            :     {
     544                 :          0 :         m_nHelpTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
     545         [ #  # ]:          0 :         m_aLB_HelpTimeUnit.SelectEntryPos( m_nHelpTimeUnit );
     546                 :            :     }
     547                 :            : 
     548         [ #  # ]:          0 :     EnableControls();
     549         [ #  # ]:          0 :     SetNumFormat();
     550                 :            : }
     551                 :            : 
     552                 :          0 : int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
     553                 :            : {
     554         [ #  # ]:          0 :     if( !pNumFormatter )
     555                 :            :     {
     556                 :            :         OSL_FAIL( "No NumberFormatter available" );
     557                 :          0 :         return LEAVE_PAGE;
     558                 :            :     }
     559                 :            : 
     560                 :          0 :     bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
     561                 :            : 
     562                 :          0 :     sal_uInt32 nMinMaxOriginFmt = aFmtFldMax.GetFormatKey();
     563 [ #  # ][ #  # ]:          0 :     if ((pNumFormatter->GetType(nMinMaxOriginFmt) &~ NUMBERFORMAT_DEFINED) == NUMBERFORMAT_TEXT)
     564                 :          0 :         nMinMaxOriginFmt = 0;
     565                 :            :     // numberformat_text cause numbers to fail being numbers...  Shouldn't happen, but can.
     566                 :          0 :     sal_uInt32 nStepFmt = aFmtFldStepMain.GetFormatKey();
     567 [ #  # ][ #  # ]:          0 :     if ((pNumFormatter->GetType(nStepFmt) &~NUMBERFORMAT_DEFINED) == NUMBERFORMAT_TEXT)
     568                 :          0 :         nStepFmt = 0;
     569                 :            : 
     570                 :          0 :     Control* pControl = NULL;
     571                 :          0 :     sal_uInt16 nErrStrId = 0;
     572                 :            :     double fDummy;
     573                 :            : 
     574         [ #  # ]:          0 :     fMax = aFmtFldMax.GetValue();
     575         [ #  # ]:          0 :     fMin = aFmtFldMin.GetValue();
     576         [ #  # ]:          0 :     fOrigin = aFmtFldOrigin.GetValue();
     577 [ #  # ][ #  # ]:          0 :     fStepMain = bDateAxis ? m_aMt_MainDateStep.GetValue() : aFmtFldStepMain.GetValue();
                 [ #  # ]
     578         [ #  # ]:          0 :     nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue());
     579         [ #  # ]:          0 :     m_nTimeResolution = m_aLB_TimeResolution.GetSelectEntryPos();
     580         [ #  # ]:          0 :     m_nMainTimeUnit = m_aLB_MainTimeUnit.GetSelectEntryPos();
     581         [ #  # ]:          0 :     m_nHelpTimeUnit = m_aLB_HelpTimeUnit.GetSelectEntryPos();
     582                 :            : 
     583         [ #  # ]:          0 :     if( chart2::AxisType::REALNUMBER != m_nAxisType )
     584         [ #  # ]:          0 :         aCbxLogarithm.Show( false );
     585                 :            : 
     586                 :            :     //check wich entries need user action
     587                 :            : 
     588 [ #  # ][ #  # ]:          0 :     if ( aCbxLogarithm.IsChecked() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     589         [ #  # ]:          0 :             ( ( !aCbxAutoMin.IsChecked() && fMin <= 0.0 )
     590         [ #  # ]:          0 :              || ( !aCbxAutoMax.IsChecked() && fMax <= 0.0 ) ) )
     591                 :            :     {
     592                 :          0 :         pControl = &aFmtFldMin;
     593                 :          0 :         nErrStrId = STR_BAD_LOGARITHM;
     594                 :            :     }
     595                 :            :     // check for entries that cannot be parsed for the current number format
     596 [ #  # ][ #  # ]:          0 :     else if ( aFmtFldMin.IsModified()
         [ #  # ][ #  # ]
     597         [ #  # ]:          0 :               && !aCbxAutoMin.IsChecked()
     598 [ #  # ][ #  # ]:          0 :               && !pNumFormatter->IsNumberFormat( aFmtFldMin.GetText(), nMinMaxOriginFmt, fDummy))
         [ #  # ][ #  # ]
                 [ #  # ]
     599                 :            :     {
     600                 :          0 :         pControl = &aFmtFldMin;
     601                 :          0 :         nErrStrId = STR_INVALID_NUMBER;
     602                 :            :     }
     603 [ #  # ][ #  # ]:          0 :     else if ( aFmtFldMax.IsModified()
         [ #  # ][ #  # ]
     604         [ #  # ]:          0 :               && !aCbxAutoMax.IsChecked()
     605 [ #  # ][ #  # ]:          0 :               && !pNumFormatter->IsNumberFormat( aFmtFldMax.GetText(), nMinMaxOriginFmt, fDummy))
         [ #  # ][ #  # ]
                 [ #  # ]
     606                 :            :     {
     607                 :          0 :         pControl = &aFmtFldMax;
     608                 :          0 :         nErrStrId = STR_INVALID_NUMBER;
     609                 :            :     }
     610 [ #  # ][ #  # ]:          0 :     else if ( !bDateAxis && aFmtFldStepMain.IsModified()
         [ #  # ][ #  # ]
                 [ #  # ]
     611         [ #  # ]:          0 :               && !aCbxAutoStepMain.IsChecked()
     612 [ #  # ][ #  # ]:          0 :               && !pNumFormatter->IsNumberFormat( aFmtFldStepMain.GetText(), nStepFmt, fDummy))
         [ #  # ][ #  # ]
                 [ #  # ]
     613                 :            :     {
     614                 :          0 :         pControl = &aFmtFldStepMain;
     615                 :          0 :         nErrStrId = STR_INVALID_NUMBER;
     616                 :            :     }
     617 [ #  # ][ #  # ]:          0 :     else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() &&
         [ #  # ][ #  # ]
                 [ #  # ]
     618 [ #  # ][ #  # ]:          0 :              !pNumFormatter->IsNumberFormat( aFmtFldOrigin.GetText(), nMinMaxOriginFmt, fDummy))
         [ #  # ][ #  # ]
                 [ #  # ]
     619                 :            :     {
     620                 :          0 :         pControl = &aFmtFldOrigin;
     621                 :          0 :         nErrStrId = STR_INVALID_NUMBER;
     622                 :            :     }
     623 [ #  # ][ #  # ]:          0 :     else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0)
         [ #  # ][ #  # ]
     624                 :            :     {
     625                 :          0 :         pControl = &aFmtFldStepMain;
     626                 :          0 :         nErrStrId = STR_STEP_GT_ZERO;
     627                 :            :     }
     628 [ #  # ][ #  # ]:          0 :     else if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     629                 :            :              fMin >= fMax)
     630                 :            :     {
     631                 :          0 :         pControl = &aFmtFldMin;
     632                 :          0 :         nErrStrId = STR_MIN_GREATER_MAX;
     633                 :            :     }
     634         [ #  # ]:          0 :     else if( bDateAxis )
     635                 :            :     {
     636 [ #  # ][ #  # ]:          0 :         if( !aCbxAutoStepMain.IsChecked() && !aCbxAutoStepHelp.IsChecked() )
         [ #  # ][ #  # ]
                 [ #  # ]
     637                 :            :         {
     638         [ #  # ]:          0 :             if( m_nHelpTimeUnit > m_nMainTimeUnit )
     639                 :            :             {
     640                 :          0 :                 pControl = &m_aLB_MainTimeUnit;
     641                 :          0 :                 nErrStrId = STR_INVALID_INTERVALS;
     642                 :            :             }
     643 [ #  # ][ #  # ]:          0 :             else if( m_nHelpTimeUnit == m_nMainTimeUnit && nStepHelp > fStepMain )
     644                 :            :             {
     645                 :          0 :                 pControl = &m_aLB_MainTimeUnit;
     646                 :          0 :                 nErrStrId = STR_INVALID_INTERVALS;
     647                 :            :             }
     648                 :            :         }
     649 [ #  # ][ #  # ]:          0 :         if( !nErrStrId && !m_aCbx_AutoTimeResolution.IsChecked() )
         [ #  # ][ #  # ]
     650                 :            :         {
     651 [ #  # ][ #  # ]:          0 :             if( (!aCbxAutoStepMain.IsChecked() && m_nTimeResolution > m_nMainTimeUnit )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     652                 :            :                 ||
     653         [ #  # ]:          0 :                 (!aCbxAutoStepHelp.IsChecked() && m_nTimeResolution > m_nHelpTimeUnit )
     654                 :            :                 )
     655                 :            :             {
     656                 :          0 :                 pControl = &m_aLB_TimeResolution;
     657                 :          0 :                 nErrStrId = STR_INVALID_TIME_UNIT;
     658                 :            :             }
     659                 :            :         }
     660                 :            :     }
     661                 :            : 
     662 [ #  # ][ #  # ]:          0 :     if( ShowWarning( nErrStrId, pControl ) )
     663                 :          0 :         return KEEP_PAGE;
     664                 :            : 
     665         [ #  # ]:          0 :     if( pItemSet )
     666         [ #  # ]:          0 :         FillItemSet( *pItemSet );
     667                 :            : 
     668                 :          0 :     return LEAVE_PAGE;
     669                 :            : }
     670                 :            : 
     671                 :          0 : void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
     672                 :            : {
     673                 :          0 :     pNumFormatter = pFormatter;
     674                 :          0 :     aFmtFldMax.SetFormatter( pNumFormatter );
     675                 :          0 :     aFmtFldMin.SetFormatter( pNumFormatter );
     676                 :          0 :     aFmtFldStepMain.SetFormatter( pNumFormatter );
     677                 :          0 :     aFmtFldOrigin.SetFormatter( pNumFormatter );
     678                 :            : 
     679                 :            :     // #i6278# allow more decimal places than the output format.  As
     680                 :            :     // the numbers shown in the edit fields are used for input, it makes more
     681                 :            :     // sense to display the values in the input format rather than the output
     682                 :            :     // format.
     683                 :          0 :     aFmtFldMax.UseInputStringForFormatting();
     684                 :          0 :     aFmtFldMin.UseInputStringForFormatting();
     685                 :          0 :     aFmtFldStepMain.UseInputStringForFormatting();
     686                 :          0 :     aFmtFldOrigin.UseInputStringForFormatting();
     687                 :            : 
     688                 :          0 :     SetNumFormat();
     689                 :          0 : }
     690                 :            : 
     691                 :          0 : void ScaleTabPage::SetNumFormat()
     692                 :            : {
     693                 :          0 :     const SfxPoolItem *pPoolItem = NULL;
     694                 :            : 
     695 [ #  # ][ #  # ]:          0 :     if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
     696                 :            :     {
     697                 :          0 :         sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue();
     698                 :            : 
     699         [ #  # ]:          0 :         aFmtFldMax.SetFormatKey( nFmt );
     700         [ #  # ]:          0 :         aFmtFldMin.SetFormatKey( nFmt );
     701         [ #  # ]:          0 :         aFmtFldOrigin.SetFormatKey( nFmt );
     702                 :            : 
     703         [ #  # ]:          0 :         if( pNumFormatter )
     704                 :            :         {
     705         [ #  # ]:          0 :             short eType = pNumFormatter->GetType( nFmt );
     706         [ #  # ]:          0 :             if( eType == NUMBERFORMAT_DATE )
     707                 :            :             {
     708                 :            :                 // for intervals use standard format for dates (so you can enter a number of days)
     709         [ #  # ]:          0 :                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
     710         [ #  # ]:          0 :                 if( pFormat )
     711         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardIndex( pFormat->GetLanguage());
     712                 :            :                 else
     713         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardIndex();
     714                 :            :             }
     715         [ #  # ]:          0 :             else if( eType == NUMBERFORMAT_DATETIME )
     716                 :            :             {
     717                 :            :                 // for intervals use time format for date times
     718         [ #  # ]:          0 :                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
     719         [ #  # ]:          0 :                 if( pFormat )
     720         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME, pFormat->GetLanguage() );
     721                 :            :                 else
     722         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME );
     723                 :            :             }
     724                 :            : 
     725 [ #  # ][ #  # ]:          0 :             if( chart2::AxisType::DATE == m_nAxisType && ( eType != NUMBERFORMAT_DATE && eType != NUMBERFORMAT_DATETIME) )
                 [ #  # ]
     726                 :            :             {
     727         [ #  # ]:          0 :                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
     728         [ #  # ]:          0 :                 if( pFormat )
     729         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE, pFormat->GetLanguage() );
     730                 :            :                 else
     731         [ #  # ]:          0 :                     nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE );
     732                 :            : 
     733         [ #  # ]:          0 :                 aFmtFldMax.SetFormatKey( nFmt );
     734         [ #  # ]:          0 :                 aFmtFldMin.SetFormatKey( nFmt );
     735         [ #  # ]:          0 :                 aFmtFldOrigin.SetFormatKey( nFmt );
     736                 :            :             }
     737                 :            :         }
     738                 :            : 
     739         [ #  # ]:          0 :         aFmtFldStepMain.SetFormatKey( nFmt );
     740                 :            :     }
     741                 :          0 : }
     742                 :            : 
     743                 :          0 : void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
     744                 :            : {
     745                 :          0 :     m_bShowAxisOrigin = bShowOrigin;
     746         [ #  # ]:          0 :     if( !AxisHelper::isAxisPositioningEnabled() )
     747                 :          0 :         m_bShowAxisOrigin = true;
     748                 :          0 : }
     749                 :            : 
     750                 :          0 : bool ScaleTabPage::ShowWarning( sal_uInt16 nResIdMessage, Control* pControl /* = NULL */ )
     751                 :            : {
     752         [ #  # ]:          0 :     if( nResIdMessage == 0 )
     753                 :          0 :         return false;
     754                 :            : 
     755 [ #  # ][ #  # ]:          0 :     WarningBox( this, WinBits( WB_OK ), String( SchResId( nResIdMessage ))).Execute();
         [ #  # ][ #  # ]
                 [ #  # ]
     756         [ #  # ]:          0 :     if( pControl )
     757                 :            :     {
     758                 :          0 :         pControl->GrabFocus();
     759         [ #  # ]:          0 :         Edit* pEdit = dynamic_cast<Edit*>(pControl);
     760         [ #  # ]:          0 :         if(pEdit)
     761         [ #  # ]:          0 :             pEdit->SetSelection( Selection( 0, SELECTION_MAX ));
     762                 :            :     }
     763                 :          0 :     return true;
     764                 :            : }
     765                 :            : 
     766                 :          0 : void ScaleTabPage::HideAllControls()
     767                 :            : {
     768                 :            :     // We need to set these controls invisible when the class is instantiated
     769                 :            :     // since some code in EnableControls() depends on that logic. The real
     770                 :            :     // visibility of these controls depend on axis data type, and are
     771                 :            :     // set in EnableControls().
     772                 :            : 
     773                 :          0 :     m_aTxt_AxisType.Hide();
     774                 :          0 :     m_aLB_AxisType.Hide();
     775                 :            : 
     776                 :          0 :     aCbxLogarithm.Hide();
     777                 :          0 :     aTxtMin.Hide();
     778                 :          0 :     aFmtFldMin.Hide();
     779                 :          0 :     aCbxAutoMin.Hide();
     780                 :          0 :     aTxtMax.Hide();
     781                 :          0 :     aFmtFldMax.Hide();
     782                 :          0 :     aCbxAutoMax.Hide();
     783                 :          0 :     aTxtMain.Hide();
     784                 :          0 :     aFmtFldStepMain.Hide();
     785                 :          0 :     aCbxAutoStepMain.Hide();
     786                 :          0 :     aTxtHelp.Hide();
     787                 :          0 :     aTxtHelpCount.Hide();
     788                 :          0 :     aMtStepHelp.Hide();
     789                 :          0 :     aCbxAutoStepHelp.Hide();
     790                 :            : 
     791                 :          0 :     aTxtOrigin.Hide();
     792                 :          0 :     aFmtFldOrigin.Hide();
     793                 :          0 :     aCbxAutoOrigin.Hide();
     794                 :            : 
     795                 :          0 :     aTxtHelpCount.Hide();
     796                 :          0 :     aTxtHelp.Hide();
     797                 :            : 
     798                 :          0 :     m_aTxt_TimeResolution.Hide();
     799                 :          0 :     m_aLB_TimeResolution.Hide();
     800                 :          0 :     m_aCbx_AutoTimeResolution.Hide();
     801                 :            : 
     802                 :          0 :     aFmtFldStepMain.Hide();
     803                 :          0 :     m_aMt_MainDateStep.Hide();
     804                 :            : 
     805                 :          0 :     m_aLB_MainTimeUnit.Hide();
     806                 :          0 :     m_aLB_HelpTimeUnit.Hide();
     807                 :          0 : }
     808                 :            : 
     809                 :            : //.............................................................................
     810                 :            : } //namespace chart
     811                 :            : //.............................................................................
     812                 :            : 
     813                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10