Update ooo320-m1
[ooovba.git] / sc / source / ui / inc / asciiopt.hxx
blobd3f9ba47484199861d00767672919c4ac3bd5af1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: asciiopt.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // ============================================================================
33 #ifndef SC_ASCIIOPT_HXX
34 #define SC_ASCIIOPT_HXX
36 #include <tools/string.hxx>
37 #ifndef _DIALOG_HXX //autogen
38 #include <vcl/dialog.hxx>
39 #endif
40 #ifndef _BUTTON_HXX //autogen
41 #include <vcl/button.hxx>
42 #endif
43 #ifndef _FIXED_HXX //autogen
44 #include <vcl/fixed.hxx>
45 #endif
46 #ifndef _LSTBOX_HXX //autogen
47 #include <vcl/lstbox.hxx>
48 #endif
49 #ifndef _COMBOBOX_HXX //autogen
50 #include <vcl/combobox.hxx>
51 #endif
52 #ifndef _FIELD_HXX //autogen
53 #include <vcl/field.hxx>
54 #endif
55 #include <tools/stream.hxx>
56 #include <svx/txencbox.hxx>
57 #include "csvtablebox.hxx"
58 #include "i18npool/lang.h"
60 // ============================================================================
62 class ScAsciiOptions
64 private:
65 BOOL bFixedLen;
66 String aFieldSeps;
67 BOOL bMergeFieldSeps;
68 bool bQuotedFieldAsText;
69 bool bDetectSpecialNumber;
70 sal_Unicode cTextSep;
71 CharSet eCharSet;
72 LanguageType eLang;
73 BOOL bCharSetSystem;
74 long nStartRow;
75 USHORT nInfoCount;
76 xub_StrLen* pColStart; //! TODO replace with vector
77 BYTE* pColFormat; //! TODO replace with vector
79 public:
80 ScAsciiOptions();
81 ScAsciiOptions(const ScAsciiOptions& rOpt);
82 ~ScAsciiOptions();
84 static const sal_Unicode cDefaultTextSep = '"';
86 ScAsciiOptions& operator=( const ScAsciiOptions& rCpy );
88 BOOL operator==( const ScAsciiOptions& rCmp ) const;
90 void ReadFromString( const String& rString );
91 String WriteToString() const;
93 void InterpretColumnList( const String& rString );
95 CharSet GetCharSet() const { return eCharSet; }
96 BOOL GetCharSetSystem() const { return bCharSetSystem; }
97 const String& GetFieldSeps() const { return aFieldSeps; }
98 BOOL IsMergeSeps() const { return bMergeFieldSeps; }
99 bool IsQuotedAsText() const { return bQuotedFieldAsText; }
100 bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
101 sal_Unicode GetTextSep() const { return cTextSep; }
102 BOOL IsFixedLen() const { return bFixedLen; }
103 USHORT GetInfoCount() const { return nInfoCount; }
104 const xub_StrLen* GetColStart() const { return pColStart; }
105 const BYTE* GetColFormat() const { return pColFormat; }
106 long GetStartRow() const { return nStartRow; }
107 LanguageType GetLanguage() const { return eLang; }
109 void SetCharSet( CharSet eNew ) { eCharSet = eNew; }
110 void SetCharSetSystem( BOOL bSet ) { bCharSetSystem = bSet; }
111 void SetFixedLen( BOOL bSet ) { bFixedLen = bSet; }
112 void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; }
113 void SetMergeSeps( BOOL bSet ) { bMergeFieldSeps = bSet; }
114 void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
115 void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
116 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
117 void SetStartRow( long nRow) { nStartRow= nRow; }
118 void SetLanguage(LanguageType e) { eLang = e; }
120 void SetColInfo( USHORT nCount, const xub_StrLen* pStart, const BYTE* pFormat );
121 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
125 //CHINA001 // ============================================================================
126 //CHINA001
127 //CHINA001 class ScImportAsciiDlg : public ModalDialog
128 //CHINA001 {
129 //CHINA001 SvStream* pDatStream;
130 //CHINA001 ULONG* pRowPosArray;
131 //CHINA001 ULONG* pRowPosArrayUnicode;
132 //CHINA001 USHORT nArrayEndPos;
133 //CHINA001 USHORT nArrayEndPosUnicode;
134 //CHINA001 ULONG nStreamPos;
135 //CHINA001 ULONG nStreamPosUnicode;
136 //CHINA001 BOOL bVFlag;
137 //CHINA001
138 //CHINA001 FixedLine aFlFieldOpt;
139 //CHINA001 FixedText aFtCharSet;
140 //CHINA001 SvxTextEncodingBox aLbCharSet;
141 //CHINA001
142 //CHINA001 FixedText aFtRow;
143 //CHINA001 NumericField aNfRow;
144 //CHINA001
145 //CHINA001 FixedLine aFlSepOpt;
146 //CHINA001 RadioButton aRbFixed;
147 //CHINA001 RadioButton aRbSeparated;
148 //CHINA001
149 //CHINA001 CheckBox aCkbTab;
150 //CHINA001 CheckBox aCkbSemicolon;
151 //CHINA001 CheckBox aCkbComma;
152 //CHINA001 CheckBox aCkbSpace;
153 //CHINA001 CheckBox aCkbOther;
154 //CHINA001 Edit aEdOther;
155 //CHINA001 CheckBox aCkbAsOnce;
156 //CHINA001 FixedText aFtTextSep;
157 //CHINA001 ComboBox aCbTextSep;
158 //CHINA001
159 //CHINA001 FixedLine aFlWidth;
160 //CHINA001 FixedText aFtType;
161 //CHINA001 ListBox aLbType;
162 //CHINA001
163 //CHINA001 ScCsvTableBox maTableBox;
164 //CHINA001
165 //CHINA001 OKButton aBtnOk;
166 //CHINA001 CancelButton aBtnCancel;
167 //CHINA001 HelpButton aBtnHelp;
168 //CHINA001
169 //CHINA001 String aCharSetUser;
170 //CHINA001 String aColumnUser;
171 //CHINA001 String aFldSepList;
172 //CHINA001 String aTextSepList;
173 //CHINA001
174 //CHINA001 // aPreviewLine contains the byte string as read from the file
175 //CHINA001 ByteString aPreviewLine[ CSV_PREVIEW_LINES ];
176 //CHINA001 // same for Unicode
177 //CHINA001 String aPreviewLineUnicode[ CSV_PREVIEW_LINES ];
178 //CHINA001
179 //CHINA001 CharSet meCharSet; /// Selected char set.
180 //CHINA001 bool mbCharSetSystem; /// Is System char set selected?
181 //CHINA001
182 //CHINA001 public:
183 //CHINA001 ScImportAsciiDlg(
184 //CHINA001 Window* pParent, String aDatName,
185 //CHINA001 SvStream* pInStream, sal_Unicode cSep = '\t' );
186 //CHINA001 ~ScImportAsciiDlg();
187 //CHINA001
188 //CHINA001 void GetOptions( ScAsciiOptions& rOpt );
189 //CHINA001
190 //CHINA001 private:
191 //CHINA001 /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
192 //CHINA001 void SetSelectedCharSet();
193 //CHINA001 /** Returns all separator characters in a string. */
194 //CHINA001 String GetSeparators() const;
195 //CHINA001
196 //CHINA001 /** Enables or disables all separator checkboxes and edit fields. */
197 //CHINA001 void SetupSeparatorCtrls();
198 //CHINA001
199 //CHINA001 void UpdateVertical( bool bSwitchToFromUnicode = false );
200 //CHINA001
201 //CHINA001 DECL_LINK( CharSetHdl, SvxTextEncodingBox* );
202 //CHINA001 DECL_LINK( FirstRowHdl, NumericField* );
203 //CHINA001 DECL_LINK( RbSepFixHdl, RadioButton* );
204 //CHINA001 DECL_LINK( SeparatorHdl, Control* );
205 //CHINA001 DECL_LINK( LbColTypeHdl, ListBox* );
206 //CHINA001 DECL_LINK( UpdateTextHdl, ScCsvTableBox* );
207 //CHINA001 DECL_LINK( ColTypeHdl, ScCsvTableBox* );
208 //CHINA001 };
209 //CHINA001
210 //CHINA001
211 // ============================================================================
213 #endif