Files
libreoffice/chart2/source/controller/dialogs/res_DataLabel.cxx
Release Engineers 44569a657c CWS-TOOLING: integrate CWS bubblechart
2009-06-17 08:41:14 +0200 hde  r273051 : i101635: added new charttype bubble
2009-06-17 08:39:37 +0200 hde  r273050 : i101635: created new testcase tCreateNewBubbleChart
2009-06-17 08:38:07 +0200 hde  r273049 : i101635: created new testcase tCreateNewBubbleChart
2009-06-15 15:22:32 +0200 hde  r272991 : 101635
2009-06-11 12:44:01 +0200 iha  r272864 : rebase to dev300m50
2009-06-10 23:27:54 +0200 iha  r272841 : CWS-TOOLING: rebase CWS bubblechart to trunk@272827 (milestone: DEV300:m50)
2009-06-04 18:07:35 +0200 iha  r272649 : #i64689# Bubble Chart
2009-06-04 17:26:44 +0200 iha  r272647 : #i64689# Bubble Chart
2009-06-04 11:24:25 +0200 iha  r272618 : #i64689# add more spacing between bubbles and data labels
2009-05-26 18:05:23 +0200 ufi  r272314 : i101637
2009-04-22 14:37:50 +0200 iha  r271115 : #i64689# bubble chart
2009-04-21 17:52:23 +0200 iha  r271052 : #i64689# bubble chart
2009-04-21 17:50:48 +0200 iha  r271051 : #i76728# type icon for xy chart
2009-04-21 17:25:52 +0200 iha  r271049 : #i76728# type icon for xy chart
2009-04-09 11:18:09 +0200 iha  r270685 : #i100977# autoscaling works not correct if missing values should be treated as zero
2009-04-08 16:39:43 +0200 iha  r270656 : #i64689# bubble chart - missing value treatment
2009-04-08 15:13:25 +0200 iha  r270655 : #i64689# bubble chart - remove unused code
2009-04-08 15:12:19 +0200 iha  r270653 : #i64689# bubble chart - determine sereis length correctly on export
2009-04-08 14:22:43 +0200 iha  r270650 : #i64689# bubble chart - remove unused code
2009-04-08 14:12:09 +0200 iha  r270646 : #i64689# bubble chart - export domains even if no main sequence was found
2009-04-08 14:11:07 +0200 iha  r270645 : #i64689# bubble chart - don't replace missing size values with 1.0
2009-04-07 16:20:22 +0200 iha  r270602 : #i64689# bubble chart - do not offer percent values for data label display for xy and bubble chart
2009-04-07 16:17:42 +0200 iha  r270601 : remove superfluous code
2009-04-06 16:39:32 +0200 iha  r270569 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat
2009-04-02 17:33:33 +0200 iha  r270427 : use input string for formatting in data table during edit
2009-04-02 16:00:29 +0200 iha  r270413 : #i64689# bubble chart - when creating a new series within the data table give it the same number format as the former series, thus the new bubble size values can be edited with the same format immidiately
2009-04-02 11:25:33 +0200 iha  r270385 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat
2009-04-01 11:32:03 +0200 iha  r270312 : #i64689# bubble chart - add further parameter for view creation
2009-03-31 17:52:08 +0200 iha  r270291 : #i64689# bubble chart - scale bubble size with diagram size
2009-03-31 13:38:13 +0200 iha  r270278 : #i64689# bubble chart - wrong size for small values < 1
2009-03-27 19:11:07 +0100 iha  r270169 : #i64689# bubble chart
2009-03-27 19:07:11 +0100 iha  r270168 : #i64689# bubble chart - remove unused code
2009-03-27 18:33:57 +0100 iha  r270167 : #i64689# bubble chart - create no shape for invalid sizes
2009-03-27 15:18:21 +0100 iha  r270157 : #i76728# type icon for xy chart
2009-03-27 14:34:38 +0100 iha  r270156 : #i64689# bubble chart - correct scaling
2009-03-27 14:27:27 +0100 iha  r270155 : #i64689# bubble chart - images
2009-03-27 14:25:45 +0100 iha  r270154 : #i64689# bubble chart - images
2009-03-27 11:38:57 +0100 iha  r270142 : #i64689# bubble chart - values-size is the main series
2009-03-27 11:30:20 +0100 iha  r270140 : #i64689# correct order of sequences after load thus switching charttypes afterwards produces expected results now
2009-03-26 10:22:55 +0100 iha  r270056 : #i64689# bubble chart
2009-03-24 17:45:15 +0100 iha  r269984 : #i64689# bubble chart - user properties from points (not only from the series)
2009-03-24 15:10:57 +0100 dr  r269954 : #i64989# export bubble charts to xls
2009-03-24 14:55:29 +0100 dr  r269952 : #i64989# import bubble charts from xls
2009-03-24 14:54:46 +0100 dr  r269950 : #i64989# import bubble charts from ooxml
2009-03-23 18:59:08 +0100 iha  r269895 : further cleanups possible with new member m_aGlobalSeriesImportInfo
2009-03-23 16:54:04 +0100 iha  r269886 : #i64689# bubble chart - a single sequence must be interpreted as sizes because of ODF specification
2009-03-23 16:50:43 +0100 iha  r269885 : #i64689# save&load bubble chart
2009-03-20 19:30:29 +0100 iha  r269826 : CWS-TOOLING: rebase CWS bubblechart to trunk@269781 (milestone: DEV300:m44)
2009-03-19 11:30:33 +0100 iha  r269732 : #i64689# rename SchXMLCategoriesDomainContext to SchXMLCategoriesContext avoid confusion with domains
2009-03-18 17:11:13 +0100 iha  r269693 : #i64689# add charttype bubble
2009-03-18 17:09:22 +0100 iha  r269692 : #i64689# remove unused code
2009-03-13 12:18:26 +0100 iha  r269467 : #i64689# corrected lineends
2009-03-12 11:25:14 +0100 iha  r269376 : #i64689# bubble chart (part 1)
2009-07-02 19:17:43 +00:00

423 lines
18 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: res_DataLabel.cxx,v $
* $Revision: 1.5.72.1 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "res_DataLabel.hxx"
#include "res_DataLabel_IDs.hrc"
#include "Strings.hrc"
#include "ResId.hxx"
#include "chartview/ChartSfxItemIds.hxx"
#include "NoWarningThisInCTOR.hxx"
#include "dlg_NumberFormat.hxx"
// header for class SvxNumberInfoItem
#include <svx/numinf.hxx>
#include <svtools/eitem.hxx>
// for SfxUInt32Item
#include <svtools/intitem.hxx>
// header for class SfxStringItem
#include <svtools/stritem.hxx>
//SfxIntegerListItem
#include <svtools/ilstitem.hxx>
#include <svx/eeitem.hxx>
#include <svx/frmdiritem.hxx>
// header for define RET_OK
#include <vcl/msgbox.hxx>
#include <svx/svxids.hrc>
// header for SvNumberFormatter
#include <svtools/zforlist.hxx>
#include <svtools/controldims.hrc>
//.............................................................................
namespace chart
{
//.............................................................................
namespace
{
bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich, USHORT nSourceFormatWhich, ULONG& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
{
bool bSet = false;
const SfxPoolItem *pItem1 = NULL;
if( rSet.GetItemState( nValueWhich, TRUE, &pItem1 ) == SFX_ITEM_SET )
{
const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
if( pNumItem )
{
rnFormatKeyOut = pNumItem->GetValue();
bSet = true;
}
}
rbSourceFormatMixedStateOut=true;
const SfxPoolItem *pItem2 = NULL;
if( rSet.GetItemState( nSourceFormatWhich, TRUE, &pItem2 ) == SFX_ITEM_SET )
{
const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
if( pBoolItem )
{
rbSourceFormatOut = pBoolItem->GetValue();
rbSourceFormatMixedStateOut=false;
}
}
return bSet;
}
void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, CheckBox& rCheckbox )
{
rCheckbox.EnableTriState( FALSE );
const SfxPoolItem *pPoolItem = NULL;
if( rInAttrs.GetItemState(nWhichId, TRUE, &pPoolItem) == SFX_ITEM_SET )
rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
else
{
rCheckbox.EnableTriState( TRUE );
rCheckbox.SetState( STATE_DONTKNOW );
}
}
}//end anonymous namespace
DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
: m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)),
m_aCBCategory(pWindow, SchResId(CB_CATEGORY)),
m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)),
m_aSeparatorResources(pWindow),
m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
m_pNumberFormatter(0),
m_bNumberFormatMixedState(true),
m_bPercentFormatMixedState(true),
m_nNumberFormatForValue(0),
m_nNumberFormatForPercent(11),
m_bSourceFormatMixedState(true),
m_bPercentSourceMixedState(true),
m_bSourceFormatForValue(true),
m_bSourceFormatForPercent(true),
m_pWindow(pWindow),
m_pPool(rInAttrs.GetPool())
{
//fill label placement list
std::map< sal_Int32, XubString > aPlacementToStringMap;
for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<USHORT>(nEnum));
::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
const SfxPoolItem *pPoolItem = NULL;
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET )
aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
m_aLB_LabelPlacement.Clear();
for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
{
USHORT nListBoxPos = static_cast<USHORT>( nN );
sal_Int32 nPlacement = aAvailabelPlacementList[nN];
m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
}
m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
//replace&resize push buttons and resize checkboxes
Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
+ 20; //the min with is to small to fit, hm... so add alittle
long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
if( nNewPBXPos + nPBWidth > nPageWidth )
{
if( nPBWidth > nPageWidth/2 )
nPBWidth = nPageWidth/2;
nNewPBXPos = nPageWidth-nPBWidth;
nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
}
m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
aPBSize.setWidth( nPBWidth );
m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
Size aCBSize( m_aCBNumber.GetSizePixel() );
aCBSize.setWidth(nCBXWidth);
m_aCBNumber.SetSizePixel( aCBSize );
m_aCBPercent.SetSizePixel( aCBSize );
//place and align separator and label placement listboxes
Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
m_aFT_LabelPlacement.SetSizePixel(aSize);
long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
m_aSeparatorResources.Show(true);
aSize = m_aLB_LabelPlacement.GetSizePixel();
aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
m_aLB_LabelPlacement.SetSizePixel(aSize);
m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
//some click handler
m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
m_aCBCategory.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
m_aCBSymbol.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, TRUE, &pPoolItem) == SFX_ITEM_SET )
{
bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
if( bForbidPercentValue )
m_aCBPercent.Enable(false);
}
m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
}
DataLabelResources::~DataLabelResources()
{
}
void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter )
{
m_pNumberFormatter = pFormatter;
}
IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
{
if( !m_pPool || !m_pNumberFormatter )
{
DBG_ERROR("Missing item pool or number formatter");
return 1;
}
if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked())
m_aCBNumber.Check();
else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked())
m_aCBPercent.Check();
SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
ULONG& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue;
bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState;
bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState;
if(!rbMixedState)
aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
NumberFormatDialog aDlg(m_pWindow, aNumberSet);
if( bPercent )
aDlg.SetText( String( SchResId( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ) );
if( RET_OK == aDlg.Execute() )
{
const SfxItemSet* pResult = aDlg.GetOutputItemSet();
if( pResult )
{
bool bOldSource = rUseSourceFormat;
ULONG nOldFormat = rnFormatKey;
bool bOldMixedState = rbMixedState || rbSourceMixedState;
rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
//todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly
if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey )
rbMixedState = rbSourceMixedState = true;
}
}
return 0;
}
IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
{
if( pBox )
pBox->EnableTriState( FALSE );
EnableControls();
return 0;
}
void DataLabelResources::EnableControls()
{
m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
//enable separator
{
long nNumberOfCheckedLabelParts = 0;
if( m_aCBNumber.IsChecked() )
++nNumberOfCheckedLabelParts;
if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
++nNumberOfCheckedLabelParts;
if( m_aCBCategory.IsChecked() )
++nNumberOfCheckedLabelParts;
m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
m_aFT_TextDirection.Enable( bEnableTextDir );
m_aLB_TextDirection.Enable( bEnableTextDir );
bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1;
m_aFT_LabelPlacement.Enable( bEnablePlacement );
m_aLB_LabelPlacement.Enable( bEnablePlacement );
}
m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
m_aFL_Rotate.Enable( bEnableRotation );
m_aDC_Dial.Enable( bEnableRotation );
m_aFT_Degrees.Enable( bEnableRotation );
m_aNF_Degrees.Enable( bEnableRotation );
}
BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
{
if( m_aCBNumber.IsChecked() )
{
if( !m_bNumberFormatMixedState )
rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue ));
if( !m_bSourceFormatMixedState )
rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue ));
}
if( m_aCBPercent.IsChecked() )
{
if( !m_bPercentFormatMixedState )
rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent ));
if( !m_bPercentSourceMixedState )
rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent ));
}
if( m_aCBNumber.GetState()!= STATE_DONTKNOW )
rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) );
if( m_aCBPercent.GetState()!= STATE_DONTKNOW )
rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) );
if( m_aCBCategory.GetState()!= STATE_DONTKNOW )
rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) );
if( m_aCBSymbol.GetState()!= STATE_DONTKNOW )
rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) );
rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) );
::std::map< USHORT, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
if(aIt!=m_aListBoxToPlacementMap.end())
{
sal_Int32 nValue = aIt->second;
rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
}
if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
if( m_aDC_Dial.IsVisible() )
{
sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
return TRUE;
}
void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
{
// default state
m_aCBSymbol.Enable( FALSE );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol );
m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
const SfxPoolItem *pPoolItem = NULL;
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, TRUE, &pPoolItem) == SFX_ITEM_SET )
m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() );
else
m_aSeparatorResources.SetDefault();
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, TRUE, &pPoolItem) == SFX_ITEM_SET )
{
sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
::std::map< sal_Int32, USHORT >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
if(aIt!=m_aPlacementToListBoxMap.end())
{
USHORT nPos = aIt->second;
m_aLB_LabelPlacement.SelectEntryPos( nPos );
}
else
m_aLB_LabelPlacement.SetNoSelection();
}
else
m_aLB_LabelPlacement.SetNoSelection();
if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET )
{
sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
m_aDC_Dial.SetRotation( nDegrees );
}
else
m_aDC_Dial.SetRotation( 0 );
EnableControls();
}
//.............................................................................
} //namespace chart
//.............................................................................