Files
libreoffice/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx

201 lines
6.5 KiB
C++
Raw Normal View History

2003-10-06 08:58:36 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2003-10-06 08:58:36 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2003-10-06 08:58:36 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2003-10-06 08:58:36 +00:00
*
* $RCSfile: tp_SeriesToAxis.cxx,v $
* $Revision: 1.10 $
2003-10-06 08:58:36 +00:00
*
* This file is part of OpenOffice.org.
2003-10-06 08:58:36 +00:00
*
* 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.
2003-10-06 08:58:36 +00:00
*
* 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).
2003-10-06 08:58:36 +00:00
*
* 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.
2003-10-06 08:58:36 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
2003-10-06 08:58:36 +00:00
#include "tp_SeriesToAxis.hxx"
#include "ResId.hxx"
#include "TabPages.hrc"
#include "chartview/ChartSfxItemIds.hxx"
#include "NoWarningThisInCTOR.hxx"
2003-10-06 08:58:36 +00:00
// header for class SfxBoolItem
#include <svtools/eitem.hxx>
// header for SfxInt32Item
#include <svtools/intitem.hxx>
//.............................................................................
namespace chart
{
//.............................................................................
SchOptionTabPage::SchOptionTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
SfxTabPage(pWindow, SchResId(TP_OPTIONS), rInAttrs),
aGrpAxis(this, SchResId(GRP_OPT_AXIS)),
aRbtAxis1(this,SchResId(RBT_OPT_AXIS_1)),
aRbtAxis2(this,SchResId(RBT_OPT_AXIS_2)),
aGrpBar(this, SchResId(GB_BAR)),
aFTGap(this,SchResId(FT_GAP)),
aMTGap(this,SchResId(MT_GAP)),
aFTOverlap(this,SchResId(FT_OVERLAP)),
aMTOverlap(this,SchResId(MT_OVERLAP)),
aCBConnect(this,SchResId(CB_CONNECTOR)),
aCBAxisSideBySide(this,SchResId(CB_BARS_SIDE_BY_SIDE))
2003-10-06 08:58:36 +00:00
{
FreeResource();
aRbtAxis1.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
aRbtAxis2.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
2003-10-06 08:58:36 +00:00
}
/*************************************************************************
|*
|* Dtor
|*
\************************************************************************/
SchOptionTabPage::~SchOptionTabPage()
{
}
IMPL_LINK( SchOptionTabPage, EnableHdl, RadioButton *, EMPTYARG )
{
if( m_nAllSeriesAxisIndex == 0 )
aCBAxisSideBySide.Enable( aRbtAxis2.IsChecked());
else if( m_nAllSeriesAxisIndex == 1 )
aCBAxisSideBySide.Enable( aRbtAxis1.IsChecked());
return 0;
}
2003-10-06 08:58:36 +00:00
/*************************************************************************
|*
|* Erzeugung
|*
\*************************************************************************/
SfxTabPage* SchOptionTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
{
return new SchOptionTabPage(pWindow, rOutAttrs);
}
/*************************************************************************
|*
|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
|*
\*************************************************************************/
BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
if(aRbtAxis2.IsChecked())
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
else
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
if(aMTGap.IsVisible())
rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,static_cast< sal_Int32 >( aMTGap.GetValue())));
2003-10-06 08:58:36 +00:00
if(aMTOverlap.IsVisible())
rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,static_cast< sal_Int32 >( aMTOverlap.GetValue())));
2003-10-06 08:58:36 +00:00
if(aCBConnect.IsVisible())
rOutAttrs.Put(SfxBoolItem(SCHATTR_BAR_CONNECT,aCBConnect.IsChecked()));
2003-10-06 08:58:36 +00:00
// model property is "group bars per axis", UI feature is the other way
// round: "show bars side by side"
if(aCBAxisSideBySide.IsVisible())
rOutAttrs.Put(SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, ! aCBAxisSideBySide.IsChecked()));
2003-10-06 08:58:36 +00:00
return TRUE;
}
/*************************************************************************
|*
|* Initialisierung
|*
\*************************************************************************/
void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs)
{
const SfxPoolItem *pPoolItem = NULL;
aRbtAxis1.Check(TRUE);
aRbtAxis2.Check(FALSE);
if (rInAttrs.GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET)
{
long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
if(nVal==CHART_AXIS_SECONDARY_Y)
{
aRbtAxis2.Check(TRUE);
aRbtAxis1.Check(FALSE);
}
}
long nTmp;
if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET)
2003-10-06 08:58:36 +00:00
{
nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
aMTGap.SetValue(nTmp);
}
else
{
aMTGap.Show(FALSE);
aFTGap.Show(FALSE);
}
if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, TRUE, &pPoolItem) == SFX_ITEM_SET)
2003-10-06 08:58:36 +00:00
{
nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
aMTOverlap.SetValue(nTmp);
}
else
{
aMTOverlap.Show(FALSE);
aFTOverlap.Show(FALSE);
}
if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, TRUE, &pPoolItem) == SFX_ITEM_SET)
2003-10-06 08:58:36 +00:00
{
BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCBConnect.Check(bCheck);
2003-10-06 08:58:36 +00:00
}
else
{
aCBConnect.Show(FALSE);
}
if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, TRUE, &pPoolItem) == SFX_ITEM_SET)
{
m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
aCBAxisSideBySide.Disable();
}
if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, TRUE, &pPoolItem) == SFX_ITEM_SET)
{
// model property is "group bars per axis", UI feature is the other way
// round: "show bars side by side"
BOOL bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCBAxisSideBySide.Check( bCheck );
}
else
{
aCBAxisSideBySide.Show(FALSE);
}
2003-10-06 08:58:36 +00:00
}
//.............................................................................
} //namespace chart
//.............................................................................