1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_chart2.hxx" 26 #include "tp_PointGeometry.hxx" 27 #include "TabPages.hrc" 28 #include "res_BarGeometry.hxx" 29 #include "ResId.hxx" 30 31 #include "chartview/ChartSfxItemIds.hxx" 32 33 // header for SfxInt32Item 34 #include <svl/intitem.hxx> 35 // header for class Svx3DHorizontalSegmentsItem 36 #include <svx/svx3ditems.hxx> 37 38 //............................................................................. 39 namespace chart 40 { 41 //............................................................................. 42 43 SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs) 44 : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs) 45 , m_pGeometryResources(0) 46 { 47 Size aPageSize( this->GetSizePixel() ); 48 Point aPos( this->LogicToPixel( Point(6,6), MapMode(MAP_APPFONT) ) ); 49 m_pGeometryResources = new BarGeometryResources( this ); 50 m_pGeometryResources->SetPosPixel( aPos ); 51 } 52 53 SchLayoutTabPage::~SchLayoutTabPage() 54 { 55 if( m_pGeometryResources ) 56 delete m_pGeometryResources; 57 } 58 59 SfxTabPage* SchLayoutTabPage::Create(Window* pWindow, 60 const SfxItemSet& rOutAttrs) 61 { 62 return new SchLayoutTabPage(pWindow, rOutAttrs); 63 } 64 65 sal_Bool SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs) 66 { 67 68 if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount()) 69 { 70 long nShape=CHART_SHAPE3D_SQUARE; 71 long nSegs=32; 72 73 nShape = m_pGeometryResources->GetSelectEntryPos(); 74 if(nShape==CHART_SHAPE3D_PYRAMID) 75 nSegs=4; 76 77 rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape)); 78 rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs)); 79 } 80 return sal_True; 81 } 82 83 void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs) 84 { 85 const SfxPoolItem *pPoolItem = NULL; 86 87 if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,sal_True, &pPoolItem) == SFX_ITEM_SET) 88 { 89 long nVal=((const SfxInt32Item*)pPoolItem)->GetValue(); 90 if(m_pGeometryResources) 91 { 92 m_pGeometryResources->SelectEntryPos(static_cast<sal_uInt16>(nVal)); 93 m_pGeometryResources->Show( true ); 94 } 95 } 96 } 97 98 //............................................................................. 99 } //namespace chart 100 //............................................................................. 101