tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / controller / itemsetwrapper / DataTableItemConverter.cxx
blobe152bf298dfc2691d39ada485030fd003e813efe
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/.
8 */
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>
19 using namespace css;
21 namespace chart::wrapper
23 namespace
25 ItemPropertyMapType& lclDataTablePropertyMap()
27 static ItemPropertyMapType aPropertyMap{
28 { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, { "HBorder", 0 } },
29 { SCHATTR_DATA_TABLE_VERTICAL_BORDER, { "VBorder", 0 } },
30 { SCHATTR_DATA_TABLE_OUTLINE, { "Outline", 0 } },
31 { SCHATTR_DATA_TABLE_KEYS, { "Keys", 0 } },
33 return aPropertyMap;
37 DataTableItemConverter::DataTableItemConverter(
38 const uno::Reference<beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool,
39 SdrModel& rDrawModel, const rtl::Reference<::chart::ChartModel>& xChartDoc)
40 : ItemConverter(rPropertySet, rItemPool)
42 m_aConverters.emplace_back(new GraphicPropertyItemConverter(
43 rPropertySet, rItemPool, rDrawModel, xChartDoc, GraphicObjectType::LineProperties));
44 m_aConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool));
47 DataTableItemConverter::~DataTableItemConverter() = default;
49 void DataTableItemConverter::FillItemSet(SfxItemSet& rOutItemSet) const
51 for (const auto& pConv : m_aConverters)
53 pConv->FillItemSet(rOutItemSet);
56 // own items
57 ItemConverter::FillItemSet(rOutItemSet);
60 bool DataTableItemConverter::ApplyItemSet(const SfxItemSet& rItemSet)
62 bool bResult = false;
64 for (const auto& pConv : m_aConverters)
66 bResult = pConv->ApplyItemSet(rItemSet) || bResult;
69 // own items
70 return ItemConverter::ApplyItemSet(rItemSet) || bResult;
73 const WhichRangesContainer& DataTableItemConverter::GetWhichPairs() const
75 return nDataTableWhichPairs;
78 bool DataTableItemConverter::GetItemProperty(tWhichIdType nWhichId,
79 tPropertyNameWithMemberId& rOutProperty) const
81 ItemPropertyMapType& rMap(lclDataTablePropertyMap());
82 auto aIt = rMap.find(nWhichId);
83 if (aIt == rMap.cend())
84 return false;
86 rOutProperty = (*aIt).second;
88 return true;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */