LibreOffice Module sc (master) 1
asciiopt.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 <i18nlangtag/lang.h>
24
25#include "csvcontrol.hxx"
26
28{
29private:
31 OUString aFieldSeps;
43 rtl_TextEncoding eCharSet;
46 sal_Int32 nStartRow;
47 std::vector<sal_Int32> mvColStart;
48 std::vector<sal_uInt8> mvColFormat;
49
50public:
52
53 static const sal_Unicode cDefaultTextSep = '"';
54
55 void ReadFromString( std::u16string_view rString );
56 OUString WriteToString() const;
57
58 rtl_TextEncoding GetCharSet() const { return eCharSet; }
59 const OUString& GetFieldSeps() const { return aFieldSeps; }
60 bool IsMergeSeps() const { return bMergeFieldSeps; }
61 bool IsRemoveSpace() const { return bRemoveSpace; }
62 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
65 bool IsEvaluateFormulas() const { return bEvaluateFormulas; }
66 bool IsSkipEmptyCells() const { return bSkipEmptyCells; }
67 bool GetIncludeBOM() const { return bIncludeBOM; }
68 sal_Unicode GetTextSep() const { return cTextSep; }
69 bool IsFixedLen() const { return bFixedLen; }
70 sal_uInt16 GetInfoCount() const { return mvColStart.size(); }
71 const sal_Int32* GetColStart() const { return mvColStart.data(); }
72 const sal_uInt8* GetColFormat() const { return mvColFormat.data(); }
73 sal_Int32 GetStartRow() const { return nStartRow; }
74 LanguageType GetLanguage() const { return eLang; }
75
76 void SetCharSet( rtl_TextEncoding eNew ) { eCharSet = eNew; }
77 void SetCharSetSystem( bool bSet ) { bCharSetSystem = bSet; }
78 void SetFixedLen( bool bSet ) { bFixedLen = bSet; }
79 void SetFieldSeps( const OUString& rStr ) { aFieldSeps = rStr; }
80 void SetMergeSeps( bool bSet ) { bMergeFieldSeps = bSet; }
81 void SetRemoveSpace( bool bSet ) { bRemoveSpace = bSet; }
82 void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
83 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
85 void SetEvaluateFormulas(bool bSet) { bEvaluateFormulas = bSet; }
86 void SetSkipEmptyCells(bool bSet) { bSkipEmptyCells = bSet; }
87 void SetIncludeBOM(bool bVal) { bIncludeBOM = bVal; }
88 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
89 void SetStartRow( sal_Int32 nRow) { nStartRow= nRow; }
91
92 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
93
105 static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
106};
107
110 SC_IMPORTFILE, // with File > Open: Text - CSV
111 SC_PASTETEXT, // with Paste > Unformatted Text
112 SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScImportAsciiCall
How ScImportAsciiDlg is called.
Definition: asciiopt.hxx:109
@ SC_IMPORTFILE
Definition: asciiopt.hxx:110
@ SC_TEXTTOCOLUMNS
Definition: asciiopt.hxx:112
@ SC_PASTETEXT
Definition: asciiopt.hxx:111
bool bIncludeBOM
Definition: asciiopt.hxx:41
bool bEvaluateFormulas
Definition: asciiopt.hxx:37
bool bSaveFormulas
Definition: asciiopt.hxx:40
OUString aFieldSeps
Definition: asciiopt.hxx:31
bool bSaveAsShown
Definition: asciiopt.hxx:39
void SetColumnInfo(const ScCsvExpDataVec &rDataVec)
Definition: asciiopt.cxx:50
static sal_Unicode GetWeightedFieldSep(const OUString &rFieldSeps, bool bDecodeNumbers)
From the import field separators obtain the one most likely to be used for export,...
Definition: asciiopt.cxx:287
void SetFieldSeps(const OUString &rStr)
Definition: asciiopt.hxx:79
bool IsEvaluateFormulas() const
Definition: asciiopt.hxx:65
const sal_Int32 * GetColStart() const
Definition: asciiopt.hxx:71
bool bDetectSpecialNumber
Definition: asciiopt.hxx:35
rtl_TextEncoding GetCharSet() const
Definition: asciiopt.hxx:58
rtl_TextEncoding eCharSet
Definition: asciiopt.hxx:43
void SetIncludeBOM(bool bVal)
Definition: asciiopt.hxx:87
LanguageType eLang
Definition: asciiopt.hxx:44
void SetRemoveSpace(bool bSet)
Definition: asciiopt.hxx:81
void SetCharSet(rtl_TextEncoding eNew)
Definition: asciiopt.hxx:76
bool bQuotedFieldAsText
Definition: asciiopt.hxx:34
void SetLanguage(LanguageType e)
Definition: asciiopt.hxx:90
bool IsSkipEmptyCells() const
Definition: asciiopt.hxx:66
bool IsDetectScientificNumber() const
Definition: asciiopt.hxx:64
bool bCharSetSystem
Definition: asciiopt.hxx:45
void ReadFromString(std::u16string_view rString)
Definition: asciiopt.cxx:89
bool bMergeFieldSeps
Definition: asciiopt.hxx:32
sal_uInt16 GetInfoCount() const
Definition: asciiopt.hxx:70
void SetFixedLen(bool bSet)
Definition: asciiopt.hxx:78
LanguageType GetLanguage() const
Definition: asciiopt.hxx:74
bool IsDetectSpecialNumber() const
Definition: asciiopt.hxx:63
std::vector< sal_uInt8 > mvColFormat
Definition: asciiopt.hxx:48
bool IsFixedLen() const
Definition: asciiopt.hxx:69
bool bSkipEmptyCells
Definition: asciiopt.hxx:38
void SetTextSep(sal_Unicode c)
Definition: asciiopt.hxx:88
sal_Unicode GetTextSep() const
Definition: asciiopt.hxx:68
void SetQuotedAsText(bool bSet)
Definition: asciiopt.hxx:82
sal_Int32 nStartRow
Definition: asciiopt.hxx:46
sal_Int32 GetStartRow() const
Definition: asciiopt.hxx:73
bool IsRemoveSpace() const
Definition: asciiopt.hxx:61
sal_Unicode cTextSep
Definition: asciiopt.hxx:42
void SetDetectScientificNumber(bool bSet)
Definition: asciiopt.hxx:84
bool IsQuotedAsText() const
Definition: asciiopt.hxx:62
void SetMergeSeps(bool bSet)
Definition: asciiopt.hxx:80
static const sal_Unicode cDefaultTextSep
Definition: asciiopt.hxx:53
void SetStartRow(sal_Int32 nRow)
Definition: asciiopt.hxx:89
bool bDetectScientificNumber
Definition: asciiopt.hxx:36
bool GetIncludeBOM() const
Definition: asciiopt.hxx:67
void SetSkipEmptyCells(bool bSet)
Definition: asciiopt.hxx:86
const OUString & GetFieldSeps() const
Definition: asciiopt.hxx:59
const sal_uInt8 * GetColFormat() const
Definition: asciiopt.hxx:72
bool bRemoveSpace
Definition: asciiopt.hxx:33
void SetCharSetSystem(bool bSet)
Definition: asciiopt.hxx:77
void SetEvaluateFormulas(bool bSet)
Definition: asciiopt.hxx:85
OUString WriteToString() const
Definition: asciiopt.cxx:211
std::vector< sal_Int32 > mvColStart
Definition: asciiopt.hxx:47
bool IsMergeSeps() const
Definition: asciiopt.hxx:60
void SetDetectSpecialNumber(bool bSet)
Definition: asciiopt.hxx:83
::std::vector< ScCsvExpData > ScCsvExpDataVec
Definition: csvcontrol.hxx:73
unsigned char sal_uInt8
sal_uInt16 sal_Unicode