Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
21 : #define INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
22 :
23 : #include "asciiopt.hxx"
24 : #include <svx/langbox.hxx>
25 :
26 : class ScImportAsciiDlg : public ModalDialog
27 : {
28 : SvStream* mpDatStream;
29 : sal_uLong mnStreamPos;
30 : sal_uLong* mpRowPosArray;
31 : sal_uLong mnRowPosCount;
32 :
33 : OUString maPreviewLine[ CSV_PREVIEW_LINES ];
34 :
35 : FixedText* pFtCharSet;
36 :
37 : SvxTextEncodingBox* pLbCharSet;
38 :
39 : FixedText* pFtCustomLang;
40 :
41 : SvxLanguageBox* pLbCustomLang;
42 :
43 : FixedText* pFtRow;
44 : NumericField* pNfRow;
45 :
46 : RadioButton* pRbFixed;
47 : RadioButton* pRbSeparated;
48 :
49 : CheckBox* pCkbTab;
50 : CheckBox* pCkbSemicolon;
51 : CheckBox* pCkbComma;
52 : CheckBox* pCkbSpace;
53 : CheckBox* pCkbOther;
54 : Edit* pEdOther;
55 : CheckBox* pCkbAsOnce;
56 :
57 : FixedText* pFtTextSep;
58 : ComboBox* pCbTextSep;
59 :
60 : CheckBox* pCkbQuotedAsText;
61 : CheckBox* pCkbDetectNumber;
62 :
63 : FixedText* pFtType;
64 : ListBox* pLbType;
65 :
66 : ScCsvTableBox* mpTableBox;
67 :
68 : OUString aCharSetUser;
69 : OUString aColumnUser;
70 : OUString aTextSepList;
71 : OUString maFieldSeparators; // selected field separators
72 : sal_Unicode mcTextSep;
73 :
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)
77 :
78 : public:
79 : ScImportAsciiDlg(
80 : vcl::Window* pParent, const OUString& aDatName,
81 : SvStream* pInStream, ScImportAsciiCall eCall );
82 : virtual ~ScImportAsciiDlg();
83 :
84 : void GetOptions( ScAsciiOptions& rOpt );
85 : void SaveParameters();
86 :
87 : private:
88 : /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
89 : void SetSelectedCharSet();
90 : /** Set separators in ui from maFieldSeparators */
91 : void SetSeparators();
92 : /** Returns all separator characters in a string. */
93 : OUString GetSeparators() const;
94 :
95 : /** Enables or disables all separator checkboxes and edit fields. */
96 : void SetupSeparatorCtrls();
97 :
98 : bool GetLine( sal_uLong nLine, OUString &rText );
99 : void UpdateVertical();
100 : inline bool Seek( sal_uLong nPos ); // synced to and from mnStreamPos
101 :
102 : DECL_LINK( CharSetHdl, SvxTextEncodingBox* );
103 : DECL_LINK( FirstRowHdl, NumericField* );
104 : DECL_LINK( RbSepFixHdl, RadioButton* );
105 : DECL_LINK( SeparatorHdl, Control* );
106 : DECL_LINK( LbColTypeHdl, ListBox* );
107 : DECL_LINK(UpdateTextHdl, void *);
108 : DECL_LINK( ColTypeHdl, ScCsvTableBox* );
109 : };
110 :
111 0 : inline bool ScImportAsciiDlg::Seek(sal_uLong nPos)
112 : {
113 0 : bool bSuccess = true;
114 0 : if (nPos != mnStreamPos && mpDatStream)
115 : {
116 0 : if (mpDatStream->Seek( nPos ) != nPos)
117 0 : bSuccess = false;
118 : else
119 0 : mnStreamPos = nPos;
120 : }
121 0 : return bSuccess;
122 : }
123 :
124 : #endif
125 :
126 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|