Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / asciiopt.hxx
blobc114d389c8a3418ad8c50d7c1fc0a7908d032e6c
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 // ============================================================================
22 #ifndef SC_ASCIIOPT_HXX
23 #define SC_ASCIIOPT_HXX
25 #include <vcl/dialog.hxx>
26 #include <vcl/button.hxx>
27 #include <vcl/fixed.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <vcl/combobox.hxx>
30 #include <vcl/field.hxx>
31 #include <tools/stream.hxx>
32 #include <svx/txencbox.hxx>
33 #include "csvtablebox.hxx"
34 #include "i18nlangtag/lang.h"
36 // ============================================================================
38 class ScAsciiOptions
40 private:
41 bool bFixedLen;
42 OUString aFieldSeps;
43 bool bMergeFieldSeps;
44 bool bQuotedFieldAsText;
45 bool bDetectSpecialNumber;
46 sal_Unicode cTextSep;
47 rtl_TextEncoding eCharSet;
48 LanguageType eLang;
49 bool bCharSetSystem;
50 long nStartRow;
51 sal_uInt16 nInfoCount;
52 sal_Int32* pColStart; //! TODO replace with vector
53 sal_uInt8* pColFormat; //! TODO replace with vector
55 public:
56 ScAsciiOptions();
57 ScAsciiOptions(const ScAsciiOptions& rOpt);
58 ~ScAsciiOptions();
60 static const sal_Unicode cDefaultTextSep = '"';
62 ScAsciiOptions& operator=( const ScAsciiOptions& rCpy );
64 bool operator==( const ScAsciiOptions& rCmp ) const;
66 void ReadFromString( const OUString& rString );
67 OUString WriteToString() const;
69 void InterpretColumnList( const OUString& rString );
71 rtl_TextEncoding GetCharSet() const { return eCharSet; }
72 bool GetCharSetSystem() const { return bCharSetSystem; }
73 const OUString& GetFieldSeps() const { return aFieldSeps; }
74 bool IsMergeSeps() const { return bMergeFieldSeps; }
75 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
76 bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
77 sal_Unicode GetTextSep() const { return cTextSep; }
78 bool IsFixedLen() const { return bFixedLen; }
79 sal_uInt16 GetInfoCount() const { return nInfoCount; }
80 const sal_Int32* GetColStart() const { return pColStart; }
81 const sal_uInt8* GetColFormat() const { return pColFormat; }
82 long GetStartRow() const { return nStartRow; }
83 LanguageType GetLanguage() const { return eLang; }
85 void SetCharSet( rtl_TextEncoding eNew ) { eCharSet = eNew; }
86 void SetCharSetSystem( bool bSet ) { bCharSetSystem = bSet; }
87 void SetFixedLen( bool bSet ) { bFixedLen = bSet; }
88 void SetFieldSeps( const OUString& rStr ) { aFieldSeps = rStr; }
89 void SetMergeSeps( bool bSet ) { bMergeFieldSeps = bSet; }
90 void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
91 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
92 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
93 void SetStartRow( long nRow) { nStartRow= nRow; }
94 void SetLanguage(LanguageType e) { eLang = e; }
96 void SetColInfo( sal_uInt16 nCount, const sal_Int32* pStart, const sal_uInt8* pFormat );
97 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
99 /** From the import field separators obtain the one most likely to be used
100 for export, if multiple separators weighted comma, tab, semicolon,
101 space and other.
103 @param bDecodeNumbers
104 If TRUE, the separators are encoded as numbers and need to be
105 decoded before characters can be extracted, for example "59/44"
106 to ";,".
107 If FALSE, the string is taken as is and each character is
108 expected to be one separator.
110 static sal_Unicode GetWeightedFieldSep( const OUString & rFieldSeps, bool bDecodeNumbers );
113 /// How ScImportAsciiDlg is called
114 enum ScImportAsciiCall {
115 SC_IMPORTFILE, // with File > Open: Text - CSV
116 SC_PASTETEXT, // with Paste > Unformatted Text
117 SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */