Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "tp_PolarOptions.hxx"
21 : #include "tp_PolarOptions.hrc"
22 : #include "ResId.hxx"
23 : #include "chartview/ChartSfxItemIds.hxx"
24 : #include "NoWarningThisInCTOR.hxx"
25 :
26 : #include <svl/eitem.hxx>
27 : #include <svl/intitem.hxx>
28 : #include <svtools/controldims.hrc>
29 :
30 : //.............................................................................
31 : namespace chart
32 : {
33 : //.............................................................................
34 :
35 0 : PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) :
36 : SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ),
37 : m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ),
38 : m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
39 : m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
40 : m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
41 : m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
42 : m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
43 0 : m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
44 : {
45 0 : FreeResource();
46 :
47 0 : m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle );
48 0 : }
49 :
50 0 : PolarOptionsTabPage::~PolarOptionsTabPage()
51 : {
52 0 : }
53 :
54 0 : SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
55 : {
56 0 : return new PolarOptionsTabPage( pWindow, rOutAttrs );
57 : }
58 :
59 0 : sal_Bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
60 : {
61 0 : if( m_aAngleDial.IsVisible() )
62 : {
63 : rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
64 0 : static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100)));
65 : }
66 :
67 0 : if( m_aCB_Clockwise.IsVisible() )
68 0 : rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
69 :
70 0 : if (m_aCB_IncludeHiddenCells.IsVisible())
71 0 : rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
72 :
73 0 : return sal_True;
74 : }
75 :
76 0 : void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
77 : {
78 0 : const SfxPoolItem *pPoolItem = NULL;
79 :
80 0 : if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, sal_True, &pPoolItem) == SFX_ITEM_SET)
81 : {
82 0 : long nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
83 0 : m_aAngleDial.SetRotation( nTmp*100 );
84 : }
85 : else
86 : {
87 0 : m_aFL_StartingAngle.Show(sal_False);
88 0 : m_aAngleDial.Show(sal_False);
89 0 : m_aNF_StartingAngle.Show(sal_False);
90 0 : m_aFT_Degrees.Show(sal_False);
91 : }
92 0 : if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, sal_True, &pPoolItem) == SFX_ITEM_SET)
93 : {
94 0 : sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
95 0 : m_aCB_Clockwise.Check(bCheck);
96 : }
97 : else
98 : {
99 0 : m_aCB_Clockwise.Show(sal_False);
100 : }
101 0 : if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET)
102 : {
103 0 : bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
104 0 : m_aCB_IncludeHiddenCells.Check(bVal);
105 : }
106 : else
107 : {
108 0 : m_aCB_IncludeHiddenCells.Show(sal_False);
109 0 : m_aFL_PlotOptions.Show(sal_False);
110 : }
111 0 : }
112 :
113 : //.............................................................................
114 3 : } //namespace chart
115 : //.............................................................................
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|