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 "ResId.hxx"
22 : #include "chartview/ChartSfxItemIds.hxx"
23 :
24 : #include <svl/eitem.hxx>
25 : #include <svl/intitem.hxx>
26 : #include <svtools/controldims.hrc>
27 :
28 : namespace chart
29 : {
30 :
31 0 : PolarOptionsTabPage::PolarOptionsTabPage( vcl::Window* pWindow,const SfxItemSet& rInAttrs ) :
32 : SfxTabPage( pWindow
33 : ,"tp_PolarOptions"
34 : ,"modules/schart/ui/tp_PolarOptions.ui"
35 0 : ,&rInAttrs)
36 : {
37 0 : get(m_pCB_Clockwise, "CB_CLOCKWISE");
38 0 : get(m_pFL_StartingAngle, "frameANGLE");
39 0 : get(m_pAngleDial, "CT_ANGLE_DIAL");
40 0 : get(m_pNF_StartingAngle, "NF_STARTING_ANGLE");
41 0 : get(m_pFL_PlotOptions, "framePLOT_OPTIONS");
42 0 : get(m_pCB_IncludeHiddenCells, "CB_INCLUDE_HIDDEN_CELLS_POLAR");
43 :
44 0 : m_pAngleDial->SetLinkedField( m_pNF_StartingAngle );
45 0 : }
46 :
47 0 : PolarOptionsTabPage::~PolarOptionsTabPage()
48 : {
49 0 : disposeOnce();
50 0 : }
51 :
52 0 : void PolarOptionsTabPage::dispose()
53 : {
54 0 : m_pCB_Clockwise.clear();
55 0 : m_pFL_StartingAngle.clear();
56 0 : m_pAngleDial.clear();
57 0 : m_pNF_StartingAngle.clear();
58 0 : m_pFL_PlotOptions.clear();
59 0 : m_pCB_IncludeHiddenCells.clear();
60 0 : SfxTabPage::dispose();
61 0 : }
62 :
63 0 : VclPtr<SfxTabPage> PolarOptionsTabPage::Create( vcl::Window* pWindow,const SfxItemSet* rOutAttrs )
64 : {
65 0 : return VclPtr<PolarOptionsTabPage>::Create( pWindow, *rOutAttrs );
66 : }
67 :
68 0 : bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
69 : {
70 0 : if( m_pAngleDial->IsVisible() )
71 : {
72 : rOutAttrs->Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
73 0 : static_cast< sal_Int32 >(m_pAngleDial->GetRotation()/100)));
74 : }
75 :
76 0 : if( m_pCB_Clockwise->IsVisible() )
77 0 : rOutAttrs->Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_pCB_Clockwise->IsChecked()));
78 :
79 0 : if (m_pCB_IncludeHiddenCells->IsVisible())
80 0 : rOutAttrs->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_pCB_IncludeHiddenCells->IsChecked()));
81 :
82 0 : return true;
83 : }
84 :
85 0 : void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
86 : {
87 0 : const SfxPoolItem *pPoolItem = NULL;
88 :
89 0 : if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET)
90 : {
91 0 : long nTmp = (long)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
92 0 : m_pAngleDial->SetRotation( nTmp*100 );
93 : }
94 : else
95 : {
96 0 : m_pFL_StartingAngle->Show(false);
97 : }
98 0 : if (rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET)
99 : {
100 0 : bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
101 0 : m_pCB_Clockwise->Check(bCheck);
102 : }
103 : else
104 : {
105 0 : m_pCB_Clockwise->Show(false);
106 : }
107 0 : if (rInAttrs->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SfxItemState::SET)
108 : {
109 0 : bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
110 0 : m_pCB_IncludeHiddenCells->Check(bVal);
111 : }
112 : else
113 : {
114 0 : m_pFL_PlotOptions->Show(false);
115 : }
116 0 : }
117 :
118 57 : } //namespace chart
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|