1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "tp_PolarOptions.hxx"
22 #include "chartview/ChartSfxItemIds.hxx"
24 #include <svl/eitem.hxx>
25 #include <svl/intitem.hxx>
26 #include <svtools/controldims.hrc>
31 PolarOptionsTabPage::PolarOptionsTabPage( vcl::Window
* pWindow
,const SfxItemSet
& rInAttrs
) :
34 ,"modules/schart/ui/tp_PolarOptions.ui"
37 get(m_pCB_Clockwise
, "CB_CLOCKWISE");
38 get(m_pFL_StartingAngle
, "frameANGLE");
39 get(m_pAngleDial
, "CT_ANGLE_DIAL");
40 get(m_pNF_StartingAngle
, "NF_STARTING_ANGLE");
41 get(m_pFL_PlotOptions
, "framePLOT_OPTIONS");
42 get(m_pCB_IncludeHiddenCells
, "CB_INCLUDE_HIDDEN_CELLS_POLAR");
44 m_pAngleDial
->SetLinkedField( m_pNF_StartingAngle
);
47 PolarOptionsTabPage::~PolarOptionsTabPage()
52 void PolarOptionsTabPage::dispose()
54 m_pCB_Clockwise
.clear();
55 m_pFL_StartingAngle
.clear();
57 m_pNF_StartingAngle
.clear();
58 m_pFL_PlotOptions
.clear();
59 m_pCB_IncludeHiddenCells
.clear();
60 SfxTabPage::dispose();
63 VclPtr
<SfxTabPage
> PolarOptionsTabPage::Create( vcl::Window
* pWindow
,const SfxItemSet
* rOutAttrs
)
65 return VclPtr
<PolarOptionsTabPage
>::Create( pWindow
, *rOutAttrs
);
68 bool PolarOptionsTabPage::FillItemSet( SfxItemSet
* rOutAttrs
)
70 if( m_pAngleDial
->IsVisible() )
72 rOutAttrs
->Put(SfxInt32Item(SCHATTR_STARTING_ANGLE
,
73 static_cast< sal_Int32
>(m_pAngleDial
->GetRotation()/100)));
76 if( m_pCB_Clockwise
->IsVisible() )
77 rOutAttrs
->Put(SfxBoolItem(SCHATTR_CLOCKWISE
,m_pCB_Clockwise
->IsChecked()));
79 if (m_pCB_IncludeHiddenCells
->IsVisible())
80 rOutAttrs
->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS
, m_pCB_IncludeHiddenCells
->IsChecked()));
85 void PolarOptionsTabPage::Reset(const SfxItemSet
* rInAttrs
)
87 const SfxPoolItem
*pPoolItem
= NULL
;
89 if (rInAttrs
->GetItemState(SCHATTR_STARTING_ANGLE
, true, &pPoolItem
) == SfxItemState::SET
)
91 long nTmp
= (long)static_cast<const SfxInt32Item
*>(pPoolItem
)->GetValue();
92 m_pAngleDial
->SetRotation( nTmp
*100 );
96 m_pFL_StartingAngle
->Show(false);
98 if (rInAttrs
->GetItemState(SCHATTR_CLOCKWISE
, true, &pPoolItem
) == SfxItemState::SET
)
100 bool bCheck
= static_cast< const SfxBoolItem
* >( pPoolItem
)->GetValue();
101 m_pCB_Clockwise
->Check(bCheck
);
105 m_pCB_Clockwise
->Show(false);
107 if (rInAttrs
->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS
, true, &pPoolItem
) == SfxItemState::SET
)
109 bool bVal
= static_cast<const SfxBoolItem
*>(pPoolItem
)->GetValue();
110 m_pCB_IncludeHiddenCells
->Check(bVal
);
114 m_pFL_PlotOptions
->Show(false);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */