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