2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:03:59 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 14:27:01 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svtools.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <tools/stream.hxx>
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#include <tools/color.hxx>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#include <rtl/strbuf.hxx>
|
|
|
|
#ifndef _SVSTDARR_HXX
|
|
|
|
#define _SVSTDARR_ULONGS
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/svstdarr.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
#include <tools/tenccvt.hxx>
|
|
|
|
#include <tools/datetime.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/inettype.hxx>
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
#include <comphelper/string.hxx>
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#include <com/sun/star/document/XDocumentProperties.hpp>
|
|
|
|
|
2007-06-27 21:00:53 +00:00
|
|
|
#include <svtools/parhtml.hxx>
|
2010-04-16 23:00:12 +02:00
|
|
|
#include <svtools/htmltokn.h>
|
|
|
|
#include <svtools/htmlkywd.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
2007-07-10 14:19:47 +00:00
|
|
|
const sal_Int32 MAX_LEN( 1024L );
|
|
|
|
const sal_Int32 MAX_MACRO_LEN( 1024 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-07-10 14:19:47 +00:00
|
|
|
const sal_Int32 MAX_ENTITY_LEN( 8L );
|
2001-10-31 07:30:08 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Tables to convert option values into strings
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// <INPUT TYPE=xxx>
|
2010-12-12 10:14:17 +01:00
|
|
|
static HTMLOptionEnum const aInputTypeOptEnums[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-04-27 11:24:10 +00:00
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_text, HTML_IT_TEXT },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_password, HTML_IT_PASSWORD },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_checkbox, HTML_IT_CHECKBOX },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_radio, HTML_IT_RADIO },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_range, HTML_IT_RANGE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_scribble, HTML_IT_SCRIBBLE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_file, HTML_IT_FILE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_hidden, HTML_IT_HIDDEN },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_submit, HTML_IT_SUBMIT },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_image, HTML_IT_IMAGE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_reset, HTML_IT_RESET },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_IT_button, HTML_IT_BUTTON },
|
2000-09-18 16:07:07 +00:00
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
// <TABLE FRAME=xxx>
|
2010-12-12 10:14:17 +01:00
|
|
|
static HTMLOptionEnum const aTableFrameOptEnums[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-04-27 11:24:10 +00:00
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_void, HTML_TF_VOID },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_above, HTML_TF_ABOVE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_below, HTML_TF_BELOW },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_hsides, HTML_TF_HSIDES },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_lhs, HTML_TF_LHS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_rhs, HTML_TF_RHS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_vsides, HTML_TF_VSIDES },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_box, HTML_TF_BOX },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TF_border, HTML_TF_BOX },
|
2000-09-18 16:07:07 +00:00
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
// <TABLE RULES=xxx>
|
2010-12-12 10:14:17 +01:00
|
|
|
static HTMLOptionEnum const aTableRulesOptEnums[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-04-27 11:24:10 +00:00
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TR_none, HTML_TR_NONE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TR_groups, HTML_TR_GROUPS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TR_rows, HTML_TR_ROWS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TR_cols, HTML_TR_COLS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_TR_all, HTML_TR_ALL },
|
2000-09-18 16:07:07 +00:00
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SV_IMPL_PTRARR(HTMLOptions,HTMLOptionPtr)
|
|
|
|
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDflt ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nValue = nDflt;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
while( pOptEnums->pName )
|
|
|
|
if( aValue.EqualsIgnoreCaseAscii( pOptEnums->pName ) )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
pOptEnums++;
|
|
|
|
|
|
|
|
if( pOptEnums->pName )
|
|
|
|
nValue = pOptEnums->nValue;
|
|
|
|
|
|
|
|
return nValue;
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool HTMLOption::GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
while( pOptEnums->pName )
|
|
|
|
{
|
|
|
|
if( aValue.EqualsIgnoreCaseAscii( pOptEnums->pName ) )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
pOptEnums++;
|
|
|
|
}
|
|
|
|
|
|
|
|
const sal_Char *pName = pOptEnums->pName;
|
|
|
|
if( pName )
|
|
|
|
rEnum = pOptEnums->nValue;
|
|
|
|
|
|
|
|
return (pName != 0);
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
HTMLOption::HTMLOption( sal_uInt16 nTok, const String& rToken,
|
2000-09-18 16:07:07 +00:00
|
|
|
const String& rValue )
|
2004-06-16 09:30:12 +00:00
|
|
|
: aValue(rValue)
|
|
|
|
, aToken(rToken)
|
|
|
|
, nToken( nTok )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT( nToken>=HTML_OPTION_START && nToken<HTML_OPTION_END,
|
2011-04-22 22:13:32 +02:00
|
|
|
"HTMLOption: unknown token" );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-03-16 12:06:54 +00:00
|
|
|
sal_uInt32 HTMLOption::GetNumber() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START &&
|
|
|
|
nToken<HTML_OPTION_NUMBER_END) ||
|
|
|
|
(nToken>=HTML_OPTION_CONTEXT_START &&
|
|
|
|
nToken<HTML_OPTION_CONTEXT_END) ||
|
|
|
|
nToken==HTML_O_VALUE,
|
2011-04-22 22:13:32 +02:00
|
|
|
"GetNumber: Option not numerical" );
|
2000-09-18 16:07:07 +00:00
|
|
|
String aTmp( aValue );
|
|
|
|
aTmp.EraseLeadingChars();
|
|
|
|
sal_Int32 nTmp = aTmp.ToInt32();
|
2006-10-12 14:28:10 +00:00
|
|
|
return nTmp >= 0 ? (sal_uInt32)nTmp : 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Int32 HTMLOption::GetSNumber() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START && nToken<HTML_OPTION_NUMBER_END) ||
|
|
|
|
(nToken>=HTML_OPTION_CONTEXT_START && nToken<HTML_OPTION_CONTEXT_END),
|
2011-04-22 22:13:32 +02:00
|
|
|
"GetSNumber: Option not numerical" );
|
2000-09-18 16:07:07 +00:00
|
|
|
String aTmp( aValue );
|
|
|
|
aTmp.EraseLeadingChars();
|
|
|
|
return aTmp.ToInt32();
|
|
|
|
}
|
|
|
|
|
2010-10-04 15:44:00 +01:00
|
|
|
void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( rLongs.Count() )
|
|
|
|
rLongs.Remove( 0, rLongs.Count() );
|
|
|
|
|
|
|
|
if( bSpaceDelim )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// This is a very simplified scanner: it only searches all
|
|
|
|
// numerals in the string.
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bInNum = sal_False;
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nNum = 0;
|
2006-10-12 14:28:10 +00:00
|
|
|
for( xub_StrLen i=0; i<aValue.Len(); i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
register sal_Unicode c = aValue.GetChar( i );
|
|
|
|
if( c>='0' && c<='9' )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
nNum *= 10;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNum += (c - '0');
|
2010-11-05 10:31:15 +08:00
|
|
|
bInNum = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if( bInNum )
|
|
|
|
{
|
|
|
|
rLongs.Insert( nNum, rLongs.Count() );
|
2010-11-05 10:31:15 +08:00
|
|
|
bInNum = sal_False;
|
2006-10-12 14:28:10 +00:00
|
|
|
nNum = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if( bInNum )
|
|
|
|
{
|
|
|
|
rLongs.Insert( nNum, rLongs.Count() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Check whether numbers are separated by ',' and
|
|
|
|
// insert 0 if necessary
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nPos < aValue.Len() )
|
|
|
|
{
|
|
|
|
register sal_Unicode c;
|
|
|
|
while( nPos < aValue.Len() &&
|
|
|
|
((c=aValue.GetChar(nPos)) == ' ' || c == '\t' ||
|
|
|
|
c == '\n' || c== '\r' ) )
|
|
|
|
nPos++;
|
|
|
|
|
|
|
|
if( nPos==aValue.Len() )
|
2011-01-12 15:56:50 +01:00
|
|
|
rLongs.Insert( sal_uLong(0), rLongs.Count() );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nEnd = aValue.Search( (sal_Unicode)',', nPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( STRING_NOTFOUND==nEnd )
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp = aValue.Copy(nPos).ToInt32();
|
2006-10-12 14:28:10 +00:00
|
|
|
rLongs.Insert( nTmp >= 0 ? (sal_uInt32)nTmp : 0,
|
2000-09-18 16:07:07 +00:00
|
|
|
rLongs.Count() );
|
|
|
|
nPos = aValue.Len();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp =
|
|
|
|
aValue.Copy(nPos,nEnd-nPos).ToInt32();
|
2006-10-12 14:28:10 +00:00
|
|
|
rLongs.Insert( nTmp >= 0 ? (sal_uInt32)nTmp : 0,
|
2000-09-18 16:07:07 +00:00
|
|
|
rLongs.Count() );
|
2006-10-12 14:28:10 +00:00
|
|
|
nPos = nEnd+1;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTMLOption::GetColor( Color& rColor ) const
|
|
|
|
{
|
|
|
|
DBG_ASSERT( (nToken>=HTML_OPTION_COLOR_START && nToken<HTML_OPTION_COLOR_END) || nToken==HTML_O_SIZE,
|
2011-04-22 22:13:32 +02:00
|
|
|
"GetColor: Option is not a color." );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
String aTmp( aValue );
|
|
|
|
aTmp.ToUpperAscii();
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nColor = ULONG_MAX;
|
2006-10-12 14:28:10 +00:00
|
|
|
if( '#'!=aTmp.GetChar( 0 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nColor = GetHTMLColor( aTmp );
|
|
|
|
|
|
|
|
if( ULONG_MAX == nColor )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
nColor = 0;
|
|
|
|
xub_StrLen nPos = 0;
|
|
|
|
for( sal_uInt32 i=0; i<6; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Whatever Netscape does to get color values,
|
|
|
|
// at maximum three characters < '0' are ignored.
|
2000-09-18 16:07:07 +00:00
|
|
|
register sal_Unicode c = nPos<aTmp.Len() ? aTmp.GetChar( nPos++ )
|
|
|
|
: '0';
|
|
|
|
if( c < '0' )
|
|
|
|
{
|
|
|
|
c = nPos<aTmp.Len() ? aTmp.GetChar(nPos++) : '0';
|
|
|
|
if( c < '0' )
|
|
|
|
c = nPos<aTmp.Len() ? aTmp.GetChar(nPos++) : '0';
|
|
|
|
}
|
2006-10-12 14:28:10 +00:00
|
|
|
nColor *= 16;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( c >= '0' && c <= '9' )
|
|
|
|
nColor += (c - 48);
|
|
|
|
else if( c >= 'A' && c <= 'F' )
|
|
|
|
nColor += (c - 55);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
rColor.SetRed( (sal_uInt8)((nColor & 0x00ff0000) >> 16) );
|
|
|
|
rColor.SetGreen( (sal_uInt8)((nColor & 0x0000ff00) >> 8));
|
|
|
|
rColor.SetBlue( (sal_uInt8)(nColor & 0x000000ff) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputType HTMLOption::GetInputType() const
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
DBG_ASSERT( nToken==HTML_O_TYPE, "GetInputType: Option not TYPE" );
|
2000-09-18 16:07:07 +00:00
|
|
|
return (HTMLInputType)GetEnum( aInputTypeOptEnums, HTML_IT_TEXT );
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLTableFrame HTMLOption::GetTableFrame() const
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
DBG_ASSERT( nToken==HTML_O_FRAME, "GetTableFrame: Option not FRAME" );
|
2000-09-18 16:07:07 +00:00
|
|
|
return (HTMLTableFrame)GetEnum( aTableFrameOptEnums, HTML_TF_VOID );
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLTableRules HTMLOption::GetTableRules() const
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
DBG_ASSERT( nToken==HTML_O_RULES, "GetTableRules: Option not RULES" );
|
2000-09-18 16:07:07 +00:00
|
|
|
return (HTMLTableRules)GetEnum( aTableRulesOptEnums, HTML_TR_NONE );
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLParser::HTMLParser( SvStream& rIn, int bReadNewDoc )
|
|
|
|
: SvParser( rIn )
|
|
|
|
{
|
|
|
|
bNewDoc = bReadNewDoc;
|
|
|
|
bReadListing = bReadXMP = bReadPRE = bReadTextArea =
|
|
|
|
bReadScript = bReadStyle =
|
|
|
|
bEndTokenFound = bIsInBody = bReadNextChar =
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadComment = sal_False;
|
|
|
|
bIsInHeader = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
pOptions = new HTMLOptions;
|
2010-10-01 10:00:52 +01:00
|
|
|
|
|
|
|
//#i76649, default to UTF-8 for HTML unless we know differently
|
|
|
|
SetSrcEncoding(RTL_TEXTENCODING_UTF8);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HTMLParser::~HTMLParser()
|
|
|
|
{
|
|
|
|
if( pOptions && pOptions->Count() )
|
|
|
|
pOptions->DeleteAndDestroy( 0, pOptions->Count() );
|
|
|
|
delete pOptions;
|
|
|
|
}
|
|
|
|
|
2010-12-11 17:58:44 +01:00
|
|
|
SvParserState HTMLParser::CallParser()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
eState = SVPAR_WORKING;
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
SaveState( 0 );
|
|
|
|
|
2006-10-12 14:28:10 +00:00
|
|
|
nPre_LinePos = 0;
|
2010-11-05 10:31:15 +08:00
|
|
|
bPre_IgnoreNewPara = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
AddRef();
|
|
|
|
Continue( 0 );
|
|
|
|
if( SVPAR_PENDING != eState )
|
2011-04-22 22:13:32 +02:00
|
|
|
ReleaseRef(); // Parser not needed anymore
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return eState;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTMLParser::Continue( int nToken )
|
|
|
|
{
|
|
|
|
if( !nToken )
|
|
|
|
nToken = GetNextToken();
|
|
|
|
|
|
|
|
while( IsParserWorking() )
|
|
|
|
{
|
|
|
|
SaveState( nToken );
|
|
|
|
nToken = FilterToken( nToken );
|
|
|
|
|
|
|
|
if( nToken )
|
|
|
|
NextToken( nToken );
|
|
|
|
|
|
|
|
if( IsParserWorking() )
|
2011-04-22 22:13:32 +02:00
|
|
|
SaveState( 0 ); // continue with new token
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
nToken = GetNextToken();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int HTMLParser::FilterToken( int nToken )
|
|
|
|
{
|
|
|
|
switch( nToken )
|
|
|
|
{
|
|
|
|
case sal_Unicode(EOF):
|
|
|
|
nToken = 0;
|
2011-04-23 22:25:26 +02:00
|
|
|
break; // don't pass
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
case HTML_HEAD_OFF:
|
2010-11-05 10:31:15 +08:00
|
|
|
bIsInBody = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
case HTML_HEAD_ON:
|
|
|
|
bIsInHeader = HTML_HEAD_ON == nToken;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_BODY_ON:
|
|
|
|
case HTML_FRAMESET_ON:
|
2010-11-05 10:31:15 +08:00
|
|
|
bIsInHeader = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
bIsInBody = HTML_BODY_ON == nToken;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_BODY_OFF:
|
2010-11-05 10:31:15 +08:00
|
|
|
bIsInBody = bReadPRE = bReadListing = bReadXMP = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_HTML_OFF:
|
|
|
|
nToken = 0;
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadPRE = bReadListing = bReadXMP = sal_False;
|
2011-04-23 22:25:26 +02:00
|
|
|
break; // HTML_ON hasn't been passed either !
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
case HTML_PREFORMTXT_ON:
|
|
|
|
StartPRE();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_PREFORMTXT_OFF:
|
|
|
|
FinishPRE();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_LISTING_ON:
|
|
|
|
StartListing();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_LISTING_OFF:
|
|
|
|
FinishListing();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_XMP_ON:
|
|
|
|
StartXMP();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_XMP_OFF:
|
|
|
|
FinishXMP();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if( bReadPRE )
|
|
|
|
nToken = FilterPRE( nToken );
|
|
|
|
else if( bReadListing )
|
|
|
|
nToken = FilterListing( nToken );
|
|
|
|
else if( bReadXMP )
|
|
|
|
nToken = FilterXMP( nToken );
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define HTML_ISDIGIT( c ) (c >= '0' && c <= '9')
|
|
|
|
#define HTML_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
|
|
|
|
#define HTML_ISALNUM( c ) ( HTML_ISALPHA(c) || HTML_ISDIGIT(c) )
|
|
|
|
#define HTML_ISSPACE( c ) ( ' ' == c || (c >= 0x09 && c <= 0x0d) )
|
|
|
|
#define HTML_ISPRINTABLE( c ) ( c >= 32 && c != 127)
|
2006-08-03 12:53:35 +00:00
|
|
|
#define HTML_ISHEXDIGIT( c ) ( HTML_ISDIGIT(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
int HTMLParser::ScanText( const sal_Unicode cBreak )
|
|
|
|
{
|
|
|
|
::rtl::OUStringBuffer sTmpBuffer( MAX_LEN );
|
2011-03-18 21:19:34 +01:00
|
|
|
int bContinue = sal_True;
|
2010-11-05 10:31:15 +08:00
|
|
|
int bEqSignFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Unicode cQuote = 0U;
|
|
|
|
|
2011-03-18 21:19:34 +01:00
|
|
|
while( bContinue && IsParserWorking() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
int bNextCh = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( nNextCh )
|
|
|
|
{
|
|
|
|
case '&':
|
2010-11-05 10:31:15 +08:00
|
|
|
bEqSignFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bReadXMP )
|
|
|
|
sTmpBuffer.append( (sal_Unicode)'&' );
|
|
|
|
else
|
|
|
|
{
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nStreamPos = rInput.Tell();
|
|
|
|
sal_uLong nLinePos = GetLinePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
sal_Unicode cChar = 0U;
|
|
|
|
if( '#' == (nNextCh = GetNextChar()) )
|
|
|
|
{
|
|
|
|
nNextCh = GetNextChar();
|
2006-08-03 12:53:35 +00:00
|
|
|
const sal_Bool bIsHex( 'x' == nNextCh );
|
|
|
|
const sal_Bool bIsDecOrHex( bIsHex || HTML_ISDIGIT(nNextCh) );
|
|
|
|
if ( bIsDecOrHex )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-08-03 12:53:35 +00:00
|
|
|
if ( bIsHex )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nNextCh = GetNextChar();
|
2006-08-03 12:53:35 +00:00
|
|
|
while ( HTML_ISHEXDIGIT(nNextCh) )
|
|
|
|
{
|
|
|
|
cChar = cChar * 16U +
|
|
|
|
( nNextCh <= '9'
|
|
|
|
? sal_Unicode( nNextCh - '0' )
|
|
|
|
: ( nNextCh <= 'F'
|
|
|
|
? sal_Unicode( nNextCh - 'A' + 10 )
|
|
|
|
: sal_Unicode( nNextCh - 'a' + 10 ) ) );
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
cChar = cChar * 10U + sal_Unicode( nNextCh - '0');
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
while( HTML_ISDIGIT(nNextCh) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( RTL_TEXTENCODING_DONTKNOW != eSrcEnc &&
|
|
|
|
RTL_TEXTENCODING_UCS2 != eSrcEnc &&
|
2001-07-03 06:49:47 +00:00
|
|
|
RTL_TEXTENCODING_UTF8 != eSrcEnc &&
|
|
|
|
cChar < 256 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
sal_Unicode cOrig = cChar;
|
|
|
|
cChar = ByteString::ConvertToUnicode(
|
|
|
|
(sal_Char)cChar, eSrcEnc );
|
|
|
|
if( 0U == cChar )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// If the character could not be
|
2000-09-18 16:07:07 +00:00
|
|
|
// converted, because a conversion is not
|
|
|
|
// available, do no conversion at all.
|
|
|
|
cChar = cOrig;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nNextCh = 0U;
|
|
|
|
}
|
|
|
|
else if( HTML_ISALPHA( nNextCh ) )
|
|
|
|
{
|
2001-10-31 07:30:08 +00:00
|
|
|
::rtl::OUStringBuffer sEntityBuffer( MAX_ENTITY_LEN );
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nPos = 0L;
|
2000-09-18 16:07:07 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
sEntityBuffer.append( nNextCh );
|
|
|
|
nPos++;
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
2001-10-31 07:30:08 +00:00
|
|
|
while( nPos < MAX_ENTITY_LEN && HTML_ISALNUM( nNextCh ) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
!rInput.IsEof() );
|
|
|
|
|
|
|
|
if( IsParserWorking() && !rInput.IsEof() )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
String sEntity( sEntityBuffer.getStr(), nPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
cChar = GetHTMLCharName( sEntity );
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// not found ( == 0 ): plain text
|
|
|
|
// or a character which is inserted as attribute
|
2000-09-18 16:07:07 +00:00
|
|
|
if( 0U == cChar && ';' != nNextCh )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( rInput.Tell() - nStreamPos ==
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong)(nPos+1L)*GetCharSize(),
|
2011-04-22 22:13:32 +02:00
|
|
|
"UTF-8 is failing here" );
|
2006-10-12 14:28:10 +00:00
|
|
|
for( xub_StrLen i=nPos-1L; i>1L; i-- )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nNextCh = sEntityBuffer[i];
|
|
|
|
sEntityBuffer.setLength( i );
|
2006-10-12 14:28:10 +00:00
|
|
|
sEntity.Assign( sEntityBuffer.getStr(), i );
|
2000-09-18 16:07:07 +00:00
|
|
|
cChar = GetHTMLCharName( sEntity );
|
|
|
|
if( cChar )
|
|
|
|
{
|
|
|
|
rInput.SeekRel( -(long)
|
|
|
|
((nPos-i)*GetCharSize()) );
|
|
|
|
nlLinePos -= sal_uInt32(nPos-i);
|
|
|
|
nPos = i;
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
if( !cChar ) // unknown character?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// back in stream, insert '&'
|
|
|
|
// and restart with next character
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( (sal_Unicode)'&' );
|
|
|
|
|
|
|
|
DBG_ASSERT( rInput.Tell()-nStreamPos ==
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong)(nPos+1)*GetCharSize(),
|
2011-04-22 22:13:32 +02:00
|
|
|
"Wrong stream position" );
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERT( nlLinePos-nLinePos ==
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong)(nPos+1),
|
2011-04-22 22:13:32 +02:00
|
|
|
"Wrong line position" );
|
2000-09-18 16:07:07 +00:00
|
|
|
rInput.Seek( nStreamPos );
|
|
|
|
nlLinePos = nLinePos;
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 1 == Non Breaking Space
|
|
|
|
// 2 == SoftHyphen
|
|
|
|
|
|
|
|
if( cChar < 3U )
|
|
|
|
{
|
|
|
|
if( '>' == cBreak )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// When reading the content of a tag we have
|
|
|
|
// to change it to ' ' or '-'
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( cChar )
|
|
|
|
{
|
|
|
|
case 1U: cChar = ' '; break;
|
|
|
|
case 2U: cChar = '-'; break;
|
|
|
|
default:
|
|
|
|
DBG_ASSERT( cChar==1U,
|
2011-04-22 22:13:32 +02:00
|
|
|
"\0x00 should be handled already!" );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// If not scanning a tag return token
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken +=
|
|
|
|
String( sTmpBuffer.makeStringAndClear() );
|
|
|
|
if( cChar )
|
|
|
|
{
|
|
|
|
if( aToken.Len() )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// restart with character
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = '&';
|
|
|
|
DBG_ASSERT( rInput.Tell()-nStreamPos ==
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong)(nPos+1)*GetCharSize(),
|
2011-04-22 22:13:32 +02:00
|
|
|
"Wrong stream position" );
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERT( nlLinePos-nLinePos ==
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong)(nPos+1),
|
2011-04-22 22:13:32 +02:00
|
|
|
"Wrong line position" );
|
2000-09-18 16:07:07 +00:00
|
|
|
rInput.Seek( nStreamPos );
|
|
|
|
nlLinePos = nLinePos;
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
return HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Hack: _GetNextChar shall not read the
|
|
|
|
// next character
|
2000-09-18 16:07:07 +00:00
|
|
|
if( ';' != nNextCh )
|
|
|
|
aToken += ' ';
|
|
|
|
if( 1U == cChar )
|
|
|
|
return HTML_NONBREAKSPACE;
|
|
|
|
if( 2U == cChar )
|
|
|
|
return HTML_SOFTHYPH;
|
|
|
|
}
|
|
|
|
aToken += (sal_Unicode)'&';
|
|
|
|
aToken +=
|
|
|
|
String(sEntityBuffer.makeStringAndClear());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nNextCh = 0U;
|
|
|
|
}
|
2011-03-18 21:28:43 +01:00
|
|
|
// &{...};-JavaScript-Macros are not supported any longer.
|
2000-09-18 16:07:07 +00:00
|
|
|
else if( IsParserWorking() )
|
|
|
|
{
|
|
|
|
sTmpBuffer.append( (sal_Unicode)'&' );
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
bNextCh = (';' == nNextCh);
|
|
|
|
if( cBreak=='>' && (cChar=='\\' || cChar=='\'' ||
|
|
|
|
cChar=='\"' || cChar==' ') )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// ' and " have to be escaped withing tags to separate
|
|
|
|
// them from ' and " enclosing options.
|
|
|
|
// \ has to be escaped as well.
|
|
|
|
// Space is protected because it's not a delimiter between
|
|
|
|
// options.
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( (sal_Unicode)'\\' );
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
}
|
|
|
|
if( IsParserWorking() )
|
|
|
|
{
|
|
|
|
if( cChar )
|
|
|
|
sTmpBuffer.append( cChar );
|
|
|
|
}
|
|
|
|
else if( SVPAR_PENDING==eState && '>'!=cBreak )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Restart with '&', the remainder is returned as
|
|
|
|
// text token.
|
2000-09-18 16:07:07 +00:00
|
|
|
if( aToken.Len() || sTmpBuffer.getLength() )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// _GetNextChar() returns the previous text and
|
|
|
|
// during the next execution a new character is read.
|
|
|
|
// Thus we have to position in front of the '&'.
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = 0U;
|
|
|
|
rInput.Seek( nStreamPos-(sal_uInt32)GetCharSize() );
|
2006-10-12 14:28:10 +00:00
|
|
|
nlLinePos = nLinePos-1;
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadNextChar = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '=':
|
|
|
|
if( '>'==cBreak && !cQuote )
|
2010-11-05 10:31:15 +08:00
|
|
|
bEqSignFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\\':
|
|
|
|
if( '>'==cBreak )
|
|
|
|
{
|
|
|
|
// Innerhalb von Tags kennzeichnen
|
|
|
|
sTmpBuffer.append( (sal_Unicode)'\\' );
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
}
|
|
|
|
sTmpBuffer.append( (sal_Unicode)'\\' );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\"':
|
|
|
|
case '\'':
|
|
|
|
if( '>'==cBreak )
|
|
|
|
{
|
|
|
|
if( bEqSignFound )
|
|
|
|
cQuote = nNextCh;
|
|
|
|
else if( cQuote && (cQuote==nNextCh ) )
|
|
|
|
cQuote = 0U;
|
|
|
|
}
|
|
|
|
sTmpBuffer.append( nNextCh );
|
2010-11-05 10:31:15 +08:00
|
|
|
bEqSignFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case sal_Unicode(EOF):
|
|
|
|
if( rInput.IsEof() )
|
|
|
|
{
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '<':
|
2010-11-05 10:31:15 +08:00
|
|
|
bEqSignFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '>'==cBreak )
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
else
|
2011-04-22 22:13:32 +02:00
|
|
|
bContinue = sal_False; // break, String zusammen
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '\f':
|
|
|
|
if( '>' == cBreak )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// If scanning options treat it like a space, ...
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( (sal_Unicode)' ' );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// otherwise it's a separate token.
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\r':
|
|
|
|
case '\n':
|
|
|
|
if( '>'==cBreak )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// cr/lf in tag is handled in _GetNextToken()
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if( bReadListing || bReadXMP || bReadPRE || bReadTextArea )
|
|
|
|
{
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
// Reduce sequence of CR/LF/BLANK/TAB to a single blank
|
|
|
|
// no break!!
|
2000-09-18 16:07:07 +00:00
|
|
|
case '\t':
|
|
|
|
if( '\t'==nNextCh && bReadPRE && '>'!=cBreak )
|
|
|
|
{
|
|
|
|
// In <PRE>: Tabs nach oben durchreichen
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break
|
2000-09-18 16:07:07 +00:00
|
|
|
case '\x0b':
|
|
|
|
if( '\x0b'==nNextCh && (bReadPRE || bReadXMP ||bReadListing) &&
|
|
|
|
'>'!=cBreak )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nNextCh = ' ';
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case ' ':
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
if( '>'!=cBreak && (!bReadListing && !bReadXMP &&
|
|
|
|
!bReadPRE && !bReadTextArea) )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Reduce sequences of Blanks/Tabs/CR/LF to a single blank
|
2000-09-18 16:07:07 +00:00
|
|
|
do {
|
|
|
|
if( sal_Unicode(EOF) == (nNextCh = GetNextChar()) &&
|
|
|
|
rInput.IsEof() )
|
|
|
|
{
|
|
|
|
if( aToken.Len() || sTmpBuffer.getLength() > 1L )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Have seen s.th. aside from blanks?
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
return HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
else
|
2011-04-22 22:13:32 +02:00
|
|
|
// Only read blanks: no text must be returned
|
|
|
|
// and _GetNextToken has to read until EOF
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} while ( ' ' == nNextCh || '\t' == nNextCh ||
|
|
|
|
'\r' == nNextCh || '\n' == nNextCh ||
|
|
|
|
'\x0b' == nNextCh );
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-11-05 10:31:15 +08:00
|
|
|
bEqSignFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( (nNextCh==cBreak && !cQuote) ||
|
2011-01-12 15:56:50 +01:00
|
|
|
(sal_uLong(aToken.Len()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 ))
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
do {
|
2011-04-22 22:13:32 +02:00
|
|
|
// All remaining characters make their way into the text.
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
{
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
2011-01-12 15:56:50 +01:00
|
|
|
if( (sal_uLong(aToken.Len()) + MAX_LEN) >
|
|
|
|
sal_uLong(STRING_MAXLEN & ~1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
return HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( ( sal_Unicode(EOF) == (nNextCh = GetNextChar()) &&
|
|
|
|
rInput.IsEof() ) ||
|
|
|
|
!IsParserWorking() )
|
|
|
|
{
|
|
|
|
if( sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
return HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
} while( HTML_ISALPHA( nNextCh ) || HTML_ISDIGIT( nNextCh ) );
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
|
2011-03-18 21:19:34 +01:00
|
|
|
if( bContinue && bNextCh )
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
|
|
|
|
return HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
int HTMLParser::_GetNextRawToken()
|
|
|
|
{
|
|
|
|
::rtl::OUStringBuffer sTmpBuffer( MAX_LEN );
|
|
|
|
|
|
|
|
if( bEndTokenFound )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// During the last execution we already found the end token,
|
|
|
|
// thus we don't have to search it again.
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadScript = sal_False;
|
|
|
|
bReadStyle = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
aEndToken.Erase();
|
2010-11-05 10:31:15 +08:00
|
|
|
bEndTokenFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Default return value: HTML_RAWDATA
|
2011-03-18 21:19:34 +01:00
|
|
|
int bContinue = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
int nToken = HTML_RAWDATA;
|
|
|
|
SaveState( 0 );
|
2011-03-18 21:19:34 +01:00
|
|
|
while( bContinue && IsParserWorking() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
int bNextCh = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( nNextCh )
|
|
|
|
{
|
|
|
|
case '<':
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Maybe we've reached the end.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Save what we have read previously...
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// and remember position in stream.
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nStreamPos = rInput.Tell();
|
|
|
|
sal_uLong nLineNr = GetLineNr();
|
|
|
|
sal_uLong nLinePos = GetLinePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Start of an end token?
|
2010-11-05 10:31:15 +08:00
|
|
|
int bOffState = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '/' == (nNextCh = GetNextChar()) )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bOffState = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
else if( '!' == nNextCh )
|
|
|
|
{
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Read following letters
|
2000-09-18 16:07:07 +00:00
|
|
|
while( (HTML_ISALPHA(nNextCh) || '-'==nNextCh) &&
|
|
|
|
IsParserWorking() && sTmpBuffer.getLength() < MAX_LEN )
|
|
|
|
{
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
String aTok( sTmpBuffer.getStr(),
|
2006-10-12 14:28:10 +00:00
|
|
|
sal::static_int_cast< xub_StrLen >(
|
|
|
|
sTmpBuffer.getLength()) );
|
2000-09-18 16:07:07 +00:00
|
|
|
aTok.ToUpperAscii();
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bDone = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bReadScript || aEndToken.Len() )
|
|
|
|
{
|
|
|
|
if( !bReadComment )
|
|
|
|
{
|
2009-04-27 11:24:10 +00:00
|
|
|
if( aTok.CompareToAscii( OOO_STRING_SVTOOLS_HTML_comment, 3 )
|
2000-09-18 16:07:07 +00:00
|
|
|
== COMPARE_EQUAL )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadComment = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// A script has to end with "</SCRIPT>". But
|
|
|
|
// ">" is optional for security reasons
|
|
|
|
bDone = bOffState &&
|
2000-09-18 16:07:07 +00:00
|
|
|
COMPARE_EQUAL == ( bReadScript
|
2009-04-27 11:24:10 +00:00
|
|
|
? aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_script)
|
2000-09-18 16:07:07 +00:00
|
|
|
: aTok.CompareTo(aEndToken) );
|
|
|
|
}
|
|
|
|
}
|
2006-10-12 14:28:10 +00:00
|
|
|
if( bReadComment && '>'==nNextCh && aTok.Len() >= 2 &&
|
|
|
|
aTok.Copy( aTok.Len()-2 ).EqualsAscii( "--" ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// End of comment of style <!----->
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadComment = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Style sheets can be closed by </STYLE>, </HEAD> or <BODY>
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bOffState )
|
2009-04-27 11:24:10 +00:00
|
|
|
bDone = aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_style)
|
2000-09-18 16:07:07 +00:00
|
|
|
== COMPARE_EQUAL ||
|
2009-04-27 11:24:10 +00:00
|
|
|
aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_head)
|
2000-09-18 16:07:07 +00:00
|
|
|
== COMPARE_EQUAL;
|
|
|
|
else
|
|
|
|
bDone =
|
2009-04-27 11:24:10 +00:00
|
|
|
aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_body) == COMPARE_EQUAL;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bDone )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Done! Return the previously read string (if requested)
|
|
|
|
// and continue.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// nToken==0 means, _GetNextToken continues to read
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !aToken.Len() && (bReadStyle || bReadScript) )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Immediately close environment (or context?)
|
|
|
|
// and parse the end token
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadScript = sal_False;
|
|
|
|
bReadStyle = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
aEndToken.Erase();
|
|
|
|
nToken = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Keep bReadScript/bReadStyle alive
|
|
|
|
// and parse end token during next execution
|
2010-11-05 10:31:15 +08:00
|
|
|
bEndTokenFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Move backwards in stream to '<'
|
2000-09-18 16:07:07 +00:00
|
|
|
rInput.Seek( nStreamPos );
|
|
|
|
SetLineNr( nLineNr );
|
|
|
|
SetLinePos( nLinePos );
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = '<';
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Don't append string to token.
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.setLength( 0L );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// remember "</" , everything else we find in the buffer
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken += (sal_Unicode)'<';
|
|
|
|
if( bOffState )
|
|
|
|
aToken += (sal_Unicode)'/';
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
if( bReadComment )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bTwoMinus = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
while( '-' == nNextCh && IsParserWorking() )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bTwoMinus = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( '>' == nNextCh && IsParserWorking() && bTwoMinus )
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadComment = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\r':
|
2011-04-22 22:13:32 +02:00
|
|
|
// \r\n? closes the current text token (even if it's empty)
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
if( nNextCh=='\n' )
|
|
|
|
nNextCh = GetNextChar();
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case '\n':
|
2011-04-22 22:13:32 +02:00
|
|
|
// \n closes the current text token (even if it's empty)
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case sal_Unicode(EOF):
|
2011-04-22 22:13:32 +02:00
|
|
|
// eof closes the current text token and behaves like having read
|
|
|
|
// an end token
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rInput.IsEof() )
|
|
|
|
{
|
2011-03-18 21:19:34 +01:00
|
|
|
bContinue = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( aToken.Len() || sTmpBuffer.getLength() )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bEndTokenFound = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadScript = sal_False;
|
|
|
|
bReadStyle = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
aEndToken.Erase();
|
|
|
|
nToken = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break
|
2000-09-18 16:07:07 +00:00
|
|
|
default:
|
2011-04-22 22:13:32 +02:00
|
|
|
// all remaining characters are appended to the buffer
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-03-18 21:19:34 +01:00
|
|
|
if( (!bContinue && sTmpBuffer.getLength() > 0L) ||
|
2000-09-18 16:07:07 +00:00
|
|
|
MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
|
2011-03-18 21:19:34 +01:00
|
|
|
if( bContinue && bNextCh )
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( IsParserWorking() )
|
|
|
|
SaveState( 0 );
|
|
|
|
else
|
|
|
|
nToken = 0;
|
|
|
|
|
|
|
|
return nToken;
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Scan next token
|
2010-12-11 17:58:44 +01:00
|
|
|
int HTMLParser::_GetNextToken()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
int nRet = 0;
|
|
|
|
sSaveToken.Erase();
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Delete options
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pOptions->Count() )
|
|
|
|
pOptions->DeleteAndDestroy( 0, pOptions->Count() );
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
if( !IsParserWorking() ) // Don't continue if already an error occured
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bReadNextCharSave = bReadNextChar;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bReadNextChar )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( !bEndTokenFound,
|
2011-04-22 22:13:32 +02:00
|
|
|
"Read a character despite </SCRIPT> was read?" );
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
2011-04-22 22:13:32 +02:00
|
|
|
if( !IsParserWorking() ) // Don't continue if already an error occured
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadNextChar = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bReadScript || bReadStyle || aEndToken.Len() )
|
|
|
|
{
|
|
|
|
nRet = _GetNextRawToken();
|
|
|
|
if( nRet || !IsParserWorking() )
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2010-11-05 10:31:15 +08:00
|
|
|
int bNextCh = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( nNextCh )
|
|
|
|
{
|
|
|
|
case '<':
|
|
|
|
{
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nStreamPos = rInput.Tell();
|
|
|
|
sal_uLong nLineNr = GetLineNr();
|
|
|
|
sal_uLong nLinePos = GetLinePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
int bOffState = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '/' == (nNextCh = GetNextChar()) )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bOffState = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
if( HTML_ISALPHA( nNextCh ) || '!'==nNextCh )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::rtl::OUStringBuffer sTmpBuffer;
|
|
|
|
do {
|
|
|
|
sTmpBuffer.append( nNextCh );
|
|
|
|
if( MAX_LEN == sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
} while( '>' != nNextCh && !HTML_ISSPACE( nNextCh ) &&
|
|
|
|
IsParserWorking() && !rInput.IsEof() );
|
|
|
|
|
|
|
|
if( sTmpBuffer.getLength() )
|
|
|
|
aToken += String(sTmpBuffer.makeStringAndClear());
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Skip blanks
|
2000-09-18 16:07:07 +00:00
|
|
|
while( HTML_ISSPACE( nNextCh ) && IsParserWorking() )
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
|
|
|
|
if( !IsParserWorking() )
|
|
|
|
{
|
|
|
|
if( SVPAR_PENDING == eState )
|
|
|
|
bReadNextChar = bReadNextCharSave;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Search token in table:
|
2000-09-18 16:07:07 +00:00
|
|
|
sSaveToken = aToken;
|
|
|
|
aToken.ToUpperAscii();
|
|
|
|
if( 0 == (nRet = GetHTMLToken( aToken )) )
|
2011-04-22 22:13:32 +02:00
|
|
|
// Unknown control
|
2000-09-18 16:07:07 +00:00
|
|
|
nRet = HTML_UNKNOWNCONTROL_ON;
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// If it's a token which can be switched off...
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bOffState )
|
|
|
|
{
|
|
|
|
if( HTML_TOKEN_ONOFF & nRet )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// and there is an off token, return off token instead
|
2000-09-18 16:07:07 +00:00
|
|
|
++nRet;
|
|
|
|
}
|
|
|
|
else if( HTML_LINEBREAK!=nRet )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// and there is no off token, return unknown token.
|
|
|
|
// (except for </BR>, that is treated like <BR>)
|
2000-09-18 16:07:07 +00:00
|
|
|
nRet = HTML_UNKNOWNCONTROL_OFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nRet == HTML_COMMENT )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// fix: due to being case sensitive use sSaveToken as start of comment
|
|
|
|
// and append a blank.
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken = sSaveToken;
|
|
|
|
if( '>'!=nNextCh )
|
|
|
|
aToken += (sal_Unicode)' ';
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nCStreamPos = 0;
|
|
|
|
sal_uLong nCLineNr = 0;
|
|
|
|
sal_uLong nCLinePos = 0;
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nCStrLen = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bDone = sal_False;
|
2011-04-22 22:13:32 +02:00
|
|
|
// Read until closing -->. If not found restart at first >
|
2000-09-18 16:07:07 +00:00
|
|
|
while( !bDone && !rInput.IsEof() && IsParserWorking() )
|
|
|
|
{
|
|
|
|
if( '>'==nNextCh )
|
|
|
|
{
|
|
|
|
if( !nCStreamPos )
|
|
|
|
{
|
|
|
|
nCStreamPos = rInput.Tell();
|
|
|
|
nCStrLen = aToken.Len();
|
|
|
|
nCLineNr = GetLineNr();
|
|
|
|
nCLinePos = GetLinePos();
|
|
|
|
}
|
2006-10-12 14:28:10 +00:00
|
|
|
bDone = aToken.Len() >= 2 &&
|
|
|
|
aToken.Copy(aToken.Len()-2,2).
|
2000-09-18 16:07:07 +00:00
|
|
|
EqualsAscii( "--" );
|
|
|
|
if( !bDone )
|
|
|
|
aToken += nNextCh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aToken += nNextCh;
|
|
|
|
if( !bDone )
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
if( !bDone && IsParserWorking() && nCStreamPos )
|
|
|
|
{
|
|
|
|
rInput.Seek( nCStreamPos );
|
|
|
|
SetLineNr( nCLineNr );
|
|
|
|
SetLinePos( nCLinePos );
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken.Erase( nCStrLen );
|
|
|
|
nNextCh = '>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// TokenString not needed anymore
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken.Erase();
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Read until closing '>'
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '>' != nNextCh && IsParserWorking() )
|
|
|
|
{
|
|
|
|
ScanText( '>' );
|
2011-03-17 13:47:12 +01:00
|
|
|
|
2011-04-23 22:25:26 +02:00
|
|
|
// fdo#34666 fdo#36080 fdo#36390: closing "/>"?:
|
|
|
|
// return HTML_<TOKEN>_OFF instead of HTML_<TOKEN>_ON
|
2011-03-18 13:49:28 +01:00
|
|
|
if (aToken.Len() >= 1 && '/' == aToken.GetChar(aToken.Len()-1)) {
|
2011-04-23 22:25:26 +02:00
|
|
|
nRet += 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF;
|
2011-03-17 13:47:12 +01:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Move back in front of < and restart there.
|
|
|
|
// Return < as text.
|
2000-09-18 16:07:07 +00:00
|
|
|
rInput.Seek( nStreamPos );
|
|
|
|
SetLineNr( nLineNr );
|
|
|
|
SetLinePos( nLinePos );
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aToken = '<';
|
|
|
|
nRet = HTML_TEXTTOKEN;
|
|
|
|
nNextCh = GetNextChar();
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( SVPAR_PENDING == eState )
|
|
|
|
bReadNextChar = bReadNextCharSave;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( bOffState )
|
|
|
|
{
|
|
|
|
// einfach alles wegschmeissen
|
|
|
|
ScanText( '>' );
|
|
|
|
if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Move back in front of < and restart there.
|
|
|
|
// Return < as text.
|
2000-09-18 16:07:07 +00:00
|
|
|
rInput.Seek( nStreamPos );
|
|
|
|
SetLineNr( nLineNr );
|
|
|
|
SetLinePos( nLinePos );
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aToken = '<';
|
|
|
|
nRet = HTML_TEXTTOKEN;
|
|
|
|
nNextCh = GetNextChar();
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( SVPAR_PENDING == eState )
|
|
|
|
bReadNextChar = bReadNextCharSave;
|
|
|
|
aToken.Erase();
|
|
|
|
}
|
|
|
|
else if( '%' == nNextCh )
|
|
|
|
{
|
|
|
|
nRet = HTML_UNKNOWNCONTROL_ON;
|
|
|
|
|
2011-01-12 15:56:50 +01:00
|
|
|
sal_uLong nCStreamPos = rInput.Tell();
|
|
|
|
sal_uLong nCLineNr = GetLineNr(), nCLinePos = GetLinePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bDone = sal_False;
|
2011-04-22 22:13:32 +02:00
|
|
|
// Read until closing %>. If not found restart at first >.
|
2000-09-18 16:07:07 +00:00
|
|
|
while( !bDone && !rInput.IsEof() && IsParserWorking() )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
bDone = '>'==nNextCh && aToken.Len() >= 1 &&
|
|
|
|
'%' == aToken.GetChar( aToken.Len()-1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bDone )
|
|
|
|
{
|
|
|
|
aToken += nNextCh;
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !bDone && IsParserWorking() )
|
|
|
|
{
|
|
|
|
rInput.Seek( nCStreamPos );
|
|
|
|
SetLineNr( nCLineNr );
|
|
|
|
SetLinePos( nCLinePos );
|
2001-11-22 09:48:35 +00:00
|
|
|
ClearTxtConvContext();
|
2006-10-12 14:28:10 +00:00
|
|
|
aToken.AssignAscii( "<%", 2 );
|
2000-09-18 16:07:07 +00:00
|
|
|
nRet = HTML_TEXTTOKEN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( IsParserWorking() )
|
|
|
|
{
|
|
|
|
sSaveToken = aToken;
|
|
|
|
aToken.Erase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aToken = '<';
|
|
|
|
nRet = HTML_TEXTTOKEN;
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( IsParserWorking() )
|
|
|
|
{
|
|
|
|
bNextCh = '>' == nNextCh;
|
|
|
|
switch( nRet )
|
|
|
|
{
|
|
|
|
case HTML_TEXTAREA_ON:
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadTextArea = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HTML_TEXTAREA_OFF:
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadTextArea = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HTML_SCRIPT_ON:
|
|
|
|
if( !bReadTextArea )
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadScript = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HTML_SCRIPT_OFF:
|
|
|
|
if( !bReadTextArea )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadScript = sal_False;
|
2011-04-22 22:13:32 +02:00
|
|
|
// JavaScript might modify the stream,
|
|
|
|
// thus the last character has to be read again.
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadNextChar = sal_True;
|
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_STYLE_ON:
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadStyle = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HTML_STYLE_OFF:
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadStyle = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case sal_Unicode(EOF):
|
|
|
|
if( rInput.IsEof() )
|
|
|
|
{
|
|
|
|
eState = SVPAR_ACCEPTED;
|
|
|
|
nRet = nNextCh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Read normal text.
|
2000-09-18 16:07:07 +00:00
|
|
|
goto scan_text;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\f':
|
2011-04-22 22:13:32 +02:00
|
|
|
// form feeds are passed upwards separately
|
|
|
|
nRet = HTML_LINEFEEDCHAR; // !!! should be FORMFEEDCHAR
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '\n':
|
|
|
|
case '\r':
|
|
|
|
if( bReadListing || bReadXMP || bReadPRE || bReadTextArea )
|
|
|
|
{
|
|
|
|
sal_Unicode c = GetNextChar();
|
|
|
|
if( ( '\n' != nNextCh || '\r' != c ) &&
|
|
|
|
( '\r' != nNextCh || '\n' != c ) )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bNextCh = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNextCh = c;
|
|
|
|
}
|
|
|
|
nRet = HTML_NEWPARA;
|
|
|
|
break;
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break !
|
2000-09-18 16:07:07 +00:00
|
|
|
case '\t':
|
|
|
|
if( bReadPRE )
|
|
|
|
{
|
|
|
|
nRet = HTML_TABCHAR;
|
|
|
|
break;
|
|
|
|
}
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break !
|
2000-09-18 16:07:07 +00:00
|
|
|
case ' ':
|
2011-04-22 22:13:32 +02:00
|
|
|
// no break !
|
2000-09-18 16:07:07 +00:00
|
|
|
default:
|
|
|
|
|
|
|
|
scan_text:
|
2011-04-22 22:13:32 +02:00
|
|
|
// "normal" text to come
|
2000-09-18 16:07:07 +00:00
|
|
|
nRet = ScanText();
|
|
|
|
bNextCh = 0 == aToken.Len();
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// the text should be processed
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bNextCh && eState == SVPAR_PENDING )
|
|
|
|
{
|
|
|
|
eState = SVPAR_WORKING;
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadNextChar = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bNextCh && SVPAR_WORKING == eState )
|
|
|
|
{
|
|
|
|
nNextCh = GetNextChar();
|
|
|
|
if( SVPAR_PENDING == eState && nRet && HTML_TEXTTOKEN != nRet )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
bReadNextChar = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
eState = SVPAR_WORKING;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} while( !nRet && SVPAR_WORKING == eState );
|
|
|
|
|
|
|
|
if( SVPAR_PENDING == eState )
|
2011-04-22 22:13:32 +02:00
|
|
|
nRet = -1; // s.th. invalid
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTMLParser::UnescapeToken()
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nPos=0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bEscape = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nPos < aToken.Len() )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bOldEscape = bEscape;
|
|
|
|
bEscape = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( '\\'==aToken.GetChar(nPos) && !bOldEscape )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
aToken.Erase( nPos, 1 );
|
2010-11-05 10:31:15 +08:00
|
|
|
bEscape = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nPos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// If the options for the current token have already been returned,
|
|
|
|
// return them once again.
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pOptions->Count() )
|
|
|
|
return pOptions;
|
|
|
|
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nPos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nPos < aToken.Len() )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// A letter? Option beginning here.
|
2000-09-18 16:07:07 +00:00
|
|
|
if( HTML_ISALPHA( aToken.GetChar(nPos) ) )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
int nToken;
|
2000-09-18 16:07:07 +00:00
|
|
|
String aValue;
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nStt = nPos;
|
2006-06-19 20:26:23 +00:00
|
|
|
sal_Unicode cChar = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Actually only certain characters allowed.
|
|
|
|
// Netscape only looks for "=" and white space (c.f.
|
|
|
|
// Mozilla: PA_FetchRequestedNameValues in lipparse/pa_mdl.c)
|
2006-06-19 20:26:23 +00:00
|
|
|
while( nPos < aToken.Len() && '=' != (cChar=aToken.GetChar(nPos)) &&
|
|
|
|
HTML_ISPRINTABLE(cChar) && !HTML_ISSPACE(cChar) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos++;
|
|
|
|
|
|
|
|
String sName( aToken.Copy( nStt, nPos-nStt ) );
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// PlugIns require original token name. Convert to upper case only for searching.
|
2000-09-18 16:07:07 +00:00
|
|
|
String sNameUpperCase( sName );
|
|
|
|
sNameUpperCase.ToUpperAscii();
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
nToken = GetHTMLOption( sNameUpperCase ); // Name is ready
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN,
|
2011-04-22 22:13:32 +02:00
|
|
|
"GetOption: unknown HTML option" );
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START ||
|
2000-09-18 16:07:07 +00:00
|
|
|
nToken >= HTML_OPTION_SCRIPT_END) &&
|
|
|
|
(!pNoConvertToken || nToken != *pNoConvertToken);
|
|
|
|
|
|
|
|
while( nPos < aToken.Len() &&
|
2006-06-19 20:26:23 +00:00
|
|
|
( !HTML_ISPRINTABLE( (cChar=aToken.GetChar(nPos)) ) ||
|
|
|
|
HTML_ISSPACE(cChar) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos++;
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Option with value?
|
2006-06-19 20:26:23 +00:00
|
|
|
if( nPos!=aToken.Len() && '='==cChar )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nPos++;
|
|
|
|
|
|
|
|
while( nPos < aToken.Len() &&
|
2006-06-19 20:26:23 +00:00
|
|
|
( !HTML_ISPRINTABLE( (cChar=aToken.GetChar(nPos)) ) ||
|
|
|
|
' '==cChar || '\t'==cChar || '\r'==cChar || '\n'==cChar ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos++;
|
|
|
|
|
|
|
|
if( nPos != aToken.Len() )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nLen = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
nStt = nPos;
|
2006-06-19 20:26:23 +00:00
|
|
|
if( ('"'==cChar) || ('\'')==cChar )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-06-19 20:26:23 +00:00
|
|
|
sal_Unicode cEnd = cChar;
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos++; nStt++;
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bDone = sal_False;
|
|
|
|
sal_Bool bEscape = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nPos < aToken.Len() && !bDone )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bOldEscape = bEscape;
|
|
|
|
bEscape = sal_False;
|
2006-06-19 20:26:23 +00:00
|
|
|
cChar = aToken.GetChar(nPos);
|
|
|
|
switch( cChar )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case '\r':
|
|
|
|
case '\n':
|
|
|
|
if( bStripCRLF )
|
2006-10-12 14:28:10 +00:00
|
|
|
((String &)aToken).Erase( nPos, 1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
nPos++, nLen++;
|
|
|
|
break;
|
|
|
|
case '\\':
|
|
|
|
if( bOldEscape )
|
|
|
|
{
|
|
|
|
nPos++, nLen++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
((String &)aToken).Erase( nPos, 1 );
|
2010-11-05 10:31:15 +08:00
|
|
|
bEscape = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '"':
|
|
|
|
case '\'':
|
2006-06-19 20:26:23 +00:00
|
|
|
bDone = !bOldEscape && cChar==cEnd;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bDone )
|
|
|
|
nPos++, nLen++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
nPos++, nLen++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( nPos!=aToken.Len() )
|
|
|
|
nPos++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// More liberal than the standard: allow all printable characters
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bEscape = sal_False;
|
|
|
|
sal_Bool bDone = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nPos < aToken.Len() && !bDone )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bOldEscape = bEscape;
|
|
|
|
bEscape = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Unicode c = aToken.GetChar(nPos);
|
|
|
|
switch( c )
|
|
|
|
{
|
|
|
|
case ' ':
|
|
|
|
bDone = !bOldEscape;
|
|
|
|
if( !bDone )
|
|
|
|
nPos++, nLen++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\t':
|
|
|
|
case '\r':
|
|
|
|
case '\n':
|
2010-11-05 10:31:15 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '\\':
|
|
|
|
if( bOldEscape )
|
|
|
|
{
|
|
|
|
nPos++, nLen++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
((String &)aToken).Erase( nPos, 1 );
|
2010-11-05 10:31:15 +08:00
|
|
|
bEscape = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if( HTML_ISPRINTABLE( c ) )
|
|
|
|
nPos++, nLen++;
|
|
|
|
else
|
2010-11-05 10:31:15 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nLen )
|
|
|
|
aValue = aToken.Copy( nStt, nLen );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Token is known and can be saved
|
2000-09-18 16:07:07 +00:00
|
|
|
HTMLOption *pOption =
|
2006-10-12 14:28:10 +00:00
|
|
|
new HTMLOption(
|
|
|
|
sal::static_int_cast< sal_uInt16 >(nToken), sName, aValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pOptions->Insert( pOption, pOptions->Count() );
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2011-04-22 22:13:32 +02:00
|
|
|
// Ignore white space and unexpected characters
|
2000-09-18 16:07:07 +00:00
|
|
|
nPos++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
int HTMLParser::FilterPRE( int nToken )
|
|
|
|
{
|
|
|
|
switch( nToken )
|
|
|
|
{
|
|
|
|
#ifdef HTML_BEHAVIOUR
|
2011-04-22 22:13:32 +02:00
|
|
|
// These become LFs according to the definition
|
2000-09-18 16:07:07 +00:00
|
|
|
case HTML_PARABREAK_ON:
|
|
|
|
case HTML_LINEBREAK:
|
|
|
|
nToken = HTML_NEWPARA;
|
|
|
|
#else
|
2011-04-22 22:13:32 +02:00
|
|
|
// in Netscape they only have impact in not empty paragraphs
|
2000-09-18 16:07:07 +00:00
|
|
|
case HTML_PARABREAK_ON:
|
|
|
|
nToken = HTML_LINEBREAK;
|
|
|
|
case HTML_LINEBREAK:
|
|
|
|
#endif
|
|
|
|
case HTML_NEWPARA:
|
2006-10-12 14:28:10 +00:00
|
|
|
nPre_LinePos = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bPre_IgnoreNewPara )
|
|
|
|
nToken = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_TABCHAR:
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nSpaces = sal::static_int_cast< xub_StrLen >(
|
|
|
|
8 - (nPre_LinePos % 8));
|
2011-04-23 22:25:26 +02:00
|
|
|
DBG_ASSERT( !aToken.Len(), "Why is the token not empty?" );
|
2000-09-18 16:07:07 +00:00
|
|
|
aToken.Expand( nSpaces, ' ' );
|
|
|
|
nPre_LinePos += nSpaces;
|
|
|
|
nToken = HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
break;
|
2011-04-22 22:13:32 +02:00
|
|
|
// Keep those
|
2000-09-18 16:07:07 +00:00
|
|
|
case HTML_TEXTTOKEN:
|
|
|
|
nPre_LinePos += aToken.Len();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_SELECT_ON:
|
|
|
|
case HTML_SELECT_OFF:
|
|
|
|
case HTML_BODY_ON:
|
|
|
|
case HTML_FORM_ON:
|
|
|
|
case HTML_FORM_OFF:
|
|
|
|
case HTML_INPUT:
|
|
|
|
case HTML_OPTION:
|
|
|
|
case HTML_TEXTAREA_ON:
|
|
|
|
case HTML_TEXTAREA_OFF:
|
|
|
|
|
|
|
|
case HTML_IMAGE:
|
|
|
|
case HTML_APPLET_ON:
|
|
|
|
case HTML_APPLET_OFF:
|
|
|
|
case HTML_PARAM:
|
|
|
|
case HTML_EMBED:
|
|
|
|
|
|
|
|
case HTML_HEAD1_ON:
|
|
|
|
case HTML_HEAD1_OFF:
|
|
|
|
case HTML_HEAD2_ON:
|
|
|
|
case HTML_HEAD2_OFF:
|
|
|
|
case HTML_HEAD3_ON:
|
|
|
|
case HTML_HEAD3_OFF:
|
|
|
|
case HTML_HEAD4_ON:
|
|
|
|
case HTML_HEAD4_OFF:
|
|
|
|
case HTML_HEAD5_ON:
|
|
|
|
case HTML_HEAD5_OFF:
|
|
|
|
case HTML_HEAD6_ON:
|
|
|
|
case HTML_HEAD6_OFF:
|
|
|
|
case HTML_BLOCKQUOTE_ON:
|
|
|
|
case HTML_BLOCKQUOTE_OFF:
|
|
|
|
case HTML_ADDRESS_ON:
|
|
|
|
case HTML_ADDRESS_OFF:
|
|
|
|
case HTML_HORZRULE:
|
|
|
|
|
|
|
|
case HTML_CENTER_ON:
|
|
|
|
case HTML_CENTER_OFF:
|
|
|
|
case HTML_DIVISION_ON:
|
|
|
|
case HTML_DIVISION_OFF:
|
|
|
|
|
|
|
|
case HTML_SCRIPT_ON:
|
|
|
|
case HTML_SCRIPT_OFF:
|
|
|
|
case HTML_RAWDATA:
|
|
|
|
|
|
|
|
case HTML_TABLE_ON:
|
|
|
|
case HTML_TABLE_OFF:
|
|
|
|
case HTML_CAPTION_ON:
|
|
|
|
case HTML_CAPTION_OFF:
|
|
|
|
case HTML_COLGROUP_ON:
|
|
|
|
case HTML_COLGROUP_OFF:
|
|
|
|
case HTML_COL_ON:
|
|
|
|
case HTML_COL_OFF:
|
|
|
|
case HTML_THEAD_ON:
|
|
|
|
case HTML_THEAD_OFF:
|
|
|
|
case HTML_TFOOT_ON:
|
|
|
|
case HTML_TFOOT_OFF:
|
|
|
|
case HTML_TBODY_ON:
|
|
|
|
case HTML_TBODY_OFF:
|
|
|
|
case HTML_TABLEROW_ON:
|
|
|
|
case HTML_TABLEROW_OFF:
|
|
|
|
case HTML_TABLEDATA_ON:
|
|
|
|
case HTML_TABLEDATA_OFF:
|
|
|
|
case HTML_TABLEHEADER_ON:
|
|
|
|
case HTML_TABLEHEADER_OFF:
|
|
|
|
|
|
|
|
case HTML_ANCHOR_ON:
|
|
|
|
case HTML_ANCHOR_OFF:
|
|
|
|
case HTML_BOLD_ON:
|
|
|
|
case HTML_BOLD_OFF:
|
|
|
|
case HTML_ITALIC_ON:
|
|
|
|
case HTML_ITALIC_OFF:
|
2005-01-05 12:29:27 +00:00
|
|
|
case HTML_STRIKE_ON:
|
|
|
|
case HTML_STRIKE_OFF:
|
|
|
|
case HTML_STRIKETHROUGH_ON:
|
|
|
|
case HTML_STRIKETHROUGH_OFF:
|
2000-09-18 16:07:07 +00:00
|
|
|
case HTML_UNDERLINE_ON:
|
|
|
|
case HTML_UNDERLINE_OFF:
|
|
|
|
case HTML_BASEFONT_ON:
|
|
|
|
case HTML_BASEFONT_OFF:
|
|
|
|
case HTML_FONT_ON:
|
|
|
|
case HTML_FONT_OFF:
|
|
|
|
case HTML_BLINK_ON:
|
|
|
|
case HTML_BLINK_OFF:
|
|
|
|
case HTML_SPAN_ON:
|
|
|
|
case HTML_SPAN_OFF:
|
2005-01-05 12:29:27 +00:00
|
|
|
case HTML_SUBSCRIPT_ON:
|
|
|
|
case HTML_SUBSCRIPT_OFF:
|
|
|
|
case HTML_SUPERSCRIPT_ON:
|
|
|
|
case HTML_SUPERSCRIPT_OFF:
|
|
|
|
case HTML_BIGPRINT_ON:
|
|
|
|
case HTML_BIGPRINT_OFF:
|
|
|
|
case HTML_SMALLPRINT_OFF:
|
|
|
|
case HTML_SMALLPRINT_ON:
|
|
|
|
|
|
|
|
case HTML_EMPHASIS_ON:
|
|
|
|
case HTML_EMPHASIS_OFF:
|
|
|
|
case HTML_CITIATION_ON:
|
|
|
|
case HTML_CITIATION_OFF:
|
|
|
|
case HTML_STRONG_ON:
|
|
|
|
case HTML_STRONG_OFF:
|
|
|
|
case HTML_CODE_ON:
|
|
|
|
case HTML_CODE_OFF:
|
|
|
|
case HTML_SAMPLE_ON:
|
|
|
|
case HTML_SAMPLE_OFF:
|
|
|
|
case HTML_KEYBOARD_ON:
|
|
|
|
case HTML_KEYBOARD_OFF:
|
|
|
|
case HTML_VARIABLE_ON:
|
|
|
|
case HTML_VARIABLE_OFF:
|
|
|
|
case HTML_DEFINSTANCE_ON:
|
|
|
|
case HTML_DEFINSTANCE_OFF:
|
|
|
|
case HTML_SHORTQUOTE_ON:
|
|
|
|
case HTML_SHORTQUOTE_OFF:
|
|
|
|
case HTML_LANGUAGE_ON:
|
|
|
|
case HTML_LANGUAGE_OFF:
|
|
|
|
case HTML_AUTHOR_ON:
|
|
|
|
case HTML_AUTHOR_OFF:
|
|
|
|
case HTML_PERSON_ON:
|
|
|
|
case HTML_PERSON_OFF:
|
|
|
|
case HTML_ACRONYM_ON:
|
|
|
|
case HTML_ACRONYM_OFF:
|
|
|
|
case HTML_ABBREVIATION_ON:
|
|
|
|
case HTML_ABBREVIATION_OFF:
|
|
|
|
case HTML_INSERTEDTEXT_ON:
|
|
|
|
case HTML_INSERTEDTEXT_OFF:
|
|
|
|
case HTML_DELETEDTEXT_ON:
|
|
|
|
case HTML_DELETEDTEXT_OFF:
|
|
|
|
case HTML_TELETYPE_ON:
|
|
|
|
case HTML_TELETYPE_OFF:
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// The remainder is treated as an unknown token.
|
2000-09-18 16:07:07 +00:00
|
|
|
default:
|
|
|
|
if( nToken )
|
|
|
|
{
|
|
|
|
nToken =
|
|
|
|
( ((HTML_TOKEN_ONOFF & nToken) && (1 & nToken))
|
|
|
|
? HTML_UNKNOWNCONTROL_OFF
|
|
|
|
: HTML_UNKNOWNCONTROL_ON );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
bPre_IgnoreNewPara = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return nToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
int HTMLParser::FilterXMP( int nToken )
|
|
|
|
{
|
|
|
|
switch( nToken )
|
|
|
|
{
|
|
|
|
case HTML_NEWPARA:
|
|
|
|
if( bPre_IgnoreNewPara )
|
|
|
|
nToken = 0;
|
|
|
|
case HTML_TEXTTOKEN:
|
|
|
|
case HTML_NONBREAKSPACE:
|
|
|
|
case HTML_SOFTHYPH:
|
2011-04-22 22:13:32 +02:00
|
|
|
break; // kept
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if( nToken )
|
|
|
|
{
|
|
|
|
if( (HTML_TOKEN_ONOFF & nToken) && (1 & nToken) )
|
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
sSaveToken.Insert( '<', 0 );
|
|
|
|
sSaveToken.Insert( '/', 1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2006-10-12 14:28:10 +00:00
|
|
|
sSaveToken.Insert( '<', 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( aToken.Len() )
|
|
|
|
{
|
|
|
|
UnescapeToken();
|
|
|
|
sSaveToken += (sal_Unicode)' ';
|
2006-10-12 14:28:10 +00:00
|
|
|
aToken.Insert( sSaveToken, 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
aToken = sSaveToken;
|
|
|
|
aToken += (sal_Unicode)'>';
|
|
|
|
nToken = HTML_TEXTTOKEN;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
bPre_IgnoreNewPara = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return nToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
int HTMLParser::FilterListing( int nToken )
|
|
|
|
{
|
|
|
|
switch( nToken )
|
|
|
|
{
|
|
|
|
case HTML_NEWPARA:
|
|
|
|
if( bPre_IgnoreNewPara )
|
|
|
|
nToken = 0;
|
|
|
|
case HTML_TEXTTOKEN:
|
|
|
|
case HTML_NONBREAKSPACE:
|
|
|
|
case HTML_SOFTHYPH:
|
2011-04-22 22:13:32 +02:00
|
|
|
break; // kept
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if( nToken )
|
|
|
|
{
|
|
|
|
nToken =
|
|
|
|
( ((HTML_TOKEN_ONOFF & nToken) && (1 & nToken))
|
|
|
|
? HTML_UNKNOWNCONTROL_OFF
|
|
|
|
: HTML_UNKNOWNCONTROL_ON );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
bPre_IgnoreNewPara = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return nToken;
|
|
|
|
}
|
|
|
|
|
2010-10-05 07:57:54 -05:00
|
|
|
bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
|
Merge commit 'ooo/DEV300_m101' into intm101
The following builds for me:
basebmp, basegfx, comphelper, dtrans, i18npool, i18nutil, l10ntools, o3tl,
psprint_config, regexp, rsc, sax, sot, tools, ucbhelper, unotools, vcl
The rest still needs fixing ;-)
Conflicts:
canvas/prj/build.lst
canvas/source/cairo/cairo_textlayout.cxx
canvas/source/directx/dx_winstuff.hxx
canvas/source/tools/image.cxx
canvas/source/vcl/canvashelper.cxx
comphelper/inc/comphelper/documentconstants.hxx
comphelper/inc/comphelper/optionalvalue.hxx
comphelper/inc/comphelper/querydeep.hxx
comphelper/prj/build.lst
comphelper/qa/complex/makefile.mk
comphelper/qa/string/test_string_noadditional.cxx
comphelper/source/misc/componentmodule.cxx
comphelper/source/misc/mimeconfighelper.cxx
comphelper/source/misc/querydeep.cxx
comphelper/source/misc/uieventslogger.cxx
comphelper/source/property/TypeGeneration.cxx
comphelper/test/uno_iterators/uno_iterators.cxx
comphelper/util/makefile.mk
cppcanvas/source/mtfrenderer/implrenderer.cxx
dtrans/prj/build.lst
dtrans/source/generic/dtrans.cxx
dtrans/source/win32/dtobj/FmtFilter.cxx
i18npool/prj/build.lst
i18npool/source/localedata/data/localedata_others.map
i18npool/source/localedata/data/makefile.mk
i18npool/source/localedata/localedata.cxx
i18npool/source/localedata/saxparser.cxx
i18npool/source/registerservices/registerservices.cxx
i18npool/source/search/textsearch.cxx
l10ntools/inc/cfgmerge.hxx
l10ntools/inc/export.hxx
l10ntools/inc/gsicheck.hxx
l10ntools/inc/l10ntools/vosapp.hxx
l10ntools/inc/tagtest.hxx
l10ntools/inc/xmlparse.hxx
l10ntools/layout/layoutparse.cxx
l10ntools/layout/tralay.cxx
l10ntools/source/cfgmerge.cxx
l10ntools/source/export.cxx
l10ntools/source/export2.cxx
l10ntools/source/gsicheck.cxx
l10ntools/source/help/HelpLinker.cxx
l10ntools/source/lngex.cxx
l10ntools/source/lngmerge.cxx
l10ntools/source/merge.cxx
l10ntools/source/tagtest.cxx
l10ntools/source/xmlparse.cxx
padmin/source/fontentry.cxx
padmin/source/padialog.cxx
padmin/source/padialog.src
padmin/source/pamain.cxx
rsc/inc/rscarray.hxx
rsc/inc/rscclass.hxx
rsc/inc/rscclobj.hxx
rsc/inc/rsccont.hxx
rsc/inc/rscdb.hxx
rsc/inc/rscdef.hxx
rsc/inc/rscmgr.hxx
rsc/inc/rscrange.hxx
rsc/inc/rsctop.hxx
rsc/inc/vclrsc.hxx
rsc/source/parser/rscdb.cxx
rsc/source/parser/rscicpx.cxx
rsc/source/parser/rscinit.cxx
rsc/source/prj/start.cxx
rsc/source/res/rscarray.cxx
rsc/source/res/rscclass.cxx
rsc/source/res/rscclobj.cxx
rsc/source/res/rsccont.cxx
rsc/source/res/rscmgr.cxx
rsc/source/res/rscrange.cxx
rsc/source/res/rsctop.cxx
rsc/source/rsc/rsc.cxx
rsc/source/tools/rscdef.cxx
rsc/source/tools/rsctools.cxx
sax/source/expatwrap/sax_expat.cxx
sax/source/fastparser/facreg.cxx
sax/source/tools/fastserializer.cxx
sot/inc/sot/filelist.hxx
sot/inc/sot/object.hxx
sot/source/base/factory.cxx
sot/source/base/filelist.cxx
sot/source/sdstor/stg.cxx
sot/source/sdstor/stgcache.cxx
sot/source/sdstor/stgole.cxx
sot/source/sdstor/stgstrms.cxx
sot/source/sdstor/storage.cxx
sot/source/sdstor/ucbstorage.cxx
svl/inc/svl/cenumitm.hxx
svl/inc/svl/cintitem.hxx
svl/inc/svl/cntwall.hxx
svl/inc/svl/ctypeitm.hxx
svl/inc/svl/custritm.hxx
svl/inc/svl/dateitem.hxx
svl/inc/svl/filerec.hxx
svl/inc/svl/globalnameitem.hxx
svl/inc/svl/ilstitem.hxx
svl/inc/svl/imageitm.hxx
svl/inc/svl/intitem.hxx
svl/inc/svl/itempool.hxx
svl/inc/svl/itemset.hxx
svl/inc/svl/lckbitem.hxx
svl/inc/svl/poolitem.hxx
svl/inc/svl/ptitem.hxx
svl/inc/svl/rectitem.hxx
svl/inc/svl/sfontitm.hxx
svl/inc/svl/slstitm.hxx
svl/inc/svl/srchitem.hxx
svl/inc/svl/svarray.hxx
svl/inc/svl/svdde.hxx
svl/inc/svl/svstdarr.hxx
svl/inc/svl/szitem.hxx
svl/inc/svl/visitem.hxx
svl/inc/svl/zforlist.hxx
svl/inc/svl/zformat.hxx
svl/prj/build.lst
svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
svl/qa/complex/ConfigItems/helper/makefile.mk
svl/qa/makefile.mk
svl/source/filepicker/pickerhelper.cxx
svl/source/filerec/filerec.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/cntwall.cxx
svl/source/items/ctypeitm.cxx
svl/source/items/custritm.cxx
svl/source/items/dateitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/intitem.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
svl/source/items/lckbitem.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/style.cxx
svl/source/items/szitem.cxx
svl/source/items/visitem.cxx
svl/source/items/whiter.cxx
svl/source/memtools/svarray.cxx
svl/source/misc/PasswordHelper.cxx
svl/source/misc/adrparse.cxx
svl/source/misc/lngmisc.cxx
svl/source/notify/brdcst.cxx
svl/source/notify/listener.cxx
svl/source/notify/listenerbase.cxx
svl/source/numbers/makefile.mk
svl/source/numbers/nbdll.cxx
svl/source/numbers/zforfind.cxx
svl/source/numbers/zforlist.cxx
svl/source/numbers/zformat.cxx
svl/source/numbers/zforscan.cxx
svl/source/passwordcontainer/passwordcontainer.cxx
svl/source/svdde/ddecli.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddemlos2.h
svl/source/svdde/ddesvr.cxx
svl/source/undo/undo.cxx
svl/source/uno/registerservices.cxx
svl/util/makefile.mk
svtools/bmpmaker/bmpsum.cxx
svtools/bmpmaker/g2g.cxx
svtools/bmpmaker/makefile.mk
svtools/inc/borderhelper.hxx
svtools/inc/svtools/accessiblefactory.hxx
svtools/inc/svtools/apearcfg.hxx
svtools/inc/svtools/brwbox.hxx
svtools/inc/svtools/ctrlbox.hxx
svtools/inc/svtools/ctrltool.hxx
svtools/inc/svtools/editbrowsebox.hxx
svtools/inc/svtools/ehdl.hxx
svtools/inc/svtools/embedhlp.hxx
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/ivctrl.hxx
svtools/inc/svtools/parhtml.hxx
svtools/inc/svtools/printdlg.hxx
svtools/inc/svtools/rtftoken.h
svtools/inc/svtools/ruler.hxx
svtools/inc/svtools/svicnvw.hxx
svtools/inc/svtools/svlbitm.hxx
svtools/inc/svtools/svlbox.hxx
svtools/inc/svtools/svtreebx.hxx
svtools/inc/svtools/tabbar.hxx
svtools/inc/svtools/table/abstracttablecontrol.hxx
svtools/inc/svtools/taskbar.hxx
svtools/inc/svtools/textview.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/brwbox2.cxx
svtools/source/brwbox/datwin.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/brwbox/makefile.mk
svtools/source/config/apearcfg.cxx
svtools/source/config/htmlcfg.cxx
svtools/source/config/menuoptions.cxx
svtools/source/config/miscopt.cxx
svtools/source/contnr/cont_pch.cxx
svtools/source/contnr/ctrdll.cxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/imivctl1.cxx
svtools/source/contnr/ivctrl.cxx
svtools/source/contnr/makefile.mk
svtools/source/contnr/svcontnr.src
svtools/source/contnr/svicnvw.cxx
svtools/source/contnr/svimpbox.cxx
svtools/source/contnr/svimpicn.cxx
svtools/source/contnr/svlbitm.cxx
svtools/source/contnr/svtreebx.cxx
svtools/source/contnr/templwin.cxx
svtools/source/contnr/templwin.hxx
svtools/source/control/asynclink.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/ctrldll.cxx
svtools/source/control/ctrltool.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/filectrl.src
svtools/source/control/headbar.cxx
svtools/source/control/inettbc.cxx
svtools/source/control/makefile.mk
svtools/source/control/prgsbar.cxx
svtools/source/control/roadmap.cxx
svtools/source/control/ruler.cxx
svtools/source/control/scriptedtext.cxx
svtools/source/control/stdmenu.cxx
svtools/source/control/tabbar.cxx
svtools/source/control/taskbar.cxx
svtools/source/control/taskbox.cxx
svtools/source/control/taskmisc.cxx
svtools/source/control/taskstat.cxx
svtools/source/control/valueacc.cxx
svtools/source/control/valueset.cxx
svtools/source/dialogs/addresstemplate.cxx
svtools/source/dialogs/addresstemplate.src
svtools/source/dialogs/colrdlg.src
svtools/source/dialogs/filedlg2.cxx
svtools/source/dialogs/filedlg2.hxx
svtools/source/dialogs/makefile.mk
svtools/source/dialogs/printdlg.cxx
svtools/source/dialogs/printdlg.src
svtools/source/dialogs/propctrl.cxx
svtools/source/dialogs/propctrl.hxx
svtools/source/dialogs/property.cxx
svtools/source/edit/makefile.mk
svtools/source/edit/sychconv.cxx
svtools/source/edit/syntaxhighlight.cxx
svtools/source/edit/textdoc.cxx
svtools/source/edit/texteng.cxx
svtools/source/edit/textundo.cxx
svtools/source/edit/textview.cxx
svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
svtools/source/filter.vcl/filter/dlgejpg.cxx
svtools/source/filter.vcl/filter/dlgejpg.hxx
svtools/source/filter.vcl/filter/dlgejpg.src
svtools/source/filter.vcl/filter/dlgepng.cxx
svtools/source/filter.vcl/filter/dlgepng.hxx
svtools/source/filter.vcl/filter/dlgepng.src
svtools/source/filter.vcl/filter/dlgexpor.cxx
svtools/source/filter.vcl/filter/dlgexpor.hxx
svtools/source/filter.vcl/filter/dlgexpor.src
svtools/source/filter.vcl/filter/filter2.cxx
svtools/source/filter.vcl/filter/makefile.mk
svtools/source/filter.vcl/filter/sgfbram.cxx
svtools/source/filter.vcl/filter/sgvmain.cxx
svtools/source/filter.vcl/filter/sgvspln.cxx
svtools/source/filter.vcl/filter/strings.src
svtools/source/filter.vcl/jpeg/makefile.mk
svtools/source/filter.vcl/wmf/emfwr.cxx
svtools/source/filter.vcl/wmf/emfwr.hxx
svtools/source/filter.vcl/wmf/enhwmf.cxx
svtools/source/filter.vcl/wmf/winmtf.hxx
svtools/source/filter.vcl/wmf/wmfwr.cxx
svtools/source/filter.vcl/wmf/wmfwr.hxx
svtools/source/graphic/grfcache.cxx
svtools/source/graphic/grfcache.hxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/makefile.mk
svtools/source/inc/accessibletableimp.hxx
svtools/source/inc/svimpbox.hxx
svtools/source/java/patchjavaerror.src
svtools/source/misc/ehdl.cxx
svtools/source/misc/errtxt.src
svtools/source/misc/helpagentwindow.cxx
svtools/source/misc/imagemgr.cxx
svtools/source/misc/imagemgr.src
svtools/source/misc/imageresourceaccess.cxx
svtools/source/misc/imap.cxx
svtools/source/misc/langtab.src
svtools/source/misc/makefile.mk
svtools/source/misc/svtdata.cxx
svtools/source/misc/templatefoldercache.cxx
svtools/source/misc/transfer2.cxx
svtools/source/misc/undo.src
svtools/source/plugapp/commtest.cxx
svtools/source/plugapp/commtest.src
svtools/source/plugapp/makefile.mk
svtools/source/plugapp/testtool.src
svtools/source/productregistration/productregistration.cxx
svtools/source/svhtml/htmlkywd.cxx
svtools/source/svhtml/parhtml.cxx
svtools/source/svrtf/rtfkey2.cxx
svtools/source/svrtf/rtfkeywd.cxx
svtools/source/table/defaultinputhandler.cxx
svtools/source/table/makefile.mk
svtools/source/table/tablecontrol.cxx
svtools/source/table/tablecontrol_impl.cxx
svtools/source/table/tablecontrol_impl.hxx
svtools/source/table/tabledatawindow.cxx
svtools/source/table/tablegeometry.cxx
svtools/source/table/tablegeometry.hxx
svtools/source/toolpanel/makefile.mk
svtools/source/toolpanel/toolpaneldrawer.cxx
svtools/source/uno/addrtempuno.cxx
svtools/source/uno/miscservices.cxx
svtools/source/uno/svtxgridcontrol.cxx
svtools/source/uno/svtxgridcontrol.hxx
svtools/source/uno/toolboxcontroller.cxx
svtools/source/uno/treecontrolpeer.cxx
svtools/source/uno/unocontroltablemodel.cxx
svtools/source/uno/unocontroltablemodel.hxx
svtools/source/uno/unoimap.cxx
svtools/source/urlobj/inetimg.cxx
svtools/util/makefile.mk
svtools/workben/browser.cxx
svtools/workben/cui/makefile.mk
svtools/workben/makefile.mk
svtools/workben/stest.cxx
svtools/workben/toolpanel/makefile.mk
svtools/workben/urange.cxx
toolkit/inc/toolkit/awt/vclxdevice.hxx
toolkit/inc/toolkit/awt/vclxgraphics.hxx
toolkit/inc/toolkit/awt/vclxwindows.hxx
toolkit/inc/toolkit/controls/dialogcontrol.hxx
toolkit/inc/toolkit/helper/property.hxx
toolkit/inc/toolkit/helper/servicenames.hxx
toolkit/inc/toolkit/helper/throbberimpl.hxx
toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
toolkit/source/awt/asynccallback.cxx
toolkit/source/awt/vclxgraphics.cxx
toolkit/source/awt/vclxtoolkit.cxx
toolkit/source/awt/vclxwindow.cxx
toolkit/source/awt/xsimpleanimation.cxx
toolkit/source/awt/xthrobber.cxx
toolkit/source/controls/dialogcontrol.cxx
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
toolkit/source/controls/grid/defaultgriddatamodel.cxx
toolkit/source/controls/grid/gridcontrol.cxx
toolkit/source/controls/grid/initguard.hxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/controls/unocontrolcontainer.cxx
toolkit/source/controls/unocontrols.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
toolkit/source/helper/registerservices.cxx
toolkit/source/helper/servicenames.cxx
toolkit/source/helper/throbberimpl.cxx
toolkit/source/helper/tkresmgr.cxx
tools/StaticLibrary_ooopathutils.mk
tools/bootstrp/addexes/makefile.mk
tools/bootstrp/addexes2/makefile.mk
tools/bootstrp/addexes2/mkfilt.cxx
tools/bootstrp/command.cxx
tools/bootstrp/cppdep.cxx
tools/bootstrp/iserver.cxx
tools/bootstrp/makefile.mk
tools/bootstrp/mkcreate.cxx
tools/bootstrp/prj.cxx
tools/bootstrp/rscdep.cxx
tools/bootstrp/sstring.cxx
tools/inc/bootstrp/command.hxx
tools/inc/bootstrp/mkcreate.hxx
tools/inc/bootstrp/prj.hxx
tools/inc/bootstrp/sstring.hxx
tools/inc/tools/agapi.hxx
tools/inc/tools/agitem.hxx
tools/inc/tools/chapi.hxx
tools/inc/tools/download.hxx
tools/inc/tools/eacopier.hxx
tools/inc/tools/fract.hxx
tools/inc/tools/fsys.hxx
tools/inc/tools/geninfo.hxx
tools/inc/tools/globname.hxx
tools/inc/tools/inetmime.hxx
tools/inc/tools/multisel.hxx
tools/inc/tools/poly.hxx
tools/inc/tools/postsys.h
tools/inc/tools/postwin.h
tools/inc/tools/presys.h
tools/inc/tools/prewin.h
tools/inc/tools/pstm.hxx
tools/inc/tools/ref.hxx
tools/inc/tools/simplerm.hxx
tools/inc/tools/solar.h
tools/inc/tools/table.hxx
tools/inc/tools/urlkeys.hxx
tools/inc/tools/urlobj.hxx
tools/prj/build.lst
tools/prj/d.lst
tools/qa/makefile.mk
tools/source/communi/geninfo.cxx
tools/source/debug/debug.cxx
tools/source/fsys/dirent.cxx
tools/source/fsys/tdir.cxx
tools/source/fsys/unx.cxx
tools/source/fsys/urlobj.cxx
tools/source/generic/color.cxx
tools/source/generic/config.cxx
tools/source/generic/fract.cxx
tools/source/inet/inetmime.cxx
tools/source/memtools/multisel.cxx
tools/source/memtools/table.cxx
tools/source/rc/resmgr.cxx
tools/source/ref/globname.cxx
tools/source/ref/pstm.cxx
tools/source/solar/solar.c
tools/source/stream/strmos2.cxx
tools/source/stream/strmunx.cxx
tools/source/stream/strmwnt.cxx
tools/source/string/makefile.mk
tools/source/testtoolloader/testtoolloader.cxx
tools/test/makefile.mk
tools/util/makefile.mk
tools/win/inc/dll.hxx
tools/win/inc/parser.hxx
tools/win/inc/shellex.h
tools/win/inc/shutil.h
tools/win/inc/toolsdll.hxx
tools/win/inc/winshell.hxx
tools/workben/makefile.mk
ucbhelper/source/client/proxydecider.cxx
ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
unotools/inc/unotools/unotunnelhelper.hxx
unotools/source/config/fltrcfg.cxx
unotools/source/config/lingucfg.cxx
unotools/source/config/misccfg.cxx
unotools/source/config/pathoptions.cxx
unotools/source/config/searchopt.cxx
unotools/source/i18n/localedatawrapper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
unotools/source/ucbhelper/ucbhelper.cxx
unotools/source/ucbhelper/xtempfile.cxx
vcl/aqua/inc/salbmp.h
vcl/aqua/inc/salgdi.h
vcl/aqua/inc/salinst.h
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
vcl/aqua/source/gdi/salgdi.cxx
vcl/aqua/source/gdi/salprn.cxx
vcl/aqua/source/window/salframeview.mm
vcl/aqua/source/window/salobj.cxx
vcl/inc/vcl/bitmap.hxx
vcl/inc/vcl/brdwin.hxx
vcl/inc/vcl/button.hxx
vcl/inc/vcl/cmdevt.hxx
vcl/inc/vcl/cvtgrf.hxx
vcl/inc/vcl/dialog.hxx
vcl/inc/vcl/dockwin.hxx
vcl/inc/vcl/event.hxx
vcl/inc/vcl/fixed.hxx
vcl/inc/vcl/fldunit.hxx
vcl/inc/vcl/floatwin.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/glyphcache.hxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_features.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/ilstbox.hxx
vcl/inc/vcl/image.h
vcl/inc/vcl/imgctrl.hxx
vcl/inc/vcl/impbmpconv.hxx
vcl/inc/vcl/impprn.hxx
vcl/inc/vcl/jobset.h
vcl/inc/vcl/keycodes.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/mapunit.hxx
vcl/inc/vcl/menu.hxx
vcl/inc/vcl/msgbox.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/prndlg.hxx
vcl/inc/vcl/salatype.hxx
vcl/inc/vcl/salbmp.hxx
vcl/inc/vcl/salgdi.hxx
vcl/inc/vcl/salinst.hxx
vcl/inc/vcl/seleng.hxx
vcl/inc/vcl/settings.hxx
vcl/inc/vcl/smartid.hxx
vcl/inc/vcl/status.hxx
vcl/inc/vcl/strhelper.hxx
vcl/inc/vcl/svapp.hxx
vcl/inc/vcl/svdata.hxx
vcl/inc/vcl/syschild.hxx
vcl/inc/vcl/sysdata.hxx
vcl/inc/vcl/taskpanelist.hxx
vcl/inc/vcl/toolbox.hxx
vcl/inc/vcl/vclevent.hxx
vcl/inc/vcl/windata.hxx
vcl/inc/vcl/window.hxx
vcl/inc/vcl/wintypes.hxx
vcl/os2/source/app/salinst.cxx
vcl/os2/source/gdi/salgdi.cxx
vcl/os2/source/window/salmenu.cxx
vcl/os2/source/window/salobj.cxx
vcl/prj/build.lst
vcl/source/app/dbggui.cxx
vcl/source/app/help.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/settings.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/svmainhook.cxx
vcl/source/app/unohelp.cxx
vcl/source/app/vclevent.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/edit.cxx
vcl/source/control/field.cxx
vcl/source/control/fixed.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/imgctrl.cxx
vcl/source/control/makefile.mk
vcl/source/control/tabctrl.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap2.cxx
vcl/source/gdi/bitmap4.cxx
vcl/source/gdi/bmpconv.cxx
vcl/source/gdi/cvtsvm.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/impimage.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/gdi/outdev4.cxx
vcl/source/gdi/outdevnative.cxx
vcl/source/gdi/pdfwriter.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/print3.cxx
vcl/source/gdi/salmisc.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/helper/canvasbitmap.cxx
vcl/source/helper/smartid.cxx
vcl/source/helper/xconnection.cxx
vcl/source/src/btntext.src
vcl/source/src/images.src
vcl/source/src/print.src
vcl/source/window/accel.cxx
vcl/source/window/accmgr.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dlgctrl.cxx
vcl/source/window/javachild.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/printdlg.cxx
vcl/source/window/status.cxx
vcl/source/window/syschild.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/gtk/app/gtkdata.cxx
vcl/unx/gtk/app/gtkinst.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpbmp.hxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.cxx
vcl/unx/headless/svpprn.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/unx/headless/svptext.cxx
vcl/unx/inc/dtint.hxx
vcl/unx/inc/plugins/gtk/gtkdata.hxx
vcl/unx/inc/pspgraphics.h
vcl/unx/inc/salbmp.h
vcl/unx/inc/saldata.hxx
vcl/unx/inc/saldisp.hxx
vcl/unx/inc/salgdi.h
vcl/unx/inc/salinst.h
vcl/unx/inc/xfont.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde4/KDESalGraphics.cxx
vcl/unx/source/app/keysymnames.cxx
vcl/unx/source/app/saldata.cxx
vcl/unx/source/app/saldisp.cxx
vcl/unx/source/app/salinst.cxx
vcl/unx/source/app/wmadaptor.cxx
vcl/unx/source/dtrans/X11_selection.cxx
vcl/unx/source/dtrans/X11_service.cxx
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/gdi/pspgraphics.cxx
vcl/unx/source/gdi/salgdi.cxx
vcl/unx/source/gdi/salgdi3.cxx
vcl/unx/source/gdi/salprnpsp.cxx
vcl/unx/source/gdi/xfont.cxx
vcl/unx/source/gdi/xlfd_attr.cxx
vcl/unx/source/gdi/xlfd_attr.hxx
vcl/unx/source/gdi/xlfd_extd.cxx
vcl/unx/source/gdi/xlfd_extd.hxx
vcl/unx/source/gdi/xlfd_smpl.cxx
vcl/unx/source/gdi/xlfd_smpl.hxx
vcl/unx/source/printer/ppdparser.cxx
vcl/unx/source/printer/printerinfomanager.cxx
vcl/unx/source/window/salframe.cxx
vcl/unx/source/window/salmenu.cxx
vcl/unx/source/window/salobj.cxx
vcl/util/makefile2.pmk
vcl/win/inc/salbmp.h
vcl/win/inc/saldata.hxx
vcl/win/inc/salgdi.h
vcl/win/inc/salinst.h
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salobj.cxx
vcl/workben/outdevgrind.cxx
vos/inc/vos/execabl.hxx
vos/inc/vos/macros.hxx
vos/inc/vos/pipe.hxx
vos/inc/vos/process.hxx
vos/inc/vos/refernce.hxx
vos/inc/vos/signal.hxx
vos/inc/vos/socket.hxx
vos/inc/vos/stream.hxx
vos/inc/vos/thread.hxx
vos/source/pipe.cxx
vos/source/process.cxx
vos/source/signal.cxx
vos/source/thread.cxx
vos/source/timer.cxx
2011-03-11 14:24:23 +01:00
|
|
|
sal_Bool bSwitchToUCS2,
|
2010-10-05 07:57:54 -05:00
|
|
|
rtl_TextEncoding eEnc )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// If the string matches one of the following regular expressions then
|
|
|
|
// the document is a HTML document.
|
2000-09-18 16:07:07 +00:00
|
|
|
//
|
|
|
|
// ^[^<]*<[^ \t]*[> \t]
|
|
|
|
// -------
|
|
|
|
// ^<!
|
|
|
|
//
|
2011-04-22 22:13:32 +02:00
|
|
|
// where the underlined subexpression has to be a HTML token
|
2000-09-18 16:07:07 +00:00
|
|
|
ByteString sCmp;
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bUCS2B = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bSwitchToUCS2 )
|
|
|
|
{
|
2001-10-15 07:32:11 +00:00
|
|
|
if( 0xfeU == (sal_uChar)pHeader[0] &&
|
|
|
|
0xffU == (sal_uChar)pHeader[1] )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
eEnc = RTL_TEXTENCODING_UCS2;
|
2010-11-05 10:31:15 +08:00
|
|
|
bUCS2B = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-10-15 07:32:11 +00:00
|
|
|
else if( 0xffU == (sal_uChar)pHeader[0] &&
|
|
|
|
0xfeU == (sal_uChar)pHeader[1] )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
eEnc = RTL_TEXTENCODING_UCS2;
|
|
|
|
}
|
|
|
|
}
|
2009-01-21 15:28:14 +00:00
|
|
|
if
|
|
|
|
(
|
|
|
|
RTL_TEXTENCODING_UCS2 == eEnc &&
|
|
|
|
(
|
|
|
|
(0xfe == (sal_uChar)pHeader[0] && 0xff == (sal_uChar)pHeader[1]) ||
|
|
|
|
(0xff == (sal_uChar)pHeader[0] && 0xfe == (sal_uChar)pHeader[1])
|
|
|
|
)
|
|
|
|
)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-10-15 07:32:11 +00:00
|
|
|
if( 0xfe == (sal_uChar)pHeader[0] )
|
2010-11-05 10:31:15 +08:00
|
|
|
bUCS2B = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nLen;
|
|
|
|
for( nLen = 2;
|
|
|
|
pHeader[nLen] != 0 || pHeader[nLen+1] != 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
nLen+=2 )
|
|
|
|
;
|
|
|
|
|
2006-10-12 14:28:10 +00:00
|
|
|
::rtl::OStringBuffer sTmp( (nLen - 2)/2 );
|
|
|
|
for( xub_StrLen nPos = 2; nPos < nLen; nPos += 2 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
sal_Unicode cUC;
|
|
|
|
if( bUCS2B )
|
2006-10-12 14:28:10 +00:00
|
|
|
cUC = (sal_Unicode(pHeader[nPos]) << 8) | pHeader[nPos+1];
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2006-10-12 14:28:10 +00:00
|
|
|
cUC = (sal_Unicode(pHeader[nPos+1]) << 8) | pHeader[nPos];
|
2000-09-18 16:07:07 +00:00
|
|
|
if( 0U == cUC )
|
|
|
|
break;
|
|
|
|
|
|
|
|
sTmp.append( cUC < 256U ? (sal_Char)cUC : '.' );
|
|
|
|
}
|
|
|
|
sCmp = ByteString( sTmp.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sCmp = (sal_Char *)pHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
sCmp.ToUpperAscii();
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// A HTML document must have a '<' in the first line
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nStart = sCmp.Search( '<' );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( STRING_NOTFOUND == nStart )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
nStart++;
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// followed by arbitrary characters followed by a blank or '>'
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Char c;
|
2006-10-12 14:28:10 +00:00
|
|
|
xub_StrLen nPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
for( nPos = nStart; nPos<sCmp.Len(); nPos++ )
|
|
|
|
{
|
|
|
|
if( '>'==(c=sCmp.GetChar(nPos)) || HTML_ISSPACE(c) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// If the document ends after < it's no HTML
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nPos==nStart )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// the string following '<' has to be a known HTML token.
|
|
|
|
// <DIR> is not interpreted as HTML. Otherwise the output of the DOS command "DIR"
|
|
|
|
// could be interpreted as HTML.
|
2000-09-18 16:07:07 +00:00
|
|
|
String sTest( sCmp.Copy( nStart, nPos-nStart ), RTL_TEXTENCODING_ASCII_US );
|
|
|
|
int nTok = GetHTMLToken( sTest );
|
|
|
|
if( 0 != nTok && HTML_DIRLIST_ON != nTok )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// "<!" at the very beginning of the file?
|
2006-10-12 14:28:10 +00:00
|
|
|
if( nStart == 1 && '!' == sCmp.GetChar( 1 ) )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// <HTML> somewhere in the first 80 characters of the document
|
2009-04-27 11:24:10 +00:00
|
|
|
nStart = sCmp.Search( OOO_STRING_SVTOOLS_HTML_html );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nStart!=STRING_NOTFOUND &&
|
2006-10-12 14:28:10 +00:00
|
|
|
nStart>0 && '<'==sCmp.GetChar(nStart-1) &&
|
|
|
|
nStart+4 < sCmp.Len() && '>'==sCmp.GetChar(nStart+4) )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-04-22 22:13:32 +02:00
|
|
|
// Else it's rather not a HTML document
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool HTMLParser::InternalImgToPrivateURL( String& rURL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
if( rURL.Len() < 19 || 'i' != rURL.GetChar(0) ||
|
2009-04-27 11:24:10 +00:00
|
|
|
rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_internal_gopher, 9 ) != COMPARE_EQUAL )
|
2010-11-05 10:31:15 +08:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bFound = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-04-27 11:24:10 +00:00
|
|
|
if( rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_internal_gopher,16) == COMPARE_EQUAL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
String aName( rURL.Copy(16) );
|
|
|
|
switch( aName.GetChar(0) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case 'b':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_binary );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'i':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_image ) ||
|
|
|
|
aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_index );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'm':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_menu ) ||
|
|
|
|
aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_movie );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 's':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_sound );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 't':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_telnet ) ||
|
|
|
|
aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_text );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'u':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_GOPHER_unknown );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-04-27 11:24:10 +00:00
|
|
|
else if( rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_internal_icon,14) == COMPARE_EQUAL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-10-12 14:28:10 +00:00
|
|
|
String aName( rURL.Copy(14) );
|
|
|
|
switch( aName.GetChar(0) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case 'b':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_ICON_baddata );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'd':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_ICON_delayed );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'e':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_ICON_embed );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'i':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_ICON_insecure );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case 'n':
|
2009-04-27 11:24:10 +00:00
|
|
|
bFound = aName.EqualsAscii( OOO_STRING_SVTOOLS_HTML_INT_ICON_notfound );
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( bFound )
|
|
|
|
{
|
|
|
|
String sTmp ( rURL );
|
2009-04-27 11:24:10 +00:00
|
|
|
rURL.AssignAscii( OOO_STRING_SVTOOLS_HTML_private_image );
|
2000-09-18 16:07:07 +00:00
|
|
|
rURL.Append( sTmp );
|
|
|
|
}
|
|
|
|
|
|
|
|
return bFound;
|
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
enum eHtmlMetas {
|
|
|
|
HTML_META_NONE = 0,
|
|
|
|
HTML_META_AUTHOR,
|
|
|
|
HTML_META_DESCRIPTION,
|
|
|
|
HTML_META_KEYWORDS,
|
|
|
|
HTML_META_REFRESH,
|
|
|
|
HTML_META_CLASSIFICATION,
|
|
|
|
HTML_META_CREATED,
|
|
|
|
HTML_META_CHANGEDBY,
|
|
|
|
HTML_META_CHANGED,
|
|
|
|
HTML_META_GENERATOR,
|
|
|
|
HTML_META_SDFOOTNOTE,
|
|
|
|
HTML_META_SDENDNOTE,
|
|
|
|
HTML_META_CONTENT_TYPE
|
|
|
|
};
|
|
|
|
|
|
|
|
// <META NAME=xxx>
|
2010-12-12 10:14:17 +01:00
|
|
|
static HTMLOptionEnum const aHTMLMetaNameTable[] =
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
{
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_changedby, HTML_META_CHANGEDBY },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_classification,HTML_META_CLASSIFICATION},
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_content_type, HTML_META_CONTENT_TYPE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_created, HTML_META_CREATED },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_description, HTML_META_DESCRIPTION },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_keywords, HTML_META_KEYWORDS },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_generator, HTML_META_GENERATOR },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE },
|
|
|
|
{ OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE },
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void HTMLParser::AddMetaUserDefined( ::rtl::OUString const & )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HTMLParser::ParseMetaOptionsImpl(
|
|
|
|
const uno::Reference<document::XDocumentProperties> & i_xDocProps,
|
|
|
|
SvKeyValueIterator *i_pHTTPHeader,
|
|
|
|
const HTMLOptions *i_pOptions,
|
|
|
|
rtl_TextEncoding& o_rEnc )
|
|
|
|
{
|
|
|
|
String aName, aContent;
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nAction = HTML_META_NONE;
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
bool bHTTPEquiv = false, bChanged = false;
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
for ( sal_uInt16 i = i_pOptions->Count(); i; )
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
{
|
|
|
|
const HTMLOption *pOption = (*i_pOptions)[ --i ];
|
|
|
|
switch ( pOption->GetToken() )
|
|
|
|
{
|
|
|
|
case HTML_O_NAME:
|
|
|
|
aName = pOption->GetString();
|
|
|
|
if ( HTML_META_NONE==nAction )
|
|
|
|
{
|
|
|
|
pOption->GetEnum( nAction, aHTMLMetaNameTable );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HTML_O_HTTPEQUIV:
|
|
|
|
aName = pOption->GetString();
|
|
|
|
pOption->GetEnum( nAction, aHTMLMetaNameTable );
|
|
|
|
bHTTPEquiv = true;
|
|
|
|
break;
|
|
|
|
case HTML_O_CONTENT:
|
|
|
|
aContent = pOption->GetString();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bHTTPEquiv || HTML_META_DESCRIPTION != nAction )
|
|
|
|
{
|
|
|
|
// if it is not a Description, remove CRs and LFs from CONTENT
|
|
|
|
aContent.EraseAllChars( _CR );
|
|
|
|
aContent.EraseAllChars( _LF );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// convert line endings for Description
|
|
|
|
aContent.ConvertLineEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( bHTTPEquiv && i_pHTTPHeader )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
// Netscape seems to just ignore a closing ", so we do too
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
if ( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) )
|
|
|
|
{
|
|
|
|
aContent.Erase( aContent.Len() - 1 );
|
|
|
|
}
|
|
|
|
SvKeyValue aKeyValue( aName, aContent );
|
|
|
|
i_pHTTPHeader->Append( aKeyValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( nAction )
|
|
|
|
{
|
|
|
|
case HTML_META_AUTHOR:
|
|
|
|
if (i_xDocProps.is()) {
|
|
|
|
i_xDocProps->setAuthor( aContent );
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HTML_META_DESCRIPTION:
|
|
|
|
if (i_xDocProps.is()) {
|
|
|
|
i_xDocProps->setDescription( aContent );
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HTML_META_KEYWORDS:
|
|
|
|
if (i_xDocProps.is()) {
|
|
|
|
i_xDocProps->setKeywords(
|
|
|
|
::comphelper::string::convertCommaSeparated(aContent));
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HTML_META_CLASSIFICATION:
|
|
|
|
if (i_xDocProps.is()) {
|
|
|
|
i_xDocProps->setSubject( aContent );
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_META_CHANGEDBY:
|
|
|
|
if (i_xDocProps.is()) {
|
|
|
|
i_xDocProps->setModifiedBy( aContent );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_META_CREATED:
|
|
|
|
case HTML_META_CHANGED:
|
|
|
|
if ( i_xDocProps.is() && aContent.Len() &&
|
|
|
|
aContent.GetTokenCount() == 2 )
|
|
|
|
{
|
2011-01-12 15:56:50 +01:00
|
|
|
Date aDate( (sal_uLong)aContent.GetToken(0).ToInt32() );
|
|
|
|
Time aTime( (sal_uLong)aContent.GetToken(1).ToInt32() );
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
DateTime aDateTime( aDate, aTime );
|
|
|
|
::util::DateTime uDT(aDateTime.Get100Sec(),
|
|
|
|
aDateTime.GetSec(), aDateTime.GetMin(),
|
|
|
|
aDateTime.GetHour(), aDateTime.GetDay(),
|
|
|
|
aDateTime.GetMonth(), aDateTime.GetYear());
|
|
|
|
if ( HTML_META_CREATED==nAction )
|
|
|
|
i_xDocProps->setCreationDate( uDT );
|
|
|
|
else
|
|
|
|
i_xDocProps->setModificationDate( uDT );
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_META_REFRESH:
|
|
|
|
DBG_ASSERT( !bHTTPEquiv || i_pHTTPHeader,
|
|
|
|
"Reload-URL aufgrund unterlassener MUSS-Aenderung verlorengegangen" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_META_CONTENT_TYPE:
|
|
|
|
if ( aContent.Len() )
|
|
|
|
{
|
|
|
|
o_rEnc = GetEncodingByMIME( aContent );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HTML_META_NONE:
|
|
|
|
if ( !bHTTPEquiv )
|
|
|
|
{
|
|
|
|
if (i_xDocProps.is())
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertyContainer> xUDProps
|
|
|
|
= i_xDocProps->getUserDefinedProperties();
|
|
|
|
try {
|
|
|
|
xUDProps->addProperty(aName,
|
|
|
|
beans::PropertyAttribute::REMOVEABLE,
|
|
|
|
uno::makeAny(::rtl::OUString(aContent)));
|
|
|
|
AddMetaUserDefined(aName);
|
|
|
|
bChanged = true;
|
|
|
|
} catch (uno::Exception &) {
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HTMLParser::ParseMetaOptions(
|
|
|
|
const uno::Reference<document::XDocumentProperties> & i_xDocProps,
|
|
|
|
SvKeyValueIterator *i_pHeader )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nContentOption = HTML_O_CONTENT;
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
|
|
|
|
|
|
|
|
bool bRet = ParseMetaOptionsImpl( i_xDocProps, i_pHeader,
|
|
|
|
GetOptions(&nContentOption),
|
|
|
|
eEnc );
|
|
|
|
|
|
|
|
// If the encoding is set by a META tag, it may only overwrite the
|
2010-11-05 10:31:15 +08:00
|
|
|
// current encoding if both, the current and the new encoding, are 1-sal_uInt8
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
// encodings. Everything else cannot lead to reasonable results.
|
|
|
|
if (RTL_TEXTENCODING_DONTKNOW != eEnc &&
|
|
|
|
rtl_isOctetTextEncoding( eEnc ) &&
|
|
|
|
rtl_isOctetTextEncoding( GetSrcEncoding() ) )
|
|
|
|
{
|
2011-04-22 22:13:32 +02:00
|
|
|
eEnc = GetExtendedCompatibilityTextEncoding( eEnc );
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
SetSrcEncoding( eEnc );
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime )
|
|
|
|
{
|
|
|
|
ByteString sType;
|
|
|
|
ByteString sSubType;
|
|
|
|
INetContentTypeParameterList aParameters;
|
|
|
|
ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US );
|
|
|
|
if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters))
|
|
|
|
{
|
|
|
|
const INetContentTypeParameter * pCharset
|
|
|
|
= aParameters.find("charset");
|
|
|
|
if (pCharset != 0)
|
|
|
|
{
|
|
|
|
ByteString sValue( pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US );
|
|
|
|
return GetExtendedCompatibilityTextEncoding(
|
|
|
|
rtl_getTextEncodingFromMimeCharset( sValue.GetBuffer() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return RTL_TEXTENCODING_DONTKNOW;
|
|
|
|
}
|
|
|
|
|
2009-12-10 23:18:57 +01:00
|
|
|
rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader )
|
|
|
|
{
|
|
|
|
rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW;
|
|
|
|
if( pHTTPHeader )
|
|
|
|
{
|
|
|
|
SvKeyValue aKV;
|
2010-11-05 10:31:15 +08:00
|
|
|
for( sal_Bool bCont = pHTTPHeader->GetFirst( aKV ); bCont;
|
2009-12-10 23:18:57 +01:00
|
|
|
bCont = pHTTPHeader->GetNext( aKV ) )
|
|
|
|
{
|
|
|
|
if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) )
|
|
|
|
{
|
|
|
|
if( aKV.GetValue().Len() )
|
|
|
|
{
|
|
|
|
eRet = HTMLParser::GetEncodingByMIME( aKV.GetValue() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return eRet;
|
|
|
|
}
|
|
|
|
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool HTMLParser::SetEncodingByHTTPHeader(
|
2009-12-10 23:18:57 +01:00
|
|
|
SvKeyValueIterator *pHTTPHeader )
|
|
|
|
{
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_Bool bRet = sal_False;
|
2009-12-10 23:18:57 +01:00
|
|
|
rtl_TextEncoding eEnc = HTMLParser::GetEncodingByHttpHeader( pHTTPHeader );
|
|
|
|
if(RTL_TEXTENCODING_DONTKNOW != eEnc)
|
|
|
|
{
|
|
|
|
SetSrcEncoding( eEnc );
|
2010-11-05 10:31:15 +08:00
|
|
|
bRet = sal_True;
|
2009-12-10 23:18:57 +01:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|