Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / asciiopt.hxx
blob551b5f27799071e0c1c885e516b0317d413badfa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
23 #include <rtl/ustring.hxx>
24 #include <i18nlangtag/lang.h>
26 #include "csvcontrol.hxx"
28 class ScAsciiOptions
30 private:
31 bool bFixedLen;
32 OUString aFieldSeps;
33 bool bMergeFieldSeps;
34 bool bQuotedFieldAsText;
35 bool bDetectSpecialNumber;
36 sal_Unicode cTextSep;
37 rtl_TextEncoding eCharSet;
38 LanguageType eLang;
39 bool bCharSetSystem;
40 long nStartRow;
41 sal_uInt16 nInfoCount;
42 sal_Int32* pColStart; //! TODO replace with vector
43 sal_uInt8* pColFormat; //! TODO replace with vector
45 public:
46 ScAsciiOptions();
47 ScAsciiOptions(const ScAsciiOptions& rOpt);
48 ~ScAsciiOptions();
50 static const sal_Unicode cDefaultTextSep = '"';
52 ScAsciiOptions& operator=( const ScAsciiOptions& rCpy );
54 void ReadFromString( const OUString& rString );
55 OUString WriteToString() const;
57 rtl_TextEncoding GetCharSet() const { return eCharSet; }
58 const OUString& GetFieldSeps() const { return aFieldSeps; }
59 bool IsMergeSeps() const { return bMergeFieldSeps; }
60 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
61 bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
62 sal_Unicode GetTextSep() const { return cTextSep; }
63 bool IsFixedLen() const { return bFixedLen; }
64 sal_uInt16 GetInfoCount() const { return nInfoCount; }
65 const sal_Int32* GetColStart() const { return pColStart; }
66 const sal_uInt8* GetColFormat() const { return pColFormat; }
67 long GetStartRow() const { return nStartRow; }
68 LanguageType GetLanguage() const { return eLang; }
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 SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
76 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
77 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
78 void SetStartRow( long nRow) { nStartRow= nRow; }
79 void SetLanguage(LanguageType e) { eLang = e; }
81 void SetColInfo( sal_uInt16 nCount, const sal_Int32* pStart, const sal_uInt8* pFormat );
82 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
84 /** From the import field separators obtain the one most likely to be used
85 for export, if multiple separators weighted comma, tab, semicolon,
86 space and other.
88 @param bDecodeNumbers
89 If TRUE, the separators are encoded as numbers and need to be
90 decoded before characters can be extracted, for example "59/44"
91 to ";,".
92 If FALSE, the string is taken as is and each character is
93 expected to be one separator.
95 static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
98 /// How ScImportAsciiDlg is called
99 enum ScImportAsciiCall {
100 SC_IMPORTFILE, // with File > Open: Text - CSV
101 SC_PASTETEXT, // with Paste > Unformatted Text
102 SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
104 #endif
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */