1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19*cde9e8dcSAndrew Rist  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_chart2.hxx"
25cdf0e10cSrcweir #include "tp_PolarOptions.hxx"
26cdf0e10cSrcweir #include "tp_PolarOptions.hrc"
27cdf0e10cSrcweir #include "ResId.hxx"
28cdf0e10cSrcweir #include "chartview/ChartSfxItemIds.hxx"
29cdf0e10cSrcweir #include "NoWarningThisInCTOR.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <svl/eitem.hxx>
32cdf0e10cSrcweir #include <svl/intitem.hxx>
33cdf0e10cSrcweir #include <svtools/controldims.hrc>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //.............................................................................
36cdf0e10cSrcweir namespace chart
37cdf0e10cSrcweir {
38cdf0e10cSrcweir //.............................................................................
39cdf0e10cSrcweir 
PolarOptionsTabPage(Window * pWindow,const SfxItemSet & rInAttrs)40cdf0e10cSrcweir PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) :
41cdf0e10cSrcweir     SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ),
42cdf0e10cSrcweir     m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ),
43cdf0e10cSrcweir     m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
44cdf0e10cSrcweir     m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
45cdf0e10cSrcweir     m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
46cdf0e10cSrcweir     m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
47cdf0e10cSrcweir     m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
48cdf0e10cSrcweir     m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     FreeResource();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle );
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
~PolarOptionsTabPage()55cdf0e10cSrcweir PolarOptionsTabPage::~PolarOptionsTabPage()
56cdf0e10cSrcweir {
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
Create(Window * pWindow,const SfxItemSet & rOutAttrs)59cdf0e10cSrcweir SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     return new PolarOptionsTabPage( pWindow, rOutAttrs );
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rOutAttrs)64cdf0e10cSrcweir sal_Bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     if( m_aAngleDial.IsVisible() )
67cdf0e10cSrcweir     {
68cdf0e10cSrcweir         rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
69cdf0e10cSrcweir             static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100)));
70cdf0e10cSrcweir     }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     if( m_aCB_Clockwise.IsVisible() )
73cdf0e10cSrcweir         rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     if (m_aCB_IncludeHiddenCells.IsVisible())
76cdf0e10cSrcweir         rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     return sal_True;
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
Reset(const SfxItemSet & rInAttrs)81cdf0e10cSrcweir void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     const SfxPoolItem *pPoolItem = NULL;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     long nTmp;
86cdf0e10cSrcweir     if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, sal_True, &pPoolItem) == SFX_ITEM_SET)
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         m_aAngleDial.SetRotation( nTmp*100 );
91cdf0e10cSrcweir     }
92cdf0e10cSrcweir     else
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         m_aFL_StartingAngle.Show(sal_False);
95cdf0e10cSrcweir         m_aAngleDial.Show(sal_False);
96cdf0e10cSrcweir         m_aNF_StartingAngle.Show(sal_False);
97cdf0e10cSrcweir         m_aFT_Degrees.Show(sal_False);
98cdf0e10cSrcweir     }
99cdf0e10cSrcweir     if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, sal_True, &pPoolItem) == SFX_ITEM_SET)
100cdf0e10cSrcweir     {
101cdf0e10cSrcweir         sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
102cdf0e10cSrcweir         m_aCB_Clockwise.Check(bCheck);
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir     else
105cdf0e10cSrcweir     {
106cdf0e10cSrcweir         m_aCB_Clockwise.Show(sal_False);
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir     if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET)
109cdf0e10cSrcweir     {
110cdf0e10cSrcweir         bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
111cdf0e10cSrcweir         m_aCB_IncludeHiddenCells.Check(bVal);
112cdf0e10cSrcweir     }
113cdf0e10cSrcweir     else
114cdf0e10cSrcweir     {
115cdf0e10cSrcweir         m_aCB_IncludeHiddenCells.Show(sal_False);
116cdf0e10cSrcweir         m_aFL_PlotOptions.Show(sal_False);
117cdf0e10cSrcweir     }
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //.............................................................................
121cdf0e10cSrcweir } //namespace chart
122cdf0e10cSrcweir //.............................................................................
123