Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / dputil.hxx
blob5081c758ab779942f016c0c226b903b357b16afa
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 #pragma once
12 #include <sal/config.h>
14 #include <string_view>
16 #include <rtl/ustring.hxx>
17 #include "scdllapi.h"
18 #include "global.hxx"
20 class SvNumberFormatter;
21 struct ScDPNumGroupInfo;
22 enum class ScGeneralFunction;
24 class ScDPUtil
26 public:
27 static bool isDuplicateDimension(std::u16string_view rName);
29 SC_DLLPUBLIC static OUString getSourceDimensionName(std::u16string_view rName);
31 /**
32 * Get a duplicate index in case the dimension is a duplicate. It returns
33 * 0 in case it's an original dimension.
35 sal_uInt8 static getDuplicateIndex(const OUString& rName);
37 SC_DLLPUBLIC static OUString createDuplicateDimensionName(const OUString& rOriginal, size_t nDupCount);
39 SC_DLLPUBLIC static OUString getDateGroupName(
40 sal_Int32 nDatePart, sal_Int32 nValue, SvNumberFormatter* pFormatter,
41 double fStart, double fEnd);
43 static double getNumGroupStartValue(double fValue, const ScDPNumGroupInfo& rInfo);
45 static OUString getNumGroupName(
46 double fValue, const ScDPNumGroupInfo& rInfo, sal_Unicode cDecSep,
47 SvNumberFormatter* pFormatter);
49 static sal_Int32 getDatePartValue(
50 double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart,
51 const SvNumberFormatter* pFormatter);
53 SC_DLLPUBLIC static OUString getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc);
55 SC_DLLPUBLIC static ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc);
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */