update dev300-m58
[ooovba.git] / chart2 / source / controller / dialogs / tp_PolarOptions.cxx
blobbf0c1e6554bf37c80e7019be4ecfefdae762dad7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tp_PolarOptions.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "precompiled_chart2.hxx"
32 #include "tp_PolarOptions.hxx"
33 #include "tp_PolarOptions.hrc"
34 #include "ResId.hxx"
35 #include "chartview/ChartSfxItemIds.hxx"
36 #include "NoWarningThisInCTOR.hxx"
38 #include <svtools/eitem.hxx>
39 #include <svtools/intitem.hxx>
40 #include <svtools/controldims.hrc>
42 //.............................................................................
43 namespace chart
45 //.............................................................................
47 PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) :
48 SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ),
49 m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ),
50 m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
51 m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
52 m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
53 m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
54 m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
55 m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
57 FreeResource();
59 m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle );
62 PolarOptionsTabPage::~PolarOptionsTabPage()
66 SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
68 return new PolarOptionsTabPage( pWindow, rOutAttrs );
71 BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
73 if( m_aAngleDial.IsVisible() )
75 rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
76 static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100)));
79 if( m_aCB_Clockwise.IsVisible() )
80 rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
82 if (m_aCB_IncludeHiddenCells.IsVisible())
83 rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
85 return TRUE;
88 void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
90 const SfxPoolItem *pPoolItem = NULL;
92 long nTmp;
93 if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET)
95 nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
97 m_aAngleDial.SetRotation( nTmp*100 );
99 else
101 m_aFL_StartingAngle.Show(FALSE);
102 m_aAngleDial.Show(FALSE);
103 m_aNF_StartingAngle.Show(FALSE);
104 m_aFT_Degrees.Show(FALSE);
106 if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, TRUE, &pPoolItem) == SFX_ITEM_SET)
108 BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
109 m_aCB_Clockwise.Check(bCheck);
111 else
113 m_aCB_Clockwise.Show(FALSE);
115 if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
117 bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
118 m_aCB_IncludeHiddenCells.Check(bVal);
120 else
122 m_aCB_IncludeHiddenCells.Show(FALSE);
123 m_aFL_PlotOptions.Show(FALSE);
127 //.............................................................................
128 } //namespace chart
129 //.............................................................................