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( 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 : }
50 :
51 0 : SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
52 : {
53 0 : return new PolarOptionsTabPage( pWindow, rOutAttrs );
54 : }
55 :
56 0 : bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
57 : {
58 0 : if( m_pAngleDial->IsVisible() )
59 : {
60 : rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
61 0 : static_cast< sal_Int32 >(m_pAngleDial->GetRotation()/100)));
62 : }
63 :
64 0 : if( m_pCB_Clockwise->IsVisible() )
65 0 : rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_pCB_Clockwise->IsChecked()));
66 :
67 0 : if (m_pCB_IncludeHiddenCells->IsVisible())
68 0 : rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_pCB_IncludeHiddenCells->IsChecked()));
69 :
70 0 : return true;
71 : }
72 :
73 0 : void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
74 : {
75 0 : const SfxPoolItem *pPoolItem = NULL;
76 :
77 0 : if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SFX_ITEM_SET)
78 : {
79 0 : long nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
80 0 : m_pAngleDial->SetRotation( nTmp*100 );
81 : }
82 : else
83 : {
84 0 : m_pFL_StartingAngle->Show(false);
85 : }
86 0 : if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SFX_ITEM_SET)
87 : {
88 0 : sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
89 0 : m_pCB_Clockwise->Check(bCheck);
90 : }
91 : else
92 : {
93 0 : m_pCB_Clockwise->Show(false);
94 : }
95 0 : if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SFX_ITEM_SET)
96 : {
97 0 : bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
98 0 : m_pCB_IncludeHiddenCells->Check(bVal);
99 : }
100 : else
101 : {
102 0 : m_pFL_PlotOptions->Show(false);
103 : }
104 0 : }
105 :
106 0 : } //namespace chart
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|