Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : // ============================================================================
30 : :
31 : : #ifndef SCUI_ASCIIOPT_HXX
32 : : #define SCUI_ASCIIOPT_HXX
33 : :
34 : :
35 : : #include "asciiopt.hxx"
36 : : #include "svx/langbox.hxx"
37 : :
38 : : // ============================================================================
39 : :
40 : : class ScImportAsciiDlg : public ModalDialog
41 : : {
42 : : SvStream* mpDatStream;
43 : : sal_uLong mnStreamPos;
44 : : sal_uLong* mpRowPosArray;
45 : : sal_uLong mnRowPosCount;
46 : :
47 : : rtl::OUString maPreviewLine[ CSV_PREVIEW_LINES ];
48 : :
49 : : FixedLine aFlFieldOpt;
50 : : FixedText aFtCharSet;
51 : : SvxTextEncodingBox aLbCharSet;
52 : : FixedText aFtCustomLang;
53 : : SvxLanguageBox aLbCustomLang;
54 : :
55 : : FixedText aFtRow;
56 : : NumericField aNfRow;
57 : :
58 : : FixedLine aFlSepOpt;
59 : : RadioButton aRbFixed;
60 : : RadioButton aRbSeparated;
61 : :
62 : : CheckBox aCkbTab;
63 : : CheckBox aCkbSemicolon;
64 : : CheckBox aCkbComma;
65 : : CheckBox aCkbSpace;
66 : : CheckBox aCkbOther;
67 : : Edit aEdOther;
68 : : CheckBox aCkbAsOnce;
69 : :
70 : : FixedLine aFlOtherOpt;
71 : :
72 : : FixedText aFtTextSep;
73 : : ComboBox aCbTextSep;
74 : :
75 : : CheckBox aCkbQuotedAsText;
76 : : CheckBox aCkbDetectNumber;
77 : :
78 : : FixedLine aFlWidth;
79 : : FixedText aFtType;
80 : : ListBox aLbType;
81 : :
82 : : ScCsvTableBox maTableBox;
83 : :
84 : : OKButton aBtnOk;
85 : : CancelButton aBtnCancel;
86 : : HelpButton aBtnHelp;
87 : :
88 : : String aCharSetUser;
89 : : String aColumnUser;
90 : : String aTextSepList;
91 : : String maFieldSeparators; // selected field separators
92 : : sal_Unicode mcTextSep;
93 : : String maStrTextToColumns;
94 : :
95 : : CharSet meCharSet; /// Selected char set.
96 : : bool mbCharSetSystem; /// Is System char set selected?
97 : : ScImportAsciiCall meCall; /// How the dialog is called (see asciiopt.hxx)
98 : :
99 : : public:
100 : : ScImportAsciiDlg(
101 : : Window* pParent, String aDatName,
102 : : SvStream* pInStream, ScImportAsciiCall eCall );
103 : : ~ScImportAsciiDlg();
104 : :
105 : : void GetOptions( ScAsciiOptions& rOpt );
106 : : void SaveParameters();
107 : :
108 : : private:
109 : : /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
110 : : void SetSelectedCharSet();
111 : : /** Set separators in ui from maFieldSeparators */
112 : : void SetSeparators();
113 : : /** Returns all separator characters in a string. */
114 : : String GetSeparators() const;
115 : :
116 : : /** Enables or disables all separator checkboxes and edit fields. */
117 : : void SetupSeparatorCtrls();
118 : :
119 : :
120 : : bool GetLine( sal_uLong nLine, rtl::OUString &rText );
121 : : void UpdateVertical();
122 : : inline bool Seek( sal_uLong nPos ); // synced to and from mnStreamPos
123 : :
124 : : DECL_LINK( CharSetHdl, SvxTextEncodingBox* );
125 : : DECL_LINK( FirstRowHdl, NumericField* );
126 : : DECL_LINK( RbSepFixHdl, RadioButton* );
127 : : DECL_LINK( SeparatorHdl, Control* );
128 : : DECL_LINK( LbColTypeHdl, ListBox* );
129 : : DECL_LINK(UpdateTextHdl, void *);
130 : : DECL_LINK( ColTypeHdl, ScCsvTableBox* );
131 : : };
132 : :
133 : :
134 : 0 : inline bool ScImportAsciiDlg::Seek(sal_uLong nPos)
135 : : {
136 : 0 : bool bSuccess = true;
137 : 0 : if (nPos != mnStreamPos && mpDatStream)
138 : : {
139 : 0 : if (mpDatStream->Seek( nPos ) != nPos)
140 : 0 : bSuccess = false;
141 : : else
142 : 0 : mnStreamPos = nPos;
143 : : }
144 : 0 : return bSuccess;
145 : : }
146 : :
147 : : #endif
148 : :
149 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|