LibreOffice Module sc (master) 1
stringutil.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#pragma once
21
22#include <rtl/ustring.hxx>
23#include "scdllapi.h"
24#include <i18nlangtag/lang.h>
25#include "types.hxx"
26
28enum class SvNumFormatType : sal_Int16;
29
35{
40 {
46
52
58
62 Never
63 };
64
71
81
87
95
97
104
106
111 void setTextInput();
112
117 void setNumericInput();
118};
119
121{
123
125
126 OUString maText;
127 double mfValue;
129};
130
132{
133public:
134
150 static bool parseSimpleNumber(
151 const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double& rVal, bool bDetectScientificNumber = true);
152
153 static bool parseSimpleNumber(
154 const char* p, size_t n, char dsep, char gsep, double& rVal);
155
156 static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs,
157 sal_Unicode cTok, sal_Int32& rIndex );
158
159 static bool SC_DLLPUBLIC isMultiline( std::u16string_view rStr );
160
162 SvNumberFormatter& rFormatter, const OUString& rStr, LanguageType eLang );
163};
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString &rQuotedPairs, sal_Unicode cTok, sal_Int32 &rIndex)
Definition: stringutil.cxx:350
static ScInputStringType parseInputString(SvNumberFormatter &rFormatter, const OUString &rStr, LanguageType eLang)
Definition: stringutil.cxx:430
static bool SC_DLLPUBLIC isMultiline(std::u16string_view rStr)
Definition: stringutil.cxx:425
static bool parseSimpleNumber(const OUString &rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double &rVal, bool bDetectScientificNumber=true)
Check if a given string is a simple decimal number (e.g.
Definition: stringutil.cxx:55
void * p
sal_Int64 n
StartListeningType
Definition: types.hxx:124
DefTokenId nToken
Definition: qproform.cxx:397
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
SvNumFormatType mnFormatType
Definition: stringutil.hxx:128
StringType meType
Definition: stringutil.hxx:124
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:35
bool mbHandleApostrophe
When true, treat input with a leading apostrophe as an escape character for all content,...
Definition: stringutil.hxx:94
bool mbCheckLinkFormula
When true and the string results in a compiled formula, check the formula tokens for presence of func...
Definition: stringutil.hxx:103
bool mbDetectScientificNumberFormat
Definition: stringutil.hxx:80
bool mbDetectNumberFormat
Specify which number formats are detected: mbDetectNumberFormat=true && mbDetectScientificNumberForma...
Definition: stringutil.hxx:79
SvNumberFormatter * mpNumFormatter
Stores the pointer to the number formatter instance to be used during number format detection.
Definition: stringutil.hxx:70
TextFormatPolicy
Enum settings that take effect if mbDetectNumberFormat=false or if true a number was not detected.
Definition: stringutil.hxx:40
@ Always
Set Text number format if the input string can be parsed as a number or formula text.
Definition: stringutil.hxx:45
@ Keep
Keep an existing number format, do not set Text number format and do not set another number format.
Definition: stringutil.hxx:57
@ SpecialNumberOnly
Set Text number format only when the input string is considered a special number but we only want to ...
Definition: stringutil.hxx:51
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set.
Definition: stringutil.hxx:86
sc::StartListeningType meStartListening
Definition: stringutil.hxx:96
sal_uInt16 sal_Unicode
#define SAL_WARN_UNUSED
SvNumFormatType