xref: /aoo42x/main/sc/source/ui/inc/scuiasciiopt.hxx (revision 02c0dac2)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // ============================================================================
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef SCUI_ASCIIOPT_HXX
27cdf0e10cSrcweir #define SCUI_ASCIIOPT_HXX
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "asciiopt.hxx"
31cdf0e10cSrcweir #include "svx/langbox.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // ============================================================================
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class ScImportAsciiDlg : public ModalDialog
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     SvStream*                   mpDatStream;
38cdf0e10cSrcweir     sal_uLong                       mnStreamPos;
39cdf0e10cSrcweir     sal_uLong*                      mpRowPosArray;
40cdf0e10cSrcweir     sal_uLong                       mnRowPosCount;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     String                      maPreviewLine[ CSV_PREVIEW_LINES ];
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     FixedLine                   aFlFieldOpt;
45cdf0e10cSrcweir     FixedText                   aFtCharSet;
46cdf0e10cSrcweir     SvxTextEncodingBox          aLbCharSet;
47cdf0e10cSrcweir     FixedText                   aFtCustomLang;
48cdf0e10cSrcweir     SvxLanguageBox              aLbCustomLang;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     FixedText                   aFtRow;
51cdf0e10cSrcweir     NumericField                aNfRow;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     FixedLine                   aFlSepOpt;
54cdf0e10cSrcweir     RadioButton                 aRbFixed;
55cdf0e10cSrcweir     RadioButton                 aRbSeparated;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     CheckBox                    aCkbTab;
58cdf0e10cSrcweir     CheckBox                    aCkbSemicolon;
59cdf0e10cSrcweir     CheckBox                    aCkbComma;
60cdf0e10cSrcweir     CheckBox                    aCkbSpace;
61cdf0e10cSrcweir     CheckBox                    aCkbOther;
62cdf0e10cSrcweir     Edit                        aEdOther;
63cdf0e10cSrcweir     CheckBox                    aCkbAsOnce;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     FixedLine                   aFlOtherOpt;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     FixedText                   aFtTextSep;
68cdf0e10cSrcweir     ComboBox                    aCbTextSep;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     CheckBox                    aCkbQuotedAsText;
71cdf0e10cSrcweir     CheckBox                    aCkbDetectNumber;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     FixedLine                   aFlWidth;
74cdf0e10cSrcweir     FixedText                   aFtType;
75cdf0e10cSrcweir     ListBox                     aLbType;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     ScCsvTableBox               maTableBox;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     OKButton                    aBtnOk;
80cdf0e10cSrcweir     CancelButton                aBtnCancel;
81cdf0e10cSrcweir     HelpButton                  aBtnHelp;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     String                      aCharSetUser;
84cdf0e10cSrcweir     String                      aColumnUser;
85cdf0e10cSrcweir     String                      aTextSepList;
86cdf0e10cSrcweir     String                      maFieldSeparators;  // selected field separators
87cdf0e10cSrcweir 	sal_Unicode                 mcTextSep;
88cdf0e10cSrcweir     String                      maStrTextToColumns;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     CharSet                     meCharSet;          /// Selected char set.
91cdf0e10cSrcweir     bool                        mbCharSetSystem;    /// Is System char set selected?
92cdf0e10cSrcweir     bool                        mbFileImport;       /// Is this dialog involked for csv file import ?
93cdf0e10cSrcweir 
94cdf0e10cSrcweir public:
95cdf0e10cSrcweir                                 ScImportAsciiDlg(
96cdf0e10cSrcweir                                     Window* pParent, String aDatName,
97cdf0e10cSrcweir 									SvStream* pInStream, sal_Unicode cSep = '\t' );
98cdf0e10cSrcweir                                 ~ScImportAsciiDlg();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     void                        GetOptions( ScAsciiOptions& rOpt );
101cdf0e10cSrcweir     void                        SetTextToColumnsMode();
102cdf0e10cSrcweir     void                        SaveParameters();
103cdf0e10cSrcweir 
104cdf0e10cSrcweir private:
105cdf0e10cSrcweir     /** Sets the selected char set data to meCharSet and mbCharSetSystem. */
106cdf0e10cSrcweir     void                        SetSelectedCharSet();
107cdf0e10cSrcweir     /** Returns all separator characters in a string. */
108cdf0e10cSrcweir     String                      GetSeparators() const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     /** Enables or disables all separator checkboxes and edit fields. */
111cdf0e10cSrcweir     void                        SetupSeparatorCtrls();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     bool                        GetLine( sal_uLong nLine, String &rText );
115cdf0e10cSrcweir 	void                        UpdateVertical();
116cdf0e10cSrcweir 	inline bool                 Seek( sal_uLong nPos ); // synced to and from mnStreamPos
117cdf0e10cSrcweir 
118cdf0e10cSrcweir                                 DECL_LINK( CharSetHdl, SvxTextEncodingBox* );
119cdf0e10cSrcweir                                 DECL_LINK( FirstRowHdl, NumericField* );
120cdf0e10cSrcweir                                 DECL_LINK( RbSepFixHdl, RadioButton* );
121cdf0e10cSrcweir                                 DECL_LINK( SeparatorHdl, Control* );
122cdf0e10cSrcweir                                 DECL_LINK( LbColTypeHdl, ListBox* );
123cdf0e10cSrcweir                                 DECL_LINK( UpdateTextHdl, ScCsvTableBox* );
124cdf0e10cSrcweir                                 DECL_LINK( ColTypeHdl, ScCsvTableBox* );
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 
Seek(sal_uLong nPos)128cdf0e10cSrcweir inline bool ScImportAsciiDlg::Seek(sal_uLong nPos)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     bool bSuccess = true;
131cdf0e10cSrcweir     if (nPos != mnStreamPos && mpDatStream)
132cdf0e10cSrcweir     {
133cdf0e10cSrcweir         if (mpDatStream->Seek( nPos ) != nPos)
134cdf0e10cSrcweir             bSuccess = false;
135cdf0e10cSrcweir         else
136cdf0e10cSrcweir             mnStreamPos = nPos;
137cdf0e10cSrcweir     }
138cdf0e10cSrcweir     return bSuccess;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir #endif
142cdf0e10cSrcweir 
143