1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scuiasciiopt.hxx,v $
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
;
49 String maPreviewLine
[ CSV_PREVIEW_LINES
];
51 FixedLine aFlFieldOpt
;
53 SvxTextEncodingBox aLbCharSet
;
54 FixedText aFtCustomLang
;
55 SvxLanguageBox aLbCustomLang
;
62 RadioButton aRbSeparated
;
65 CheckBox aCkbSemicolon
;
72 FixedLine aFlOtherOpt
;
74 CheckBox aCkbQuotedAsText
;
75 CheckBox aCkbDetectNumber
;
84 ScCsvTableBox maTableBox
;
87 CancelButton aBtnCancel
;
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 ?
104 Window
* pParent
, String aDatName
,
105 SvStream
* pInStream
, sal_Unicode cSep
= '\t' );
108 void GetOptions( ScAsciiOptions
& rOpt
);
109 void SetTextToColumnsMode();
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
)