| 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 |
: SfxTabPage(pPage, pController, u"modules/schart/ui/tp_ChartType.ui"_ustr, u"tp_ChartType"_ustr, &rInAttrs) |
| 33 |
{ |
| 34 |
m_pGeometryResources.reset(new BarGeometryResources(m_xBuilder.get())); |
| 35 |
} |
| 36 |
|
| 37 |
SchLayoutTabPage::~SchLayoutTabPage() |
| 38 |
{ |
| 39 |
m_pGeometryResources.reset(); |
| 40 |
} |
| 41 |
|
| 42 |
std::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 |
|
| 47 |
bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs) |
| 48 |
{ |
| 49 |
sal_Int32 nShape = m_pGeometryResources ? m_pGeometryResources->get_selected_index() : -1; |
| 50 |
if (nShape != -1) |
| 51 |
{ |
| 52 |
tools::Long nSegs=32; |
| 53 |
|
| 54 |
if (nShape==AFShapes(StyleShapeAtr::Pyramid)) |
| 55 |
nSegs=4; |
| 56 |
|
| 57 |
rOutAttrs->Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape)); |
| 58 |
rOutAttrs->Put(makeSvx3DHorizontalSegmentsItem(nSegs)); |
| 59 |
} |
| 60 |
return true; |
| 61 |
} |
| 62 |
|
| 63 |
void SchLayoutTabPage::Reset(const SfxItemSet* rInAttrs) |
| 64 |
{ |
| 65 |
if (const SfxInt32Item* pShapeItem = rInAttrs->GetItemIfSet(SCHATTR_STYLE_SHAPE)) |
| 66 |
{ |
| 67 |
tools::Long nVal = pShapeItem->GetValue(); |
| 68 |
if(m_pGeometryResources) |
| 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: */ |