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 
27 class SvNumberFormatter;
28 enum class SvNumFormatType : sal_Int16;
29 
35 {
40  {
46 
52 
58 
62  Never
63  };
64 
71 
78 
84 
92 
94 
101 
103 
108  void setTextInput();
109 
114  void setNumericInput();
115 };
116 
118 {
120 
122 
123  OUString maText;
124  double mfValue;
126 };
127 
129 {
130 public:
131 
147  static bool parseSimpleNumber(
148  const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double& rVal);
149 
150  static bool parseSimpleNumber(
151  const char* p, size_t n, char dsep, char gsep, double& rVal);
152 
153  static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs,
154  sal_Unicode cTok, sal_Int32& rIndex );
155 
156  static bool SC_DLLPUBLIC isMultiline( const OUString& rStr );
157 
159  SvNumberFormatter& rFormatter, const OUString& rStr, LanguageType eLang );
160 };
161 
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool parseSimpleNumber(const OUString &rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double &rVal)
Check if a given string is a simple decimal number (e.g.
Definition: stringutil.cxx:51
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:34
bool mbHandleApostrophe
When true, treat input with a leading apostrophe as an escape character for a numeric value content...
Definition: stringutil.hxx:91
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
Definition: stringutil.cxx:37
SvNumberFormatter * mpNumFormatter
Stores the pointer to the number formatter instance to be used during number format detection...
Definition: stringutil.hxx:70
bool mbCheckLinkFormula
When true and the string results in a compiled formula, check the formula tokens for presence of func...
Definition: stringutil.hxx:100
sal_Int64 n
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set...
Definition: stringutil.hxx:83
static bool SC_DLLPUBLIC isMultiline(const OUString &rStr)
Definition: stringutil.cxx:423
sal_uInt16 sal_Unicode
TextFormatPolicy
Enum settings that take effect if mbDetectNumberFormat=false or if true a number was not detected...
Definition: stringutil.hxx:39
static ScInputStringType parseInputString(SvNumberFormatter &rFormatter, const OUString &rStr, LanguageType eLang)
Definition: stringutil.cxx:434
StringType meType
Definition: stringutil.hxx:121
Set Text number format only when the input string is considered a special number but we only want to ...
Definition: stringutil.hxx:51
StartListeningType
Definition: types.hxx:123
Keep an existing number format, do not set Text number format and do not set another number format...
Definition: stringutil.hxx:57
SvNumFormatType
#define SAL_WARN_UNUSED
DefTokenId nToken
Definition: qproform.cxx:399
bool mbDetectNumberFormat
When true, we try to detect special number format (dates etc) from the input string, when false, we only try to detect a basic decimal number format.
Definition: stringutil.hxx:77
SvNumFormatType mnFormatType
Definition: stringutil.hxx:125
static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString &rQuotedPairs, sal_Unicode cTok, sal_Int32 &rIndex)
Definition: stringutil.cxx:348
void * p
Set Text number format if the input string can be parsed as a number or formula text.
Definition: stringutil.hxx:45
sc::StartListeningType meStartListening
Definition: stringutil.hxx:93
void setNumericInput()
Call this whenever you need to maximize the chance of input being detected as a numeric value (number...
Definition: stringutil.cxx:44
#define SC_DLLPUBLIC
Definition: scdllapi.h:27