merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_PointGeometry.cxx
blob661bae6ac326f2476e3c1d5e7936258e318031b3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #include "tp_PointGeometry.hxx"
31 #include "TabPages.hrc"
32 #include "res_BarGeometry.hxx"
33 #include "ResId.hxx"
35 #include "chartview/ChartSfxItemIds.hxx"
37 // header for SfxInt32Item
38 #include <svl/intitem.hxx>
39 // header for class Svx3DHorizontalSegmentsItem
40 #include <svx/svx3ditems.hxx>
42 //.............................................................................
43 namespace chart
45 //.............................................................................
47 SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
48 : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs)
49 , m_pGeometryResources(0)
51 Size aPageSize( this->GetSizePixel() );
52 Point aPos( this->LogicToPixel( Point(6,6), MapMode(MAP_APPFONT) ) );
53 m_pGeometryResources = new BarGeometryResources( this );
54 m_pGeometryResources->SetPosPixel( aPos );
57 SchLayoutTabPage::~SchLayoutTabPage()
59 if( m_pGeometryResources )
60 delete m_pGeometryResources;
63 SfxTabPage* SchLayoutTabPage::Create(Window* pWindow,
64 const SfxItemSet& rOutAttrs)
66 return new SchLayoutTabPage(pWindow, rOutAttrs);
69 BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
72 if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount())
74 long nShape=CHART_SHAPE3D_SQUARE;
75 long nSegs=32;
77 nShape = m_pGeometryResources->GetSelectEntryPos();
78 if(nShape==CHART_SHAPE3D_PYRAMID)
79 nSegs=4;
81 rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
82 rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs));
84 return TRUE;
87 void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs)
89 const SfxPoolItem *pPoolItem = NULL;
91 if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET)
93 long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
94 if(m_pGeometryResources)
96 m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal));
97 m_pGeometryResources->Show( true );
102 //.............................................................................
103 } //namespace chart
104 //.............................................................................