Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_PointGeometry.cxx
blob2350c3eb3e5d848ef52d4b3bc5dcbb6f8a314750
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_PointGeometry.hxx"
21 #include "TabPageIds.h"
22 #include "res_BarGeometry.hxx"
24 #include <chartview/ChartSfxItemIds.hxx>
26 #include <svl/intitem.hxx>
27 #include <svx/svx3ditems.hxx>
29 namespace chart
32 SchLayoutTabPage::SchLayoutTabPage(vcl::Window* pWindow,const SfxItemSet& rInAttrs)
33 : SfxTabPage(pWindow, "tp_ChartType", "modules/schart/ui/tp_ChartType.ui", &rInAttrs)
34 , m_pGeometryResources(nullptr)
36 m_pGeometryResources = new BarGeometryResources( this );
39 SchLayoutTabPage::~SchLayoutTabPage()
41 disposeOnce();
44 void SchLayoutTabPage::dispose()
46 delete m_pGeometryResources;
47 m_pGeometryResources = nullptr;
48 SfxTabPage::dispose();
51 VclPtr<SfxTabPage> SchLayoutTabPage::Create(TabPageParent pWindow,
52 const SfxItemSet* rOutAttrs)
54 return VclPtr<SchLayoutTabPage>::Create(pWindow.pParent, *rOutAttrs);
57 bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs)
60 if(m_pGeometryResources && m_pGeometryResources->GetSelectedEntryCount())
62 long nSegs=32;
64 long nShape = m_pGeometryResources->GetSelectedEntryPos();
65 if(nShape==CHART_SHAPE3D_PYRAMID)
66 nSegs=4;
68 rOutAttrs->Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
69 rOutAttrs->Put(makeSvx3DHorizontalSegmentsItem(nSegs));
71 return true;
74 void SchLayoutTabPage::Reset(const SfxItemSet* rInAttrs)
76 const SfxPoolItem *pPoolItem = nullptr;
78 if (rInAttrs->GetItemState(SCHATTR_STYLE_SHAPE,true, &pPoolItem) == SfxItemState::SET)
80 long nVal = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
81 if(m_pGeometryResources)
83 m_pGeometryResources->SelectEntryPos(static_cast<sal_uInt16>(nVal));
84 m_pGeometryResources->Show( true );
89 } //namespace chart
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */