1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
23 #include "asciiopt.hxx"
24 #include <svx/langbox.hxx>
26 class ScImportAsciiDlg
: public ModalDialog
28 SvStream
* mpDatStream
;
29 sal_uLong mnStreamPos
;
30 sal_uLong
* mpRowPosArray
;
31 sal_uLong mnRowPosCount
;
33 OUString maPreviewLine
[ CSV_PREVIEW_LINES
];
35 VclPtr
<FixedText
> pFtCharSet
;
37 VclPtr
<SvxTextEncodingBox
> pLbCharSet
;
39 VclPtr
<FixedText
> pFtCustomLang
;
41 VclPtr
<SvxLanguageBox
> pLbCustomLang
;
43 VclPtr
<FixedText
> pFtRow
;
44 VclPtr
<NumericField
> pNfRow
;
46 VclPtr
<RadioButton
> pRbFixed
;
47 VclPtr
<RadioButton
> pRbSeparated
;
49 VclPtr
<CheckBox
> pCkbTab
;
50 VclPtr
<CheckBox
> pCkbSemicolon
;
51 VclPtr
<CheckBox
> pCkbComma
;
52 VclPtr
<CheckBox
> pCkbSpace
;
53 VclPtr
<CheckBox
> pCkbOther
;
54 VclPtr
<Edit
> pEdOther
;
55 VclPtr
<CheckBox
> pCkbAsOnce
;
57 VclPtr
<FixedText
> pFtTextSep
;
58 VclPtr
<ComboBox
> pCbTextSep
;
60 VclPtr
<CheckBox
> pCkbQuotedAsText
;
61 VclPtr
<CheckBox
> pCkbDetectNumber
;
63 VclPtr
<FixedText
> pFtType
;
64 VclPtr
<ListBox
> pLbType
;
66 VclPtr
<ScCsvTableBox
> mpTableBox
;
68 OUString aCharSetUser
;
70 OUString aTextSepList
;
71 OUString maFieldSeparators
; // selected field separators
72 sal_Unicode mcTextSep
;
74 rtl_TextEncoding meCharSet
; /// Selected char set.
75 bool mbCharSetSystem
; /// Is System char set selected?
76 ScImportAsciiCall meCall
; /// How the dialog is called (see asciiopt.hxx)
80 vcl::Window
* pParent
, const OUString
& aDatName
,
81 SvStream
* pInStream
, ScImportAsciiCall eCall
);
82 virtual ~ScImportAsciiDlg();
83 virtual void dispose() SAL_OVERRIDE
;
85 void GetOptions( ScAsciiOptions
& rOpt
);
86 void SaveParameters();
89 /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
90 void SetSelectedCharSet();
91 /** Set separators in ui from maFieldSeparators */
93 /** Returns all separator characters in a string. */
94 OUString
GetSeparators() const;
96 /** Enables or disables all separator checkboxes and edit fields. */
97 void SetupSeparatorCtrls();
99 bool GetLine( sal_uLong nLine
, OUString
&rText
);
100 void UpdateVertical();
101 inline bool Seek( sal_uLong nPos
); // synced to and from mnStreamPos
103 DECL_LINK( CharSetHdl
, SvxTextEncodingBox
* );
104 DECL_LINK( FirstRowHdl
, NumericField
* );
105 DECL_LINK( RbSepFixHdl
, RadioButton
* );
106 DECL_LINK( SeparatorHdl
, Control
* );
107 DECL_LINK( LbColTypeHdl
, ListBox
* );
108 DECL_LINK(UpdateTextHdl
, void *);
109 DECL_LINK( ColTypeHdl
, ScCsvTableBox
* );
112 inline bool ScImportAsciiDlg::Seek(sal_uLong nPos
)
114 bool bSuccess
= true;
115 if (nPos
!= mnStreamPos
&& mpDatStream
)
117 if (mpDatStream
->Seek( nPos
) != nPos
)
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */