1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include "precompiled_chart2.hxx" 29 #include "tp_PolarOptions.hxx" 30 #include "tp_PolarOptions.hrc" 31 #include "ResId.hxx" 32 #include "chartview/ChartSfxItemIds.hxx" 33 #include "NoWarningThisInCTOR.hxx" 34 35 #include <svl/eitem.hxx> 36 #include <svl/intitem.hxx> 37 #include <svtools/controldims.hrc> 38 39 //............................................................................. 40 namespace chart 41 { 42 //............................................................................. 43 44 PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) : 45 SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ), 46 m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ), 47 m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ), 48 m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ), 49 m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ), 50 m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ), 51 m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ), 52 m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) ) 53 { 54 FreeResource(); 55 56 m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle ); 57 } 58 59 PolarOptionsTabPage::~PolarOptionsTabPage() 60 { 61 } 62 63 SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs ) 64 { 65 return new PolarOptionsTabPage( pWindow, rOutAttrs ); 66 } 67 68 sal_Bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) 69 { 70 if( m_aAngleDial.IsVisible() ) 71 { 72 rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE, 73 static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100))); 74 } 75 76 if( m_aCB_Clockwise.IsVisible() ) 77 rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked())); 78 79 if (m_aCB_IncludeHiddenCells.IsVisible()) 80 rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked())); 81 82 return sal_True; 83 } 84 85 void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs) 86 { 87 const SfxPoolItem *pPoolItem = NULL; 88 89 long nTmp; 90 if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, sal_True, &pPoolItem) == SFX_ITEM_SET) 91 { 92 nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue(); 93 94 m_aAngleDial.SetRotation( nTmp*100 ); 95 } 96 else 97 { 98 m_aFL_StartingAngle.Show(sal_False); 99 m_aAngleDial.Show(sal_False); 100 m_aNF_StartingAngle.Show(sal_False); 101 m_aFT_Degrees.Show(sal_False); 102 } 103 if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, sal_True, &pPoolItem) == SFX_ITEM_SET) 104 { 105 sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); 106 m_aCB_Clockwise.Check(bCheck); 107 } 108 else 109 { 110 m_aCB_Clockwise.Show(sal_False); 111 } 112 if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET) 113 { 114 bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); 115 m_aCB_IncludeHiddenCells.Check(bVal); 116 } 117 else 118 { 119 m_aCB_IncludeHiddenCells.Show(sal_False); 120 m_aFL_PlotOptions.Show(sal_False); 121 } 122 } 123 124 //............................................................................. 125 } //namespace chart 126 //............................................................................. 127