/src/libreoffice/chart2/source/controller/dialogs/tp_PointGeometry.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | |
23 | | #include <chartview/ChartSfxItemIds.hxx> |
24 | | |
25 | | #include <svl/intitem.hxx> |
26 | | #include <svx/svx3ditems.hxx> |
27 | | |
28 | | namespace chart |
29 | | { |
30 | | |
31 | | SchLayoutTabPage::SchLayoutTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) |
32 | 0 | : SfxTabPage(pPage, pController, u"modules/schart/ui/tp_ChartType.ui"_ustr, u"tp_ChartType"_ustr, &rInAttrs) |
33 | 0 | { |
34 | 0 | m_pGeometryResources.reset(new BarGeometryResources(m_xBuilder.get())); |
35 | 0 | } |
36 | | |
37 | | SchLayoutTabPage::~SchLayoutTabPage() |
38 | 0 | { |
39 | 0 | m_pGeometryResources.reset(); |
40 | 0 | } |
41 | | |
42 | | std::unique_ptr<SfxTabPage> SchLayoutTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rOutAttrs) |
43 | 0 | { |
44 | 0 | return std::make_unique<SchLayoutTabPage>(pPage, pController, *rOutAttrs); |
45 | 0 | } |
46 | | |
47 | | bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs) |
48 | 0 | { |
49 | 0 | int nShape = m_pGeometryResources ? m_pGeometryResources->get_selected_index() : -1; |
50 | 0 | if (nShape != -1) |
51 | 0 | { |
52 | 0 | tools::Long nSegs=32; |
53 | |
|
54 | 0 | if (nShape==CHART_SHAPE3D_PYRAMID) |
55 | 0 | nSegs=4; |
56 | |
|
57 | 0 | rOutAttrs->Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape)); |
58 | 0 | rOutAttrs->Put(makeSvx3DHorizontalSegmentsItem(nSegs)); |
59 | 0 | } |
60 | 0 | return true; |
61 | 0 | } |
62 | | |
63 | | void SchLayoutTabPage::Reset(const SfxItemSet* rInAttrs) |
64 | 0 | { |
65 | 0 | if (const SfxInt32Item* pShapeItem = rInAttrs->GetItemIfSet(SCHATTR_STYLE_SHAPE)) |
66 | 0 | { |
67 | 0 | tools::Long nVal = pShapeItem->GetValue(); |
68 | 0 | if(m_pGeometryResources) |
69 | 0 | { |
70 | 0 | m_pGeometryResources->select(static_cast<sal_uInt16>(nVal)); |
71 | 0 | m_pGeometryResources->set_visible(true); |
72 | 0 | } |
73 | 0 | } |
74 | 0 | } |
75 | | |
76 | | } //namespace chart |
77 | | |
78 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |