1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/dialog.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <vcl/combobox.hxx>
28 #include <vcl/field.hxx>
29 #include <tools/stream.hxx>
30 #include <svx/txencbox.hxx>
31 #include "csvtablebox.hxx"
32 #include <i18nlangtag/lang.h>
40 bool bQuotedFieldAsText
;
41 bool bDetectSpecialNumber
;
43 rtl_TextEncoding eCharSet
;
47 sal_uInt16 nInfoCount
;
48 sal_Int32
* pColStart
; //! TODO replace with vector
49 sal_uInt8
* pColFormat
; //! TODO replace with vector
53 ScAsciiOptions(const ScAsciiOptions
& rOpt
);
56 static const sal_Unicode cDefaultTextSep
= '"';
58 ScAsciiOptions
& operator=( const ScAsciiOptions
& rCpy
);
60 bool operator==( const ScAsciiOptions
& rCmp
) const;
62 void ReadFromString( const OUString
& rString
);
63 OUString
WriteToString() const;
65 void InterpretColumnList( const OUString
& rString
);
67 rtl_TextEncoding
GetCharSet() const { return eCharSet
; }
68 bool GetCharSetSystem() const { return bCharSetSystem
; }
69 const OUString
& GetFieldSeps() const { return aFieldSeps
; }
70 bool IsMergeSeps() const { return bMergeFieldSeps
; }
71 bool IsQuotedAsText() const { return bQuotedFieldAsText
; }
72 bool IsDetectSpecialNumber() const { return bDetectSpecialNumber
; }
73 sal_Unicode
GetTextSep() const { return cTextSep
; }
74 bool IsFixedLen() const { return bFixedLen
; }
75 sal_uInt16
GetInfoCount() const { return nInfoCount
; }
76 const sal_Int32
* GetColStart() const { return pColStart
; }
77 const sal_uInt8
* GetColFormat() const { return pColFormat
; }
78 long GetStartRow() const { return nStartRow
; }
79 LanguageType
GetLanguage() const { return eLang
; }
81 void SetCharSet( rtl_TextEncoding eNew
) { eCharSet
= eNew
; }
82 void SetCharSetSystem( bool bSet
) { bCharSetSystem
= bSet
; }
83 void SetFixedLen( bool bSet
) { bFixedLen
= bSet
; }
84 void SetFieldSeps( const OUString
& rStr
) { aFieldSeps
= rStr
; }
85 void SetMergeSeps( bool bSet
) { bMergeFieldSeps
= bSet
; }
86 void SetQuotedAsText(bool bSet
) { bQuotedFieldAsText
= bSet
; }
87 void SetDetectSpecialNumber(bool bSet
) { bDetectSpecialNumber
= bSet
; }
88 void SetTextSep( sal_Unicode c
) { cTextSep
= c
; }
89 void SetStartRow( long nRow
) { nStartRow
= nRow
; }
90 void SetLanguage(LanguageType e
) { eLang
= e
; }
92 void SetColInfo( sal_uInt16 nCount
, const sal_Int32
* pStart
, const sal_uInt8
* pFormat
);
93 void SetColumnInfo( const ScCsvExpDataVec
& rDataVec
);
95 /** From the import field separators obtain the one most likely to be used
96 for export, if multiple separators weighted comma, tab, semicolon,
100 If TRUE, the separators are encoded as numbers and need to be
101 decoded before characters can be extracted, for example "59/44"
103 If FALSE, the string is taken as is and each character is
104 expected to be one separator.
106 static sal_Unicode
GetWeightedFieldSep( const OUString
& rFieldSeps
, bool bDecodeNumbers
);
109 /// How ScImportAsciiDlg is called
110 enum ScImportAsciiCall
{
111 SC_IMPORTFILE
, // with File > Open: Text - CSV
112 SC_PASTETEXT
, // with Paste > Unformatted Text
113 SC_TEXTTOCOLUMNS
}; // with Data > Text to Columns
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */