/src/libreoffice/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx
Line | Count | Source |
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 | | |
10 | | #include <DataTableItemConverter.hxx> |
11 | | #include <ItemPropertyMap.hxx> |
12 | | #include <CharacterPropertyItemConverter.hxx> |
13 | | #include <GraphicPropertyItemConverter.hxx> |
14 | | #include <chartview/ChartSfxItemIds.hxx> |
15 | | #include "SchWhichPairs.hxx" |
16 | | #include <ChartModel.hxx> |
17 | | #include <memory> |
18 | | |
19 | | using namespace css; |
20 | | |
21 | | namespace chart::wrapper |
22 | | { |
23 | | namespace |
24 | | { |
25 | | ItemPropertyMapType& lclDataTablePropertyMap() |
26 | 0 | { |
27 | 0 | static ItemPropertyMapType aPropertyMap{ |
28 | 0 | { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, { "HBorder", 0 } }, |
29 | 0 | { SCHATTR_DATA_TABLE_VERTICAL_BORDER, { "VBorder", 0 } }, |
30 | 0 | { SCHATTR_DATA_TABLE_OUTLINE, { "Outline", 0 } }, |
31 | 0 | { SCHATTR_DATA_TABLE_KEYS, { "Keys", 0 } }, |
32 | 0 | }; |
33 | 0 | return aPropertyMap; |
34 | 0 | }; |
35 | | } |
36 | | |
37 | | DataTableItemConverter::DataTableItemConverter( |
38 | | const uno::Reference<beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool, |
39 | | SdrModel& rDrawModel, const rtl::Reference<::chart::ChartModel>& xChartDoc) |
40 | 0 | : ItemConverter(rPropertySet, rItemPool) |
41 | 0 | { |
42 | 0 | m_aConverters.emplace_back(new GraphicPropertyItemConverter( |
43 | 0 | rPropertySet, rItemPool, rDrawModel, xChartDoc, GraphicObjectType::LineProperties)); |
44 | 0 | m_aConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool)); |
45 | 0 | } |
46 | | |
47 | 0 | DataTableItemConverter::~DataTableItemConverter() = default; |
48 | | |
49 | | void DataTableItemConverter::FillItemSet(SfxItemSet& rOutItemSet) const |
50 | 0 | { |
51 | 0 | for (const auto& pConv : m_aConverters) |
52 | 0 | { |
53 | 0 | pConv->FillItemSet(rOutItemSet); |
54 | 0 | } |
55 | | |
56 | | // own items |
57 | 0 | ItemConverter::FillItemSet(rOutItemSet); |
58 | 0 | } |
59 | | |
60 | | bool DataTableItemConverter::ApplyItemSet(const SfxItemSet& rItemSet) |
61 | 0 | { |
62 | 0 | bool bResult = false; |
63 | |
|
64 | 0 | for (const auto& pConv : m_aConverters) |
65 | 0 | { |
66 | 0 | bResult = pConv->ApplyItemSet(rItemSet) || bResult; |
67 | 0 | } |
68 | | |
69 | | // own items |
70 | 0 | return ItemConverter::ApplyItemSet(rItemSet) || bResult; |
71 | 0 | } |
72 | | |
73 | | const WhichRangesContainer& DataTableItemConverter::GetWhichPairs() const |
74 | 0 | { |
75 | 0 | return nDataTableWhichPairs; |
76 | 0 | } |
77 | | |
78 | | bool DataTableItemConverter::GetItemProperty(tWhichIdType nWhichId, |
79 | | tPropertyNameWithMemberId& rOutProperty) const |
80 | 0 | { |
81 | 0 | ItemPropertyMapType& rMap(lclDataTablePropertyMap()); |
82 | 0 | auto aIt = rMap.find(nWhichId); |
83 | 0 | if (aIt == rMap.cend()) |
84 | 0 | return false; |
85 | | |
86 | 0 | rOutProperty = (*aIt).second; |
87 | |
|
88 | 0 | return true; |
89 | 0 | } |
90 | | } |
91 | | |
92 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |