tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / asciiopt.hxx
blobaf97d4b0f2ba94c0f8aa809623e76e699b81980f
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 #pragma once
22 #include <rtl/ustring.hxx>
23 #include <i18nlangtag/lang.h>
25 #include "csvcontrol.hxx"
27 class ScAsciiOptions
29 private:
30 bool bFixedLen;
31 OUString aFieldSeps;
32 bool bMergeFieldSeps;
33 bool bRemoveSpace;
34 bool bQuotedFieldAsText;
35 bool bDetectSpecialNumber;
36 bool bDetectScientificNumber;
37 bool bEvaluateFormulas;
38 bool bSkipEmptyCells;
39 bool bSaveAsShown;
40 bool bSaveFormulas;
41 bool bIncludeBOM;
42 sal_Unicode cTextSep;
43 rtl_TextEncoding eCharSet;
44 LanguageType eLang;
45 bool bCharSetSystem;
46 sal_Int32 nStartRow;
47 std::vector<sal_Int32> mvColStart;
48 std::vector<sal_uInt8> mvColFormat;
50 public:
51 ScAsciiOptions();
53 static const sal_Unicode cDefaultTextSep = '"';
55 void ReadFromString( std::u16string_view rString, SvStream* pStream4Detect = nullptr );
56 OUString WriteToString() const;
58 rtl_TextEncoding GetCharSet() const { return eCharSet; }
59 const OUString& GetFieldSeps() const { return aFieldSeps; }
60 bool IsMergeSeps() const { return bMergeFieldSeps; }
61 bool IsRemoveSpace() const { return bRemoveSpace; }
62 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
63 bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
64 bool IsDetectScientificNumber() const { return bDetectScientificNumber; }
65 bool IsEvaluateFormulas() const { return bEvaluateFormulas; }
66 bool IsSkipEmptyCells() const { return bSkipEmptyCells; }
67 bool GetIncludeBOM() const { return bIncludeBOM; }
68 sal_Unicode GetTextSep() const { return cTextSep; }
69 bool IsFixedLen() const { return bFixedLen; }
70 sal_uInt16 GetInfoCount() const { return mvColStart.size(); }
71 const sal_Int32* GetColStart() const { return mvColStart.data(); }
72 const sal_uInt8* GetColFormat() const { return mvColFormat.data(); }
73 sal_Int32 GetStartRow() const { return nStartRow; }
74 LanguageType GetLanguage() const { return eLang; }
76 void SetCharSet( rtl_TextEncoding eNew ) { eCharSet = eNew; }
77 void SetCharSetSystem( bool bSet ) { bCharSetSystem = bSet; }
78 void SetFixedLen( bool bSet ) { bFixedLen = bSet; }
79 void SetFieldSeps( const OUString& rStr ) { aFieldSeps = rStr; }
80 void SetMergeSeps( bool bSet ) { bMergeFieldSeps = bSet; }
81 void SetRemoveSpace( bool bSet ) { bRemoveSpace = bSet; }
82 void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
83 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
84 void SetDetectScientificNumber(bool bSet){ bDetectScientificNumber = bSet; }
85 void SetEvaluateFormulas(bool bSet) { bEvaluateFormulas = bSet; }
86 void SetSkipEmptyCells(bool bSet) { bSkipEmptyCells = bSet; }
87 void SetIncludeBOM(bool bVal) { bIncludeBOM = bVal; }
88 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
89 void SetStartRow( sal_Int32 nRow) { nStartRow= nRow; }
90 void SetLanguage(LanguageType e) { eLang = e; }
92 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
94 /** From the import field separators obtain the one most likely to be used
95 for export, if multiple separators weighted comma, tab, semicolon,
96 space and other.
98 @param bDecodeNumbers
99 If TRUE, the separators are encoded as numbers and need to be
100 decoded before characters can be extracted, for example "59/44"
101 to ";,".
102 If FALSE, the string is taken as is and each character is
103 expected to be one separator.
105 static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
108 /// How ScImportAsciiDlg is called
109 enum ScImportAsciiCall {
110 SC_IMPORTFILE, // with File > Open: Text - CSV
111 SC_PASTETEXT, // with Paste > Unformatted Text
112 SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */