LibreOffice Module vcl (master) 1
fieldvalues.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_VCL_FIELDVALUES_HXX
21#define INCLUDED_VCL_FIELDVALUES_HXX
22
23#include <sal/config.h>
24
25#include <string_view>
26
27#include <vcl/dllapi.h>
28#include <rtl/ustring.hxx>
29#include <tools/fldunit.hxx>
30#include <tools/mapunit.hxx>
31
33
34namespace vcl
35{
36VCL_DLLPUBLIC FieldUnit EnglishStringToMetric(std::u16string_view rEnglishMetricString);
37
38VCL_DLLPUBLIC bool TextToValue(const OUString& rStr, double& rValue, sal_Int64 nBaseValue,
39 sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper,
40 FieldUnit eUnit);
41
42VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
43 FieldUnit eInUnit, FieldUnit eOutUnit);
44VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
45 FieldUnit eOutUnit);
46
47// for backwards compatibility
48// caution: conversion to double loses precision
49VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
50 FieldUnit eInUnit, FieldUnit eOutUnit);
51VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
52 MapUnit eOutUnit);
53VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
54 FieldUnit eOutUnit);
55
56// for backwards compatibility
57// caution: conversion to double loses precision
58inline double ConvertDoubleValue(sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
59 FieldUnit eInUnit, FieldUnit eOutUnit)
60{
61 return ConvertDoubleValue(static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit,
62 eOutUnit);
63}
64
65inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
66 MapUnit eOutUnit)
67{
68 return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
69}
70
71inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
72 FieldUnit eOutUnit)
73{
74 return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
75}
76}
77
78#endif // INCLUDED_VCL_FIELDVALUES_HXX
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
FieldUnit
sal_Int16 nValue
MapUnit
FieldUnit EnglishStringToMetric(std::u16string_view rEnglishMetricString)
Definition: svdata.cxx:284
bool TextToValue(const OUString &rStr, double &rValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, const LocaleDataWrapper &rLocaleDataWrapper, FieldUnit eUnit)
Definition: field.cxx:1198
double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
Definition: field.cxx:1112
sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
Definition: field.cxx:1027