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 : #include "HtmlReader.hxx"
21 : #include <connectivity/dbconversion.hxx>
22 : #include <connectivity/dbtools.hxx>
23 : #include <toolkit/helper/vclunohelper.hxx>
24 : #include <tools/tenccvt.hxx>
25 : #include <comphelper/extract.hxx>
26 : #include <comphelper/string.hxx>
27 : #include "dbu_misc.hrc"
28 : #include "dbustrings.hrc"
29 : #include <sfx2/sfxhtml.hxx>
30 : #include <osl/diagnose.h>
31 : #include "moduledbu.hxx"
32 : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
33 : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
34 : #include <com/sun/star/sdbcx/XAppend.hpp>
35 : #include <com/sun/star/sdbc/DataType.hpp>
36 : #include <com/sun/star/sdbc/ColumnValue.hpp>
37 : #include <com/sun/star/awt/FontDescriptor.hpp>
38 : #include <com/sun/star/awt/FontWeight.hpp>
39 : #include <com/sun/star/awt/FontStrikeout.hpp>
40 : #include <com/sun/star/awt/FontSlant.hpp>
41 : #include <com/sun/star/awt/FontUnderline.hpp>
42 : #include <com/sun/star/util/NumberFormat.hpp>
43 : #include <com/sun/star/util/XNumberFormatTypes.hpp>
44 : #include <svtools/htmltokn.h>
45 : #include <svtools/htmlkywd.hxx>
46 : #include <tools/color.hxx>
47 : #include "WCopyTable.hxx"
48 : #include "WExtendPages.hxx"
49 : #include "WNameMatch.hxx"
50 : #include "WColumnSelect.hxx"
51 : #include "QEnumTypes.hxx"
52 : #include "WCPage.hxx"
53 : #include <tools/inetmime.hxx>
54 : #include <svl/inettype.hxx>
55 : #include <rtl/tencinfo.h>
56 : #include "UITools.hxx"
57 : #include <vcl/svapp.hxx>
58 :
59 : using namespace dbaui;
60 : using namespace ::com::sun::star::uno;
61 : using namespace ::com::sun::star::beans;
62 : using namespace ::com::sun::star::container;
63 : using namespace ::com::sun::star::sdbc;
64 : using namespace ::com::sun::star::sdbcx;
65 : using namespace ::com::sun::star::awt;
66 :
67 : #define DBAUI_HTML_FONTSIZES 8 // like export, HTML-Options
68 :
69 : // ==========================================================================
70 : DBG_NAME(OHTMLReader)
71 : // ==========================================================================
72 : // OHTMLReader
73 : // ==========================================================================
74 0 : OHTMLReader::OHTMLReader(SvStream& rIn,const SharedConnection& _rxConnection,
75 : const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
76 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
77 : const TColumnVector* pList,
78 : const OTypeInfoMap* _pInfoMap)
79 : :HTMLParser(rIn)
80 : ,ODatabaseExport( _rxConnection, _rxNumberF, _rxContext, pList, _pInfoMap, rIn )
81 : ,m_nTableCount(0)
82 : ,m_nColumnWidth(87)
83 : ,m_bMetaOptions(sal_False)
84 0 : ,m_bSDNum(sal_False)
85 : {
86 : SAL_INFO("dbaccess.ui", "OHTMLReader::OHTMLReader" );
87 : DBG_CTOR(OHTMLReader,NULL);
88 0 : SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
89 : // If the file starts with a BOM, switch to UCS2.
90 0 : SetSwitchToUCS2( sal_True );
91 0 : }
92 : // ---------------------------------------------------------------------------
93 0 : OHTMLReader::OHTMLReader(SvStream& rIn,
94 : sal_Int32 nRows,
95 : const TPositions &_rColumnPositions,
96 : const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
97 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
98 : const TColumnVector* pList,
99 : const OTypeInfoMap* _pInfoMap,
100 : sal_Bool _bAutoIncrementEnabled)
101 : :HTMLParser(rIn)
102 : ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
103 : ,m_nTableCount(0)
104 : ,m_nColumnWidth(87)
105 : ,m_bMetaOptions(sal_False)
106 0 : ,m_bSDNum(sal_False)
107 : {
108 : SAL_INFO("dbaccess.ui", "OHTMLReader::OHTMLReader" );
109 : DBG_CTOR(OHTMLReader,NULL);
110 0 : SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
111 : // If the file starts with a BOM, switch to UCS2.
112 0 : SetSwitchToUCS2( sal_True );
113 0 : }
114 : // ---------------------------------------------------------------------------
115 0 : OHTMLReader::~OHTMLReader()
116 : {
117 : DBG_DTOR(OHTMLReader,NULL);
118 0 : }
119 : // ---------------------------------------------------------------------------
120 0 : SvParserState OHTMLReader::CallParser()
121 : {
122 : SAL_INFO("dbaccess.ui", "OHTMLReader::CallParser" );
123 : DBG_CHKTHIS(OHTMLReader,NULL);
124 0 : rInput.Seek(STREAM_SEEK_TO_BEGIN);
125 0 : rInput.ResetError();
126 0 : SvParserState eParseState = HTMLParser::CallParser();
127 0 : SetColumnTypes(m_pColumnList,m_pInfoMap);
128 0 : return m_bFoundTable ? eParseState : SVPAR_ERROR;
129 : }
130 : // -----------------------------------------------------------------------------
131 0 : void OHTMLReader::NextToken( int nToken )
132 : {
133 : SAL_INFO("dbaccess.ui", "OHTMLReader::NextToken" );
134 : DBG_CHKTHIS(OHTMLReader,NULL);
135 0 : if(m_bError || !m_nRows) // if there is an error or no more rows to check, return immediatelly
136 0 : return;
137 0 : if ( nToken == HTML_META )
138 0 : setTextEncoding();
139 :
140 0 : if(m_xConnection.is()) // names, which CTOR was called and hence, if a table should be created
141 : {
142 0 : switch(nToken)
143 : {
144 : case HTML_TABLE_ON:
145 0 : ++m_nTableCount;
146 : { // can also be TD or TH, if there was no TABLE before
147 0 : const HTMLOptions& rHtmlOptions = GetOptions();
148 0 : for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i)
149 : {
150 0 : const HTMLOption& rOption = rHtmlOptions[i];
151 0 : switch( rOption.GetToken() )
152 : {
153 : case HTML_O_WIDTH:
154 : { // percentage: of document width respectively outer cell
155 0 : m_nColumnWidth = GetWidthPixel( rOption );
156 : }
157 0 : break;
158 : }
159 : }
160 : }
161 : case HTML_THEAD_ON:
162 : case HTML_TBODY_ON:
163 : {
164 0 : sal_uInt32 nTell = rInput.Tell(); // perhaps alters position of the stream
165 0 : if ( !m_xTable.is() )
166 : {// use first line as header
167 0 : m_bError = !CreateTable(nToken);
168 0 : if ( m_bAppendFirstLine )
169 0 : rInput.Seek(nTell);
170 : }
171 : }
172 0 : break;
173 : case HTML_TABLE_OFF:
174 0 : if(!--m_nTableCount)
175 : {
176 0 : m_xTable = NULL;
177 : }
178 0 : break;
179 : case HTML_TABLEROW_ON:
180 0 : if ( m_pUpdateHelper.get() )
181 : {
182 : try
183 : {
184 0 : m_pUpdateHelper->moveToInsertRow(); // otherwise append new line
185 : }
186 0 : catch(SQLException& e)
187 : // handling update failure
188 : {
189 0 : showErrorDialog(e);
190 : }
191 : }
192 : else
193 0 : m_bError = sal_True;
194 0 : break;
195 : case HTML_TEXTTOKEN:
196 : case HTML_SINGLECHAR:
197 0 : if ( m_bInTbl ) //&& !m_bSDNum ) // important, as otherwise we also get the names of the fonts
198 0 : m_sTextToken += aToken;
199 0 : break;
200 : case HTML_PARABREAK_OFF:
201 0 : m_sCurrent += m_sTextToken;
202 0 : break;
203 : case HTML_PARABREAK_ON:
204 0 : m_sTextToken.Erase();
205 0 : break;
206 : case HTML_TABLEDATA_ON:
207 0 : fetchOptions();
208 0 : break;
209 : case HTML_TABLEDATA_OFF:
210 : {
211 0 : if ( m_sCurrent.Len() )
212 0 : m_sTextToken = m_sCurrent;
213 : try
214 : {
215 0 : insertValueIntoColumn();
216 : }
217 0 : catch(SQLException& e)
218 : // handling update failure
219 : {
220 0 : showErrorDialog(e);
221 : }
222 0 : m_sCurrent.Erase();
223 0 : m_nColumnPos++;
224 0 : eraseTokens();
225 0 : m_bSDNum = m_bInTbl = sal_False;
226 : }
227 0 : break;
228 : case HTML_TABLEROW_OFF:
229 0 : if ( !m_pUpdateHelper.get() )
230 : {
231 0 : m_bError = sal_True;
232 0 : break;
233 : }
234 : try
235 : {
236 0 : m_nRowCount++;
237 0 : if (m_bIsAutoIncrement) // if bSetAutoIncrement then I have to set the autoincrement
238 0 : m_pUpdateHelper->updateInt(1,m_nRowCount);
239 0 : m_pUpdateHelper->insertRow();
240 : }
241 0 : catch(SQLException& e)
242 : //////////////////////////////////////////////////////////////////////
243 : // handling update failure
244 : {
245 0 : showErrorDialog(e);
246 : }
247 0 : m_nColumnPos = 0;
248 0 : break;
249 : }
250 : }
251 : else // branch only valid for type checking
252 : {
253 0 : switch(nToken)
254 : {
255 : case HTML_THEAD_ON:
256 : case HTML_TBODY_ON:
257 : // The head of the column is not included
258 0 : if(m_bHead)
259 : {
260 0 : do
261 : {}
262 0 : while(GetNextToken() != HTML_TABLEROW_OFF);
263 0 : m_bHead = sal_False;
264 : }
265 0 : break;
266 : case HTML_TABLEDATA_ON:
267 : case HTML_TABLEHEADER_ON:
268 0 : fetchOptions();
269 0 : break;
270 : case HTML_TEXTTOKEN:
271 : case HTML_SINGLECHAR:
272 0 : if ( m_bInTbl ) // && !m_bSDNum ) // important, as otherwise we also get the names of the fonts
273 0 : m_sTextToken += aToken;
274 0 : break;
275 : case HTML_PARABREAK_OFF:
276 0 : m_sCurrent += m_sTextToken;
277 0 : break;
278 : case HTML_PARABREAK_ON:
279 0 : m_sTextToken.Erase();
280 0 : break;
281 : case HTML_TABLEDATA_OFF:
282 0 : if ( m_sCurrent.Len() )
283 0 : m_sTextToken = m_sCurrent;
284 0 : adjustFormat();
285 0 : m_nColumnPos++;
286 0 : m_bSDNum = m_bInTbl = sal_False;
287 0 : m_sCurrent.Erase();
288 0 : break;
289 : case HTML_TABLEROW_OFF:
290 0 : if ( m_sCurrent.Len() )
291 0 : m_sTextToken = m_sCurrent;
292 0 : adjustFormat();
293 0 : m_nColumnPos = 0;
294 0 : m_nRows--;
295 0 : m_sCurrent.Erase();
296 0 : break;
297 : }
298 : }
299 : }
300 : // -----------------------------------------------------------------------------
301 0 : void OHTMLReader::fetchOptions()
302 : {
303 : SAL_INFO("dbaccess.ui", "OHTMLReader::fetchOptions" );
304 0 : m_bInTbl = sal_True;
305 0 : const HTMLOptions& options = GetOptions();
306 0 : for (size_t i = 0, n = options.size(); i < n; ++i)
307 : {
308 0 : const HTMLOption& rOption = options[i];
309 0 : switch( rOption.GetToken() )
310 : {
311 : case HTML_O_SDVAL:
312 : {
313 0 : m_sValToken = rOption.GetString();
314 0 : m_bSDNum = sal_True;
315 : }
316 0 : break;
317 : case HTML_O_SDNUM:
318 0 : m_sNumToken = rOption.GetString();
319 0 : break;
320 : }
321 : }
322 0 : }
323 : //---------------------------------------------------------------------------------
324 0 : void OHTMLReader::TableDataOn(SvxCellHorJustify& eVal)
325 : {
326 : SAL_INFO("dbaccess.ui", "OHTMLReader::TableDataOn" );
327 : DBG_CHKTHIS(OHTMLReader,NULL);
328 0 : const HTMLOptions& rHtmlOptions = GetOptions();
329 0 : for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i)
330 : {
331 0 : const HTMLOption& rOption = rHtmlOptions[i];
332 0 : switch( rOption.GetToken() )
333 : {
334 : case HTML_O_ALIGN:
335 : {
336 0 : const String& rOptVal = rOption.GetString();
337 0 : if (rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_right ))
338 0 : eVal = SVX_HOR_JUSTIFY_RIGHT;
339 0 : else if (rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_center ))
340 0 : eVal = SVX_HOR_JUSTIFY_CENTER;
341 0 : else if (rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_left ))
342 0 : eVal = SVX_HOR_JUSTIFY_LEFT;
343 : else
344 0 : eVal = SVX_HOR_JUSTIFY_STANDARD;
345 : }
346 0 : break;
347 : case HTML_O_WIDTH:
348 0 : m_nWidth = GetWidthPixel( rOption );
349 0 : break;
350 : }
351 : }
352 0 : }
353 :
354 : //---------------------------------------------------------------------------------
355 0 : void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor)
356 : {
357 : SAL_INFO("dbaccess.ui", "OHTMLReader::TableFontOn" );
358 : DBG_CHKTHIS(OHTMLReader,NULL);
359 0 : const HTMLOptions& rHtmlOptions = GetOptions();
360 0 : for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i)
361 : {
362 0 : const HTMLOption& rOption = rHtmlOptions[i];
363 0 : switch( rOption.GetToken() )
364 : {
365 : case HTML_O_COLOR:
366 : {
367 0 : Color aColor;
368 0 : rOption.GetColor( aColor );
369 0 : _rTextColor = aColor.GetRGBColor();
370 : }
371 0 : break;
372 : case HTML_O_FACE :
373 : {
374 0 : const String& rFace = rOption.GetString();
375 0 : String aFontName;
376 0 : sal_Int32 nPos = 0;
377 0 : while( nPos != -1 )
378 : {
379 : // list fo fonts, VCL: semicolon as separator, HTML: comma
380 0 : String aFName = rFace.GetToken( 0, ',', nPos );
381 0 : aFName = comphelper::string::strip(aFName, ' ');
382 0 : if( aFontName.Len() )
383 0 : aFontName += ';';
384 0 : aFontName += aFName;
385 0 : }
386 0 : if ( aFontName.Len() )
387 0 : _rFont.Name = OUString(aFontName);
388 : }
389 0 : break;
390 : case HTML_O_SIZE :
391 : {
392 0 : sal_Int16 nSize = (sal_Int16) rOption.GetNumber();
393 0 : if ( nSize == 0 )
394 0 : nSize = 1;
395 0 : else if ( nSize < DBAUI_HTML_FONTSIZES )
396 0 : nSize = DBAUI_HTML_FONTSIZES;
397 :
398 0 : _rFont.Height = nSize;
399 : }
400 0 : break;
401 : }
402 : }
403 0 : }
404 : // ---------------------------------------------------------------------------
405 0 : sal_Int16 OHTMLReader::GetWidthPixel( const HTMLOption& rOption )
406 : {
407 : SAL_INFO("dbaccess.ui", "OHTMLReader::GetWidthPixel" );
408 : DBG_CHKTHIS(OHTMLReader,NULL);
409 0 : const String& rOptVal = rOption.GetString();
410 0 : if ( rOptVal.Search('%') != STRING_NOTFOUND )
411 : { // percentage
412 : OSL_ENSURE( m_nColumnWidth, "WIDTH Option: m_nColumnWidth==0 und Width%" );
413 0 : return (sal_Int16)((rOption.GetNumber() * m_nColumnWidth) / 100);
414 : }
415 : else
416 : {
417 0 : if ( rOptVal.Search('*') != STRING_NOTFOUND )
418 : { // relativ to what?!?
419 : //TODO: collect ColArray of all relevant values and then MakeCol
420 0 : return 0;
421 : }
422 : else
423 0 : return (sal_Int16)rOption.GetNumber(); // pixel
424 : }
425 : }
426 : // ---------------------------------------------------------------------------
427 0 : sal_Bool OHTMLReader::CreateTable(int nToken)
428 : {
429 : SAL_INFO("dbaccess.ui", "OHTMLReader::CreateTable" );
430 : DBG_CHKTHIS(OHTMLReader,NULL);
431 0 : String aTempName(ModuleRes(STR_TBL_TITLE));
432 0 : aTempName = aTempName.GetToken(0,' ');
433 0 : aTempName = String(::dbtools::createUniqueName(m_xTables,OUString(aTempName )));
434 :
435 0 : int nTmpToken2 = nToken;
436 0 : sal_Bool bCaption = sal_False;
437 0 : sal_Bool bTableHeader = sal_False;
438 0 : String aColumnName;
439 : SvxCellHorJustify eVal;
440 :
441 0 : String aTableName;
442 0 : FontDescriptor aFont = VCLUnoHelper::CreateFontDescriptor(Application::GetSettings().GetStyleSettings().GetAppFont());
443 0 : sal_Int32 nTextColor = 0;
444 0 : do
445 : {
446 0 : switch(nTmpToken2)
447 : {
448 : case HTML_TEXTTOKEN:
449 : case HTML_SINGLECHAR:
450 0 : if(bTableHeader)
451 0 : aColumnName += aToken;
452 0 : if(bCaption)
453 0 : aTableName += aToken;
454 0 : break;
455 : case HTML_PARABREAK_OFF:
456 0 : m_sCurrent += aColumnName;
457 0 : break;
458 : case HTML_PARABREAK_ON:
459 0 : m_sTextToken.Erase();
460 0 : break;
461 : case HTML_TABLEDATA_ON:
462 : case HTML_TABLEHEADER_ON:
463 0 : TableDataOn(eVal);
464 0 : bTableHeader = sal_True;
465 0 : break;
466 : case HTML_TABLEDATA_OFF:
467 : case HTML_TABLEHEADER_OFF:
468 : {
469 0 : aColumnName = comphelper::string::strip(aColumnName, ' ' );
470 0 : if (!aColumnName.Len() || m_bAppendFirstLine )
471 0 : aColumnName = String(ModuleRes(STR_COLUMN_NAME));
472 0 : else if ( m_sCurrent.Len() )
473 0 : aColumnName = m_sCurrent;
474 :
475 0 : aColumnName = comphelper::string::strip(aColumnName, ' ');
476 0 : CreateDefaultColumn(aColumnName);
477 0 : aColumnName.Erase();
478 0 : m_sCurrent.Erase();
479 :
480 0 : eVal = SVX_HOR_JUSTIFY_STANDARD;
481 0 : bTableHeader = sal_False;
482 : }
483 0 : break;
484 :
485 : case HTML_TITLE_ON:
486 : case HTML_CAPTION_ON:
487 0 : bCaption = sal_True;
488 0 : break;
489 : case HTML_TITLE_OFF:
490 : case HTML_CAPTION_OFF:
491 0 : aTableName = comphelper::string::strip(aTableName, ' ');
492 0 : if(!aTableName.Len())
493 0 : aTableName = String(::dbtools::createUniqueName(m_xTables,OUString(aTableName)));
494 : else
495 0 : aTableName = aTempName;
496 0 : bCaption = sal_False;
497 0 : break;
498 : case HTML_FONT_ON:
499 0 : TableFontOn(aFont,nTextColor);
500 0 : break;
501 : case HTML_BOLD_ON:
502 0 : aFont.Weight = ::com::sun::star::awt::FontWeight::BOLD;
503 0 : break;
504 : case HTML_ITALIC_ON:
505 0 : aFont.Slant = ::com::sun::star::awt::FontSlant_ITALIC;
506 0 : break;
507 : case HTML_UNDERLINE_ON:
508 0 : aFont.Underline = ::com::sun::star::awt::FontUnderline::SINGLE;
509 0 : break;
510 : case HTML_STRIKE_ON:
511 0 : aFont.Strikeout = ::com::sun::star::awt::FontStrikeout::SINGLE;
512 0 : break;
513 : }
514 : }
515 0 : while((nTmpToken2 = GetNextToken()) != HTML_TABLEROW_OFF);
516 :
517 0 : if ( m_sCurrent.Len() )
518 0 : aColumnName = m_sCurrent;
519 0 : aColumnName = comphelper::string::strip(aColumnName, ' ');
520 0 : if(aColumnName.Len())
521 0 : CreateDefaultColumn(aColumnName);
522 :
523 0 : if ( m_vDestVector.empty() )
524 0 : return sal_False;
525 :
526 0 : if(!aTableName.Len())
527 0 : aTableName = aTempName;
528 :
529 0 : m_bInTbl = sal_False;
530 0 : m_bFoundTable = sal_True;
531 :
532 0 : if ( isCheckEnabled() )
533 0 : return sal_True;
534 :
535 0 : return !executeWizard(aTableName,makeAny(nTextColor),aFont) && m_xTable.is();
536 : }
537 : // -----------------------------------------------------------------------------
538 0 : void OHTMLReader::setTextEncoding()
539 : {
540 : SAL_INFO("dbaccess.ui", "OHTMLReader::setTextEncoding" );
541 : DBG_CHKTHIS(OHTMLReader,NULL);
542 0 : m_bMetaOptions = sal_True;
543 0 : ParseMetaOptions(NULL, NULL);
544 0 : }
545 :
546 : // -----------------------------------------------------------------------------
547 0 : void OHTMLReader::release()
548 : {
549 : SAL_INFO("dbaccess.ui", "OHTMLReader::release" );
550 : DBG_CHKTHIS(OHTMLReader,NULL);
551 0 : ReleaseRef();
552 0 : }
553 : // -----------------------------------------------------------------------------
554 0 : TypeSelectionPageFactory OHTMLReader::getTypeSelectionPageFactory()
555 : {
556 : SAL_INFO("dbaccess.ui", "OHTMLReader::getTypeSelectionPageFactory" );
557 : DBG_CHKTHIS(OHTMLReader,NULL);
558 0 : return &OWizHTMLExtend::Create;
559 12 : }
560 : // -----------------------------------------------------------------------------
561 :
562 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|