Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / controller / inc / TextLabelItemConverter.hxx
blob9df2a65e1696678d4de37409d240cf15fcc47a1c
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include "ItemConverter.hxx"
23 #include <com/sun/star/uno/Sequence.h>
24 #include <rtl/ref.hxx>
25 #include <vector>
27 namespace com::sun::star::awt { struct Size; }
28 namespace com::sun::star::chart2 { class XDataSeries; }
29 namespace com::sun::star::frame { class XModel; }
30 namespace chart { class ChartModel; }
31 namespace chart { class DataSeries; }
33 namespace chart::wrapper {
35 class TextLabelItemConverter final : public ItemConverter
37 public:
38 TextLabelItemConverter(
39 const rtl::Reference<::chart::ChartModel>& xChartModel,
40 const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
41 const rtl::Reference<::chart::DataSeries>& xSeries,
42 SfxItemPool& rItemPool,
43 const css::awt::Size* pRefSize,
44 bool bDataSeries,
45 sal_Int32 nNumberFormat,
46 sal_Int32 nPercentNumberFormat );
48 virtual ~TextLabelItemConverter() override;
50 virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override;
51 virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
53 protected:
54 virtual const WhichRangesContainer& GetWhichPairs() const override;
55 virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
57 virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
58 virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
60 private:
61 std::vector<std::unique_ptr<ItemConverter>> maConverters;
62 sal_Int32 mnNumberFormat;
63 sal_Int32 mnPercentNumberFormat;
64 css::uno::Sequence<sal_Int32> maAvailableLabelPlacements;
66 bool mbDataSeries:1;
67 bool mbForbidPercentValue:1;
69 rtl::Reference<::chart::DataSeries> m_xSeries;
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */