1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 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" 34 35 #include "chartview/ChartSfxItemIds.hxx" 36 37 // header for SfxInt32Item 38 #include <svl/intitem.hxx> 39 // header for class Svx3DHorizontalSegmentsItem 40 #include <svx/svx3ditems.hxx> 41 42 //............................................................................. 43 namespace chart 44 { 45 //............................................................................. 46 47 SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs) 48 : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs) 49 , m_pGeometryResources(0) 50 { 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 ); 55 } 56 57 SchLayoutTabPage::~SchLayoutTabPage() 58 { 59 if( m_pGeometryResources ) 60 delete m_pGeometryResources; 61 } 62 63 SfxTabPage* SchLayoutTabPage::Create(Window* pWindow, 64 const SfxItemSet& rOutAttrs) 65 { 66 return new SchLayoutTabPage(pWindow, rOutAttrs); 67 } 68 69 sal_Bool SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs) 70 { 71 72 if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount()) 73 { 74 long nShape=CHART_SHAPE3D_SQUARE; 75 long nSegs=32; 76 77 nShape = m_pGeometryResources->GetSelectEntryPos(); 78 if(nShape==CHART_SHAPE3D_PYRAMID) 79 nSegs=4; 80 81 rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape)); 82 rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs)); 83 } 84 return sal_True; 85 } 86 87 void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs) 88 { 89 const SfxPoolItem *pPoolItem = NULL; 90 91 if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,sal_True, &pPoolItem) == SFX_ITEM_SET) 92 { 93 long nVal=((const SfxInt32Item*)pPoolItem)->GetValue(); 94 if(m_pGeometryResources) 95 { 96 m_pGeometryResources->SelectEntryPos(static_cast<sal_uInt16>(nVal)); 97 m_pGeometryResources->Show( true ); 98 } 99 } 100 } 101 102 //............................................................................. 103 } //namespace chart 104 //............................................................................. 105