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 #ifndef INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include <i18nlangtag/lang.h>
25 
26 #include "csvcontrol.hxx"
27 
29 {
30 private:
31  bool bFixedLen;
32  OUString aFieldSeps;
41  rtl_TextEncoding eCharSet;
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 IsSkipEmptyCells() const { return bSkipEmptyCells; }
63  sal_Unicode GetTextSep() const { return cTextSep; }
64  bool IsFixedLen() const { return bFixedLen; }
65  sal_uInt16 GetInfoCount() const { return mvColStart.size(); }
66  const sal_Int32* GetColStart() const { return mvColStart.data(); }
67  const sal_uInt8* GetColFormat() const { return mvColFormat.data(); }
68  tools::Long GetStartRow() const { return nStartRow; }
69  LanguageType GetLanguage() const { return eLang; }
70 
71  void SetCharSet( rtl_TextEncoding eNew ) { eCharSet = eNew; }
72  void SetCharSetSystem( bool bSet ) { bCharSetSystem = bSet; }
73  void SetFixedLen( bool bSet ) { bFixedLen = bSet; }
74  void SetFieldSeps( const OUString& rStr ) { aFieldSeps = rStr; }
75  void SetMergeSeps( bool bSet ) { bMergeFieldSeps = bSet; }
76  void SetRemoveSpace( bool bSet ) { bRemoveSpace = bSet; }
77  void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
78  void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
79  void SetSkipEmptyCells(bool bSet) { bSkipEmptyCells = bSet; }
80  void SetTextSep( sal_Unicode c ) { cTextSep = c; }
81  void SetStartRow( tools::Long nRow) { nStartRow= nRow; }
82  void SetLanguage(LanguageType e) { eLang = e; }
83 
84  void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
85 
97  static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
98 };
99 
102  SC_IMPORTFILE, // with File > Open: Text - CSV
103  SC_PASTETEXT, // with Paste > Unformatted Text
104  SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
105 
106 #endif
107 
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Unicode GetTextSep() const
Definition: asciiopt.hxx:63
const sal_Int32 * GetColStart() const
Definition: asciiopt.hxx:66
bool IsRemoveSpace() const
Definition: asciiopt.hxx:59
bool bQuotedFieldAsText
Definition: asciiopt.hxx:35
OUString aFieldSeps
Definition: asciiopt.hxx:32
rtl_TextEncoding eCharSet
Definition: asciiopt.hxx:41
long Long
void SetColumnInfo(const ScCsvExpDataVec &rDataVec)
Definition: asciiopt.cxx:46
void SetCharSetSystem(bool bSet)
Definition: asciiopt.hxx:72
void SetStartRow(tools::Long nRow)
Definition: asciiopt.hxx:81
bool bSaveAsShown
Definition: asciiopt.hxx:38
void SetSkipEmptyCells(bool bSet)
Definition: asciiopt.hxx:79
OUString WriteToString() const
Definition: asciiopt.cxx:179
void SetCharSet(rtl_TextEncoding eNew)
Definition: asciiopt.hxx:71
sal_uInt16 sal_Unicode
sal_uInt16 GetInfoCount() const
Definition: asciiopt.hxx:65
void SetDetectSpecialNumber(bool bSet)
Definition: asciiopt.hxx:78
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:246
LanguageType GetLanguage() const
Definition: asciiopt.hxx:69
LanguageType eLang
Definition: asciiopt.hxx:42
bool IsFixedLen() const
Definition: asciiopt.hxx:64
std::vector< sal_Int32 > mvColStart
Definition: asciiopt.hxx:45
void SetQuotedAsText(bool bSet)
Definition: asciiopt.hxx:77
void SetLanguage(LanguageType e)
Definition: asciiopt.hxx:82
void SetRemoveSpace(bool bSet)
Definition: asciiopt.hxx:76
static const sal_Unicode cDefaultTextSep
Definition: asciiopt.hxx:51
bool bDetectSpecialNumber
Definition: asciiopt.hxx:36
tools::Long GetStartRow() const
Definition: asciiopt.hxx:68
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:73
void SetFieldSeps(const OUString &rStr)
Definition: asciiopt.hxx:74
bool IsQuotedAsText() const
Definition: asciiopt.hxx:60
const sal_uInt8 * GetColFormat() const
Definition: asciiopt.hxx:67
tools::Long nStartRow
Definition: asciiopt.hxx:44
void ReadFromString(const OUString &rString)
Definition: asciiopt.cxx:85
unsigned char sal_uInt8
bool bMergeFieldSeps
Definition: asciiopt.hxx:33
ScImportAsciiCall
How ScImportAsciiDlg is called.
Definition: asciiopt.hxx:101
rtl_TextEncoding GetCharSet() const
Definition: asciiopt.hxx:56
bool IsSkipEmptyCells() const
Definition: asciiopt.hxx:62
bool bRemoveSpace
Definition: asciiopt.hxx:34
std::vector< sal_uInt8 > mvColFormat
Definition: asciiopt.hxx:46
void SetMergeSeps(bool bSet)
Definition: asciiopt.hxx:75
sal_Unicode cTextSep
Definition: asciiopt.hxx:40
::std::vector< ScCsvExpData > ScCsvExpDataVec
Definition: csvcontrol.hxx:75
const OUString & GetFieldSeps() const
Definition: asciiopt.hxx:57
void SetTextSep(sal_Unicode c)
Definition: asciiopt.hxx:80
bool IsMergeSeps() const
Definition: asciiopt.hxx:58
bool bCharSetSystem
Definition: asciiopt.hxx:43