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;
41  rtl_TextEncoding eCharSet;
44  sal_Int32 nStartRow;
45  std::vector<sal_Int32> mvColStart;
46  std::vector<sal_uInt8> mvColFormat;
47 
48 public:
50 
51  static const sal_Unicode cDefaultTextSep = '"';
52 
53  void ReadFromString( const OUString& 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; }
84  void SetLanguage(LanguageType e) { eLang = e; }
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: */
sal_Unicode GetTextSep() const
Definition: asciiopt.hxx:64
const sal_Int32 * GetColStart() const
Definition: asciiopt.hxx:67
bool IsRemoveSpace() const
Definition: asciiopt.hxx:59
bool bQuotedFieldAsText
Definition: asciiopt.hxx:34
bool bEvaluateFormulas
Definition: asciiopt.hxx:36
OUString aFieldSeps
Definition: asciiopt.hxx:31
rtl_TextEncoding eCharSet
Definition: asciiopt.hxx:41
void SetColumnInfo(const ScCsvExpDataVec &rDataVec)
Definition: asciiopt.cxx:47
void SetCharSetSystem(bool bSet)
Definition: asciiopt.hxx:73
bool bSaveAsShown
Definition: asciiopt.hxx:38
void SetSkipEmptyCells(bool bSet)
Definition: asciiopt.hxx:81
void SetStartRow(sal_Int32 nRow)
Definition: asciiopt.hxx:83
OUString WriteToString() const
Definition: asciiopt.cxx:195
void SetCharSet(rtl_TextEncoding eNew)
Definition: asciiopt.hxx:72
sal_uInt16 sal_Unicode
sal_uInt16 GetInfoCount() const
Definition: asciiopt.hxx:66
void SetDetectSpecialNumber(bool bSet)
Definition: asciiopt.hxx:79
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:268
LanguageType GetLanguage() const
Definition: asciiopt.hxx:70
LanguageType eLang
Definition: asciiopt.hxx:42
bool IsFixedLen() const
Definition: asciiopt.hxx:65
bool IsEvaluateFormulas() const
Definition: asciiopt.hxx:62
void SetEvaluateFormulas(bool bSet)
Definition: asciiopt.hxx:80
sal_Int32 nStartRow
Definition: asciiopt.hxx:44
std::vector< sal_Int32 > mvColStart
Definition: asciiopt.hxx:45
void SetQuotedAsText(bool bSet)
Definition: asciiopt.hxx:78
void SetLanguage(LanguageType e)
Definition: asciiopt.hxx:84
void SetRemoveSpace(bool bSet)
Definition: asciiopt.hxx:77
static const sal_Unicode cDefaultTextSep
Definition: asciiopt.hxx:51
bool bDetectSpecialNumber
Definition: asciiopt.hxx:35
bool IsDetectSpecialNumber() const
Definition: asciiopt.hxx:61
bool bSaveFormulas
Definition: asciiopt.hxx:39
bool bSkipEmptyCells
Definition: asciiopt.hxx:37
void SetFixedLen(bool bSet)
Definition: asciiopt.hxx:74
void SetFieldSeps(const OUString &rStr)
Definition: asciiopt.hxx:75
bool IsQuotedAsText() const
Definition: asciiopt.hxx:60
const sal_uInt8 * GetColFormat() const
Definition: asciiopt.hxx:68
sal_Int32 GetStartRow() const
Definition: asciiopt.hxx:69
void ReadFromString(const OUString &rString)
Definition: asciiopt.cxx:86
unsigned char sal_uInt8
bool bMergeFieldSeps
Definition: asciiopt.hxx:32
ScImportAsciiCall
How ScImportAsciiDlg is called.
Definition: asciiopt.hxx:103
rtl_TextEncoding GetCharSet() const
Definition: asciiopt.hxx:56
bool IsSkipEmptyCells() const
Definition: asciiopt.hxx:63
bool bRemoveSpace
Definition: asciiopt.hxx:33
std::vector< sal_uInt8 > mvColFormat
Definition: asciiopt.hxx:46
void SetMergeSeps(bool bSet)
Definition: asciiopt.hxx:76
sal_Unicode cTextSep
Definition: asciiopt.hxx:40
::std::vector< ScCsvExpData > ScCsvExpDataVec
Definition: csvcontrol.hxx:73
const OUString & GetFieldSeps() const
Definition: asciiopt.hxx:57
void SetTextSep(sal_Unicode c)
Definition: asciiopt.hxx:82
bool IsMergeSeps() const
Definition: asciiopt.hxx:58
bool bCharSetSystem
Definition: asciiopt.hxx:43