LibreOffice Module chart2 (master) 1
tp_PointGeometry.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "tp_PointGeometry.hxx"
21#include <res_BarGeometry.hxx>
22
24
25#include <svl/intitem.hxx>
26#include <svx/svx3ditems.hxx>
27
28namespace chart
29{
30
32 : SfxTabPage(pPage, pController, "modules/schart/ui/tp_ChartType.ui", "tp_ChartType", &rInAttrs)
33{
34 m_pGeometryResources.reset(new BarGeometryResources(m_xBuilder.get()));
35}
36
38{
40}
41
42std::unique_ptr<SfxTabPage> SchLayoutTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rOutAttrs)
43{
44 return std::make_unique<SchLayoutTabPage>(pPage, pController, *rOutAttrs);
45}
46
48{
49 int nShape = m_pGeometryResources ? m_pGeometryResources->get_selected_index() : -1;
50 if (nShape != -1)
51 {
52 tools::Long nSegs=32;
53
54 if (nShape==CHART_SHAPE3D_PYRAMID)
55 nSegs=4;
56
57 rOutAttrs->Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
58 rOutAttrs->Put(makeSvx3DHorizontalSegmentsItem(nSegs));
59 }
60 return true;
61}
62
64{
65 if (const SfxInt32Item* pShapeItem = rInAttrs->GetItemIfSet(SCHATTR_STYLE_SHAPE))
66 {
67 tools::Long nVal = pShapeItem->GetValue();
69 {
70 m_pGeometryResources->select(static_cast<sal_uInt16>(nVal));
71 m_pGeometryResources->set_visible(true);
72 }
73 }
74}
75
76} //namespace chart
77
78/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CHART_SHAPE3D_PYRAMID
constexpr TypedWhichId< SfxInt32Item > SCHATTR_STYLE_SHAPE(SCHATTR_STYLE_START+9)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rInAttrs)
virtual ~SchLayoutTabPage() override
virtual bool FillItemSet(SfxItemSet *rOutAttrs) override
SchLayoutTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
virtual void Reset(const SfxItemSet *rInAttrs) override
std::unique_ptr< BarGeometryResources > m_pGeometryResources
long Long
SfxUInt32Item makeSvx3DHorizontalSegmentsItem(sal_uInt32 nVal)