Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : // ============================================================================
30 : :
31 : : #ifndef SC_ASCIIOPT_HXX
32 : : #define SC_ASCIIOPT_HXX
33 : :
34 : : #include <tools/string.hxx>
35 : : #include <vcl/dialog.hxx>
36 : : #include <vcl/button.hxx>
37 : : #include <vcl/fixed.hxx>
38 : : #include <vcl/lstbox.hxx>
39 : : #include <vcl/combobox.hxx>
40 : : #include <vcl/field.hxx>
41 : : #include <tools/stream.hxx>
42 : : #include <svx/txencbox.hxx>
43 : : #include "csvtablebox.hxx"
44 : : #include "i18npool/lang.h"
45 : :
46 : : // ============================================================================
47 : :
48 : : class SC_DLLPUBLIC ScAsciiOptions
49 : : {
50 : : private:
51 : : sal_Bool bFixedLen;
52 : : String aFieldSeps;
53 : : sal_Bool bMergeFieldSeps;
54 : : bool bQuotedFieldAsText;
55 : : bool bDetectSpecialNumber;
56 : : sal_Unicode cTextSep;
57 : : CharSet eCharSet;
58 : : LanguageType eLang;
59 : : sal_Bool bCharSetSystem;
60 : : long nStartRow;
61 : : sal_uInt16 nInfoCount;
62 : : sal_Int32* pColStart; //! TODO replace with vector
63 : : sal_uInt8* pColFormat; //! TODO replace with vector
64 : :
65 : : public:
66 : : ScAsciiOptions();
67 : : ScAsciiOptions(const ScAsciiOptions& rOpt);
68 : : ~ScAsciiOptions();
69 : :
70 : : static const sal_Unicode cDefaultTextSep = '"';
71 : :
72 : : ScAsciiOptions& operator=( const ScAsciiOptions& rCpy );
73 : :
74 : : sal_Bool operator==( const ScAsciiOptions& rCmp ) const;
75 : :
76 : : void ReadFromString( const String& rString );
77 : : String WriteToString() const;
78 : :
79 : : void InterpretColumnList( const String& rString );
80 : :
81 : 6 : CharSet GetCharSet() const { return eCharSet; }
82 : : sal_Bool GetCharSetSystem() const { return bCharSetSystem; }
83 : 12 : const String& GetFieldSeps() const { return aFieldSeps; }
84 : 6 : sal_Bool IsMergeSeps() const { return bMergeFieldSeps; }
85 : 6 : bool IsQuotedAsText() const { return bQuotedFieldAsText; }
86 : 6 : bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
87 : 6 : sal_Unicode GetTextSep() const { return cTextSep; }
88 : 6 : sal_Bool IsFixedLen() const { return bFixedLen; }
89 : 6 : sal_uInt16 GetInfoCount() const { return nInfoCount; }
90 : 6 : const sal_Int32* GetColStart() const { return pColStart; }
91 : 6 : const sal_uInt8* GetColFormat() const { return pColFormat; }
92 : 6 : long GetStartRow() const { return nStartRow; }
93 : 6 : LanguageType GetLanguage() const { return eLang; }
94 : :
95 : 6 : void SetCharSet( CharSet eNew ) { eCharSet = eNew; }
96 : 0 : void SetCharSetSystem( sal_Bool bSet ) { bCharSetSystem = bSet; }
97 : 0 : void SetFixedLen( sal_Bool bSet ) { bFixedLen = bSet; }
98 : 6 : void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; }
99 : 0 : void SetMergeSeps( sal_Bool bSet ) { bMergeFieldSeps = bSet; }
100 : 0 : void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
101 : 0 : void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
102 : 6 : void SetTextSep( sal_Unicode c ) { cTextSep = c; }
103 : 0 : void SetStartRow( long nRow) { nStartRow= nRow; }
104 : 0 : void SetLanguage(LanguageType e) { eLang = e; }
105 : :
106 : : void SetColInfo( sal_uInt16 nCount, const sal_Int32* pStart, const sal_uInt8* pFormat );
107 : : void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
108 : : };
109 : :
110 : : /// How ScImportAsciiDlg is called
111 : : enum ScImportAsciiCall {
112 : : SC_IMPORTFILE, // with File > Open: Text - CSV
113 : : SC_PASTETEXT, // with Paste > Unformatted Text
114 : : SC_TEXTTOCOLUMNS }; // with Data > Text to Columns
115 : :
116 : : #endif
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|