update dev300-m58
[ooovba.git] / sc / source / ui / inc / scuiasciiopt.hxx
blob4515a8601b676cca7597d062fd23bf4dbf33b6e2
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: scuiasciiopt.hxx,v $
10 * $Revision: 1.7 $
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 SCUI_ASCIIOPT_HXX
34 #define SCUI_ASCIIOPT_HXX
37 #include "asciiopt.hxx"
38 #include "svx/langbox.hxx"
40 // ============================================================================
42 class ScImportAsciiDlg : public ModalDialog
44 SvStream* mpDatStream;
45 ULONG mnStreamPos;
46 ULONG* mpRowPosArray;
47 ULONG mnRowPosCount;
49 String maPreviewLine[ CSV_PREVIEW_LINES ];
51 FixedLine aFlFieldOpt;
52 FixedText aFtCharSet;
53 SvxTextEncodingBox aLbCharSet;
54 FixedText aFtCustomLang;
55 SvxLanguageBox aLbCustomLang;
57 FixedText aFtRow;
58 NumericField aNfRow;
60 FixedLine aFlSepOpt;
61 RadioButton aRbFixed;
62 RadioButton aRbSeparated;
64 CheckBox aCkbTab;
65 CheckBox aCkbSemicolon;
66 CheckBox aCkbComma;
67 CheckBox aCkbSpace;
68 CheckBox aCkbOther;
69 Edit aEdOther;
70 CheckBox aCkbAsOnce;
72 FixedLine aFlOtherOpt;
74 CheckBox aCkbQuotedAsText;
75 CheckBox aCkbDetectNumber;
77 FixedText aFtTextSep;
78 ComboBox aCbTextSep;
80 FixedLine aFlWidth;
81 FixedText aFtType;
82 ListBox aLbType;
84 ScCsvTableBox maTableBox;
86 OKButton aBtnOk;
87 CancelButton aBtnCancel;
88 HelpButton aBtnHelp;
90 String aCharSetUser;
91 String aColumnUser;
92 String aFldSepList;
93 String aTextSepList;
94 String maFieldSeparators; // selected field separators
95 sal_Unicode mcTextSep;
96 String maStrTextToColumns;
98 CharSet meCharSet; /// Selected char set.
99 bool mbCharSetSystem; /// Is System char set selected?
100 bool mbFileImport; /// Is this dialog involked for csv file import ?
102 public:
103 ScImportAsciiDlg(
104 Window* pParent, String aDatName,
105 SvStream* pInStream, sal_Unicode cSep = '\t' );
106 ~ScImportAsciiDlg();
108 void GetOptions( ScAsciiOptions& rOpt );
109 void SetTextToColumnsMode();
111 private:
112 /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
113 void SetSelectedCharSet();
114 /** Returns all separator characters in a string. */
115 String GetSeparators() const;
117 /** Enables or disables all separator checkboxes and edit fields. */
118 void SetupSeparatorCtrls();
121 bool GetLine( ULONG nLine, String &rText );
122 void UpdateVertical();
123 inline bool Seek( ULONG nPos ); // synced to and from mnStreamPos
125 DECL_LINK( CharSetHdl, SvxTextEncodingBox* );
126 DECL_LINK( FirstRowHdl, NumericField* );
127 DECL_LINK( RbSepFixHdl, RadioButton* );
128 DECL_LINK( SeparatorHdl, Control* );
129 DECL_LINK( LbColTypeHdl, ListBox* );
130 DECL_LINK( UpdateTextHdl, ScCsvTableBox* );
131 DECL_LINK( ColTypeHdl, ScCsvTableBox* );
135 inline bool ScImportAsciiDlg::Seek(ULONG nPos)
137 bool bSuccess = true;
138 if (nPos != mnStreamPos && mpDatStream)
140 if (mpDatStream->Seek( nPos ) != nPos)
141 bSuccess = false;
142 else
143 mnStreamPos = nPos;
145 return bSuccess;
148 #endif