update dev300-m58
[ooovba.git] / chart2 / source / controller / dialogs / tp_PointGeometry.cxx
blob595b833a635b44a44daae4a064d75693b6553fc7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tp_PointGeometry.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "tp_PointGeometry.hxx"
34 #include "TabPages.hrc"
35 #include "res_BarGeometry.hxx"
36 #include "ResId.hxx"
38 #include "chartview/ChartSfxItemIds.hxx"
40 // header for SfxInt32Item
41 #include <svtools/intitem.hxx>
42 // header for class Svx3DHorizontalSegmentsItem
43 #include <svx/svx3ditems.hxx>
45 //.............................................................................
46 namespace chart
48 //.............................................................................
50 SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
51 : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs)
52 , m_pGeometryResources(0)
54 Size aPageSize( this->GetSizePixel() );
55 Point aPos( this->LogicToPixel( Point(6,6), MapMode(MAP_APPFONT) ) );
56 m_pGeometryResources = new BarGeometryResources( this );
57 m_pGeometryResources->SetPosPixel( aPos );
60 SchLayoutTabPage::~SchLayoutTabPage()
62 if( m_pGeometryResources )
63 delete m_pGeometryResources;
66 SfxTabPage* SchLayoutTabPage::Create(Window* pWindow,
67 const SfxItemSet& rOutAttrs)
69 return new SchLayoutTabPage(pWindow, rOutAttrs);
72 BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
75 if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount())
77 long nShape=CHART_SHAPE3D_SQUARE;
78 long nSegs=32;
80 nShape = m_pGeometryResources->GetSelectEntryPos();
81 if(nShape==CHART_SHAPE3D_PYRAMID)
82 nSegs=4;
84 rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
85 rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs));
87 return TRUE;
90 void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs)
92 const SfxPoolItem *pPoolItem = NULL;
94 if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET)
96 long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
97 if(m_pGeometryResources)
99 m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal));
100 m_pGeometryResources->Show( true );
105 //.............................................................................
106 } //namespace chart
107 //.............................................................................