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;
41 rtl_TextEncoding eCharSet;
44 sal_Int32 nStartRow;
45 std::vector<sal_Int32> mvColStart;
46 std::vector<sal_uInt8> mvColFormat;
47
48public:
50
51 static const sal_Unicode cDefaultTextSep = '"';
52
53 void ReadFromString( std::u16string_view rString );
54 OUString WriteToString() const;
55
56 rtl_TextEncoding GetCharSet() const { return eCharSet; }
57 const OUString& GetFieldSeps() const { return aFieldSeps; }
58 bool IsMergeSeps() const { return bMergeFieldSeps; }
59 bool IsRemoveSpace() const { return bRemoveSpace; }
60 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
62 bool IsEvaluateFormulas() const { return bEvaluateFormulas; }
63 bool IsSkipEmptyCells() const { return bSkipEmptyCells; }
64 sal_Unicode GetTextSep() const { return cTextSep; }
65 bool IsFixedLen() const { return bFixedLen; }
66 sal_uInt16 GetInfoCount() const { return mvColStart.size(); }
67 const sal_Int32* GetColStart() const { return mvColStart.data(); }
68 const sal_uInt8* GetColFormat() const { return mvColFormat.data(); }
69 sal_Int32 GetStartRow() const { return nStartRow; }
70 LanguageType GetLanguage() const { return eLang; }
71
72 void SetCharSet( rtl_TextEncoding eNew ) { eCharSet = eNew; }
73 void SetCharSetSystem( bool bSet ) { bCharSetSystem = bSet; }
74 void SetFixedLen( bool bSet ) { bFixedLen = bSet; }
75 void SetFieldSeps( const OUString& rStr ) { aFieldSeps = rStr; }
76 void SetMergeSeps( bool bSet ) { bMergeFieldSeps = bSet; }
77 void SetRemoveSpace( bool bSet ) { bRemoveSpace = bSet; }
78 void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
79 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
80 void SetEvaluateFormulas(bool bSet) { bEvaluateFormulas = bSet; }
81 void SetSkipEmptyCells(bool bSet) { bSkipEmptyCells = bSet; }
82 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
83 void SetStartRow( sal_Int32 nRow) { nStartRow= nRow; }
85
86 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
87
99 static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
100};
101
104 SC_IMPORTFILE, // with File > Open: Text - CSV
105 SC_PASTETEXT, // with Paste > Unformatted Text
106 SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScImportAsciiCall
How ScImportAsciiDlg is called.
Definition: asciiopt.hxx:103
@ SC_IMPORTFILE
Definition: asciiopt.hxx:104
@ SC_TEXTTOCOLUMNS
Definition: asciiopt.hxx:106
@ SC_PASTETEXT
Definition: asciiopt.hxx:105
bool bEvaluateFormulas
Definition: asciiopt.hxx:36
bool bSaveFormulas
Definition: asciiopt.hxx:39
OUString aFieldSeps
Definition: asciiopt.hxx:31
bool bSaveAsShown
Definition: asciiopt.hxx:38
void SetColumnInfo(const ScCsvExpDataVec &rDataVec)
Definition: asciiopt.cxx:48
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:270
void SetFieldSeps(const OUString &rStr)
Definition: asciiopt.hxx:75
bool IsEvaluateFormulas() const
Definition: asciiopt.hxx:62
const sal_Int32 * GetColStart() const
Definition: asciiopt.hxx:67
bool bDetectSpecialNumber
Definition: asciiopt.hxx:35
rtl_TextEncoding GetCharSet() const
Definition: asciiopt.hxx:56
rtl_TextEncoding eCharSet
Definition: asciiopt.hxx:41
LanguageType eLang
Definition: asciiopt.hxx:42
void SetRemoveSpace(bool bSet)
Definition: asciiopt.hxx:77
void SetCharSet(rtl_TextEncoding eNew)
Definition: asciiopt.hxx:72
bool bQuotedFieldAsText
Definition: asciiopt.hxx:34
void SetLanguage(LanguageType e)
Definition: asciiopt.hxx:84
bool IsSkipEmptyCells() const
Definition: asciiopt.hxx:63
bool bCharSetSystem
Definition: asciiopt.hxx:43
void ReadFromString(std::u16string_view rString)
Definition: asciiopt.cxx:87
bool bMergeFieldSeps
Definition: asciiopt.hxx:32
sal_uInt16 GetInfoCount() const
Definition: asciiopt.hxx:66
void SetFixedLen(bool bSet)
Definition: asciiopt.hxx:74
LanguageType GetLanguage() const
Definition: asciiopt.hxx:70
bool IsDetectSpecialNumber() const
Definition: asciiopt.hxx:61
std::vector< sal_uInt8 > mvColFormat
Definition: asciiopt.hxx:46
bool IsFixedLen() const
Definition: asciiopt.hxx:65
bool bSkipEmptyCells
Definition: asciiopt.hxx:37
void SetTextSep(sal_Unicode c)
Definition: asciiopt.hxx:82
sal_Unicode GetTextSep() const
Definition: asciiopt.hxx:64
void SetQuotedAsText(bool bSet)
Definition: asciiopt.hxx:78
sal_Int32 nStartRow
Definition: asciiopt.hxx:44
sal_Int32 GetStartRow() const
Definition: asciiopt.hxx:69
bool IsRemoveSpace() const
Definition: asciiopt.hxx:59
sal_Unicode cTextSep
Definition: asciiopt.hxx:40
bool IsQuotedAsText() const
Definition: asciiopt.hxx:60
void SetMergeSeps(bool bSet)
Definition: asciiopt.hxx:76
static const sal_Unicode cDefaultTextSep
Definition: asciiopt.hxx:51
void SetStartRow(sal_Int32 nRow)
Definition: asciiopt.hxx:83
void SetSkipEmptyCells(bool bSet)
Definition: asciiopt.hxx:81
const OUString & GetFieldSeps() const
Definition: asciiopt.hxx:57
const sal_uInt8 * GetColFormat() const
Definition: asciiopt.hxx:68
bool bRemoveSpace
Definition: asciiopt.hxx:33
void SetCharSetSystem(bool bSet)
Definition: asciiopt.hxx:73
void SetEvaluateFormulas(bool bSet)
Definition: asciiopt.hxx:80
OUString WriteToString() const
Definition: asciiopt.cxx:197
std::vector< sal_Int32 > mvColStart
Definition: asciiopt.hxx:45
bool IsMergeSeps() const
Definition: asciiopt.hxx:58
void SetDetectSpecialNumber(bool bSet)
Definition: asciiopt.hxx:79
::std::vector< ScCsvExpData > ScCsvExpDataVec
Definition: csvcontrol.hxx:73
unsigned char sal_uInt8
sal_uInt16 sal_Unicode