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 #ifndef INCLUDED_SC_INC_STRINGUTIL_HXX
21 #define INCLUDED_SC_INC_STRINGUTIL_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include "scdllapi.h"
25 #include <i18nlangtag/lang.h>
26 #include "types.hxx"
27 
28 class SvNumberFormatter;
29 enum class SvNumFormatType : sal_Int16;
30 
36 {
41  {
47 
53 
59 
63  Never
64  };
65 
72 
79 
85 
93 
95 
102 
104 
109  void setTextInput();
110 
115  void setNumericInput();
116 };
117 
119 {
121 
123 
124  OUString maText;
125  double mfValue;
127 };
128 
130 {
131 public:
132 
148  static bool parseSimpleNumber(
149  const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double& rVal);
150 
151  static bool parseSimpleNumber(
152  const char* p, size_t n, char dsep, char gsep, double& rVal);
153 
154  static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs,
155  sal_Unicode cTok, sal_Int32& rIndex );
156 
157  static bool SC_DLLPUBLIC isMultiline( const OUString& rStr );
158 
160  SvNumberFormatter& rFormatter, const OUString& rStr, LanguageType eLang );
161 };
162 
163 #endif
164 
165 /* 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:52
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 a numeric value content...
Definition: stringutil.hxx:92
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
Definition: stringutil.cxx:38
SvNumberFormatter * mpNumFormatter
Stores the pointer to the number formatter instance to be used during number format detection...
Definition: stringutil.hxx:71
bool mbCheckLinkFormula
When true and the string results in a compiled formula, check the formula tokens for presence of func...
Definition: stringutil.hxx:101
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:84
static bool SC_DLLPUBLIC isMultiline(const OUString &rStr)
Definition: stringutil.cxx:424
sal_uInt16 sal_Unicode
TextFormatPolicy
Enum settings that take effect if mbDetectNumberFormat=false or if true a number was not detected...
Definition: stringutil.hxx:40
static ScInputStringType parseInputString(SvNumberFormatter &rFormatter, const OUString &rStr, LanguageType eLang)
Definition: stringutil.cxx:435
StringType meType
Definition: stringutil.hxx:122
Set Text number format only when the input string is considered a special number but we only want to ...
Definition: stringutil.hxx:52
StartListeningType
Definition: types.hxx:124
Keep an existing number format, do not set Text number format and do not set another number format...
Definition: stringutil.hxx:58
SvNumFormatType
#define SAL_WARN_UNUSED
DefTokenId nToken
Definition: qproform.cxx:400
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:78
SvNumFormatType mnFormatType
Definition: stringutil.hxx:126
static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString &rQuotedPairs, sal_Unicode cTok, sal_Int32 &rIndex)
Definition: stringutil.cxx:349
void * p
Set Text number format if the input string can be parsed as a number or formula text.
Definition: stringutil.hxx:46
sc::StartListeningType meStartListening
Definition: stringutil.hxx:94
void setNumericInput()
Call this whenever you need to maximize the chance of input being detected as a numeric value (number...
Definition: stringutil.cxx:45
#define SC_DLLPUBLIC
Definition: scdllapi.h:28