LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/dialogs - res_DataLabel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 209 0.0 %
Date: 2012-12-27 Functions: 0 13 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 "res_DataLabel.hxx"
      22             : #include "res_DataLabel_IDs.hrc"
      23             : 
      24             : #include "Strings.hrc"
      25             : #include "ResId.hxx"
      26             : #include "chartview/ChartSfxItemIds.hxx"
      27             : #include "NoWarningThisInCTOR.hxx"
      28             : #include "dlg_NumberFormat.hxx"
      29             : 
      30             : // header for class SvxNumberInfoItem
      31             : #include <svx/numinf.hxx>
      32             : #include <svl/eitem.hxx>
      33             : // for SfxUInt32Item
      34             : #include <svl/intitem.hxx>
      35             : // header for class SfxStringItem
      36             : #include <svl/stritem.hxx>
      37             : //SfxIntegerListItem
      38             : #include <svl/ilstitem.hxx>
      39             : #include <editeng/eeitem.hxx>
      40             : #include <editeng/frmdiritem.hxx>
      41             : 
      42             : // header for define RET_OK
      43             : #include <vcl/msgbox.hxx>
      44             : #include <svx/svxids.hrc>
      45             : // header for SvNumberFormatter
      46             : #include <svl/zforlist.hxx>
      47             : #include <svtools/controldims.hrc>
      48             : 
      49             : 
      50             : //.............................................................................
      51             : namespace chart
      52             : {
      53             : //.............................................................................
      54             : 
      55             : namespace
      56             : {
      57             : 
      58           0 : bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
      59             : {
      60           0 :     bool bSet = false;
      61           0 :     const SfxPoolItem *pItem1 = NULL;
      62           0 :     if( rSet.GetItemState( nValueWhich, sal_True, &pItem1 ) == SFX_ITEM_SET )
      63             :     {
      64           0 :         const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
      65           0 :         if( pNumItem )
      66             :         {
      67           0 :             rnFormatKeyOut = pNumItem->GetValue();
      68           0 :             bSet = true;
      69             :         }
      70             :     }
      71             : 
      72           0 :     rbSourceFormatMixedStateOut=true;
      73           0 :     const SfxPoolItem *pItem2 = NULL;
      74           0 :     if( rSet.GetItemState( nSourceFormatWhich, sal_True, &pItem2 ) == SFX_ITEM_SET )
      75             :     {
      76           0 :         const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
      77           0 :         if( pBoolItem )
      78             :         {
      79           0 :             rbSourceFormatOut = pBoolItem->GetValue();
      80           0 :             rbSourceFormatMixedStateOut=false;
      81             :         }
      82             :     }
      83           0 :     return bSet;
      84             : }
      85             : 
      86           0 : void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, CheckBox& rCheckbox )
      87             : {
      88           0 :     rCheckbox.EnableTriState( sal_False );
      89             : 
      90           0 :     const SfxPoolItem *pPoolItem = NULL;
      91           0 :     if( rInAttrs.GetItemState(nWhichId, sal_True, &pPoolItem) == SFX_ITEM_SET )
      92           0 :         rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
      93             :     else
      94             :     {
      95           0 :         rCheckbox.EnableTriState( sal_True );
      96           0 :         rCheckbox.SetState( STATE_DONTKNOW );
      97             :     }
      98           0 : }
      99             : 
     100             : }//end anonymous namespace
     101             : 
     102           0 : DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
     103             :     : m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
     104             :     m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
     105             :     m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
     106             :     m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)),
     107             :     m_aCBCategory(pWindow, SchResId(CB_CATEGORY)),
     108             :     m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)),
     109             :     m_aSeparatorResources(pWindow),
     110             :     m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
     111             :     m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
     112             :     m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
     113             :     m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
     114             :     m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
     115             :     m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
     116             :     m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
     117             :     m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
     118             :     m_pNumberFormatter(0),
     119             :     m_bNumberFormatMixedState(true),
     120             :     m_bPercentFormatMixedState(true),
     121             :     m_nNumberFormatForValue(0),
     122             :     m_nNumberFormatForPercent(11),
     123             :     m_bSourceFormatMixedState(true),
     124             :     m_bPercentSourceMixedState(true),
     125             :     m_bSourceFormatForValue(true),
     126             :     m_bSourceFormatForPercent(true),
     127             :     m_pWindow(pWindow),
     128           0 :     m_pPool(rInAttrs.GetPool())
     129             : {
     130             :     //fill label placement list
     131           0 :     std::map< sal_Int32, OUString > aPlacementToStringMap;
     132           0 :     for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
     133           0 :         aPlacementToStringMap[nEnum] = m_aLB_LabelPlacement.GetEntry(static_cast<sal_uInt16>(nEnum));
     134             : 
     135           0 :     ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
     136           0 :     const SfxPoolItem *pPoolItem = NULL;
     137           0 :     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, sal_True, &pPoolItem) == SFX_ITEM_SET )
     138           0 :         aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
     139             : 
     140           0 :     m_aLB_LabelPlacement.Clear();
     141           0 :     for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
     142             :     {
     143           0 :         sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN );
     144           0 :         sal_Int32 nPlacement = aAvailabelPlacementList[nN];
     145           0 :         m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
     146           0 :         m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
     147           0 :         m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
     148             :     }
     149           0 :     m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
     150             : 
     151             :     //replace&resize push buttons and resize checkboxes
     152           0 :     Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
     153           0 :     long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
     154           0 :         + 20; //the min with is to small to fit, hm... so add alittle
     155           0 :     long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
     156           0 :     long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
     157           0 :     long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
     158           0 :     if( nNewPBXPos + nPBWidth > nPageWidth )
     159             :     {
     160           0 :         if( nPBWidth > nPageWidth/2 )
     161           0 :             nPBWidth = nPageWidth/2;
     162           0 :         nNewPBXPos = nPageWidth-nPBWidth;
     163           0 :         nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
     164             :     }
     165           0 :     m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
     166           0 :     m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
     167             : 
     168           0 :     Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
     169           0 :     aPBSize.setWidth( nPBWidth );
     170           0 :     m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
     171           0 :     m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
     172             : 
     173           0 :     Size aCBSize( m_aCBNumber.GetSizePixel() );
     174           0 :     aCBSize.setWidth(nCBXWidth);
     175           0 :     m_aCBNumber.SetSizePixel( aCBSize );
     176           0 :     m_aCBPercent.SetSizePixel( aCBSize );
     177             : 
     178             :     //place and align separator and label placement listboxes
     179           0 :     Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
     180           0 :     aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
     181           0 :     m_aFT_LabelPlacement.SetSizePixel(aSize);
     182             : 
     183           0 :     long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
     184             : 
     185           0 :     m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
     186           0 :     m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
     187           0 :     m_aSeparatorResources.Show(true);
     188             : 
     189           0 :     aSize = m_aLB_LabelPlacement.GetSizePixel();
     190           0 :     aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
     191           0 :     m_aLB_LabelPlacement.SetSizePixel(aSize);
     192           0 :     m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
     193             : 
     194             :     //some click handler
     195           0 :     m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
     196           0 :     m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
     197           0 :     m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
     198           0 :     m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
     199           0 :     m_aCBCategory.SetClickHdl(  LINK( this, DataLabelResources, CheckHdl ));
     200           0 :     m_aCBSymbol.SetClickHdl(  LINK( this, DataLabelResources, CheckHdl ));
     201             : 
     202           0 :     m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
     203           0 :     m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
     204             : 
     205           0 :     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, sal_True, &pPoolItem) == SFX_ITEM_SET )
     206             :     {
     207           0 :         bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
     208           0 :         if( bForbidPercentValue )
     209           0 :             m_aCBPercent.Enable(false);
     210             :     }
     211             : 
     212           0 :     m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
     213           0 : }
     214             : 
     215           0 : DataLabelResources::~DataLabelResources()
     216             : {
     217           0 : }
     218             : 
     219           0 : void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter )
     220             : {
     221           0 :     m_pNumberFormatter = pFormatter;
     222           0 : }
     223             : 
     224           0 : IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
     225             : {
     226           0 :     if( !m_pPool || !m_pNumberFormatter )
     227             :     {
     228             :         OSL_FAIL("Missing item pool or number formatter");
     229           0 :         return 1;
     230             :     }
     231             : 
     232           0 :     if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked())
     233           0 :         m_aCBNumber.Check();
     234           0 :     else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked())
     235           0 :         m_aCBPercent.Check();
     236             : 
     237           0 :     SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
     238           0 :     aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
     239             : 
     240           0 :     bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
     241             : 
     242           0 :     sal_uLong& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
     243           0 :     bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue;
     244           0 :     bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState;
     245           0 :     bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState;
     246             : 
     247           0 :     if(!rbMixedState)
     248           0 :         aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
     249           0 :     aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
     250             : 
     251           0 :     NumberFormatDialog aDlg(m_pWindow, aNumberSet);
     252           0 :     if( bPercent )
     253           0 :         aDlg.SetText( String( SchResId( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ) );
     254           0 :     if( RET_OK == aDlg.Execute() )
     255             :     {
     256           0 :         const SfxItemSet* pResult = aDlg.GetOutputItemSet();
     257           0 :         if( pResult )
     258             :         {
     259           0 :             bool bOldSource = rUseSourceFormat;
     260           0 :             sal_uLong nOldFormat = rnFormatKey;
     261           0 :             bool bOldMixedState = rbMixedState || rbSourceMixedState;
     262             : 
     263           0 :             rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
     264             : 
     265             :             //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly
     266           0 :             if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey )
     267           0 :                 rbMixedState = rbSourceMixedState = true;
     268             :         }
     269             :     }
     270           0 :     return 0;
     271             : }
     272             : 
     273           0 : IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
     274             : {
     275           0 :     if( pBox )
     276           0 :         pBox->EnableTriState( sal_False );
     277           0 :     EnableControls();
     278           0 :     return 0;
     279             : }
     280             : 
     281           0 : void DataLabelResources::EnableControls()
     282             : {
     283           0 :     m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
     284             : 
     285             :     // Enable or disable separator, placement and direction based on the check
     286             :     // box states. Note that the check boxes are tri-state.
     287             :     {
     288           0 :         long nNumberOfCheckedLabelParts = 0;
     289           0 :         if (m_aCBNumber.GetState() != STATE_NOCHECK)
     290           0 :             ++nNumberOfCheckedLabelParts;
     291           0 :         if (m_aCBPercent.GetState() != STATE_NOCHECK && m_aCBPercent.IsEnabled())
     292           0 :             ++nNumberOfCheckedLabelParts;
     293           0 :         if (m_aCBCategory.GetState() != STATE_NOCHECK)
     294           0 :             ++nNumberOfCheckedLabelParts;
     295           0 :         m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
     296           0 :         bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
     297           0 :         m_aFT_TextDirection.Enable( bEnableTextDir );
     298           0 :         m_aLB_TextDirection.Enable( bEnableTextDir );
     299           0 :         bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1;
     300           0 :         m_aFT_LabelPlacement.Enable( bEnablePlacement );
     301           0 :         m_aLB_LabelPlacement.Enable( bEnablePlacement );
     302             :     }
     303             : 
     304           0 :     m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
     305           0 :     m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
     306             : 
     307           0 :     bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
     308           0 :     m_aFL_Rotate.Enable( bEnableRotation );
     309           0 :     m_aDC_Dial.Enable( bEnableRotation );
     310           0 :     m_aFT_Degrees.Enable( bEnableRotation );
     311           0 :     m_aNF_Degrees.Enable( bEnableRotation );
     312           0 : }
     313             : 
     314           0 : sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
     315             : {
     316           0 :     if( m_aCBNumber.IsChecked() )
     317             :     {
     318           0 :         if( !m_bNumberFormatMixedState )
     319           0 :             rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue ));
     320           0 :         if( !m_bSourceFormatMixedState )
     321           0 :             rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue ));
     322             :     }
     323           0 :     if( m_aCBPercent.IsChecked() )
     324             :     {
     325           0 :         if( !m_bPercentFormatMixedState )
     326           0 :             rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent ));
     327           0 :         if( !m_bPercentSourceMixedState )
     328           0 :             rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent ));
     329             :     }
     330             : 
     331           0 :     if( m_aCBNumber.GetState()!= STATE_DONTKNOW )
     332           0 :         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) );
     333           0 :     if( m_aCBPercent.GetState()!= STATE_DONTKNOW )
     334           0 :         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) );
     335           0 :     if( m_aCBCategory.GetState()!= STATE_DONTKNOW )
     336           0 :         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) );
     337           0 :     if( m_aCBSymbol.GetState()!= STATE_DONTKNOW )
     338           0 :         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) );
     339             : 
     340           0 :     rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) );
     341           0 :     ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
     342           0 :     if(aIt!=m_aListBoxToPlacementMap.end())
     343             :     {
     344           0 :         sal_Int32 nValue = aIt->second;
     345           0 :         rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
     346             :     }
     347             : 
     348           0 :     if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
     349           0 :         rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
     350             : 
     351           0 :     if( m_aDC_Dial.IsVisible() )
     352             :     {
     353           0 :         sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
     354           0 :         rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
     355             :     }
     356             : 
     357           0 :     return sal_True;
     358             : }
     359             : 
     360           0 : void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
     361             : {
     362             :     // default state
     363           0 :     m_aCBSymbol.Enable( sal_False );
     364             : 
     365           0 :     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
     366           0 :     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
     367           0 :     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory );
     368           0 :     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol );
     369             : 
     370           0 :     m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
     371           0 :     m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent ,  m_bPercentSourceMixedState);
     372             : 
     373           0 :     const SfxPoolItem *pPoolItem = NULL;
     374           0 :     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, sal_True, &pPoolItem) == SFX_ITEM_SET )
     375           0 :         m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() );
     376             :     else
     377           0 :         m_aSeparatorResources.SetDefault();
     378             : 
     379           0 :     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, sal_True, &pPoolItem) == SFX_ITEM_SET )
     380             :     {
     381           0 :         sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
     382           0 :         ::std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
     383           0 :         if(aIt!=m_aPlacementToListBoxMap.end())
     384             :         {
     385           0 :             sal_uInt16 nPos = aIt->second;
     386           0 :             m_aLB_LabelPlacement.SelectEntryPos( nPos );
     387             :         }
     388             :         else
     389           0 :             m_aLB_LabelPlacement.SetNoSelection();
     390             :     }
     391             :     else
     392           0 :         m_aLB_LabelPlacement.SetNoSelection();
     393             : 
     394           0 :     if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
     395           0 :         m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
     396             : 
     397           0 :     if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_True, &pPoolItem ) == SFX_ITEM_SET )
     398             :     {
     399           0 :         sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
     400           0 :         m_aDC_Dial.SetRotation( nDegrees );
     401             :     }
     402             :     else
     403           0 :     m_aDC_Dial.SetRotation( 0 );
     404             : 
     405           0 :     EnableControls();
     406           0 : }
     407             : 
     408             : //.............................................................................
     409             : } //namespace chart
     410             : //.............................................................................
     411             : 
     412             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10