Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
8ebb30fb
Kaydet (Commit)
8ebb30fb
authored
Tem 22, 2011
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Converted HTMLOptions to boost::ptr_vector.
üst
7e88c5ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
45 deletions
+38
-45
parhtml.hxx
svtools/inc/svtools/parhtml.hxx
+8
-6
htmlsupp.cxx
svtools/source/svhtml/htmlsupp.cxx
+11
-11
parhtml.cxx
svtools/source/svhtml/parhtml.cxx
+19
-28
No files found.
svtools/inc/svtools/parhtml.hxx
Dosyayı görüntüle @
8ebb30fb
...
...
@@ -35,6 +35,7 @@
#include <svl/svarray.hxx>
#include <svtools/svparser.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
namespace
com
{
namespace
sun
{
namespace
star
{
namespace
document
{
...
...
@@ -130,11 +131,13 @@ public:
//SvxAdjust GetAdjust() const; // <P,TH,TD ALIGN=>
};
typedef
HTMLOption
*
HTMLOptionPtr
;
SV_DECL_PTRARR
(
HTMLOptions
,
HTMLOptionPtr
,
16
,
16
)
typedef
::
boost
::
ptr_vector
<
HTMLOption
>
HTMLOptions
;
class
SVT_DLLPUBLIC
HTMLParser
:
public
SvParser
{
private
:
mutable
HTMLOptions
maOptions
;
// die Optionen des Start-Tags
bool
bNewDoc
:
1
;
// neues Doc lesen ?
bool
bIsInHeader
:
1
;
// scanne Header-Bereich
bool
bIsInBody
:
1
;
// scanne Body-Bereich
...
...
@@ -152,7 +155,6 @@ class SVT_DLLPUBLIC HTMLParser : public SvParser
sal_uInt32
nPre_LinePos
;
// Pos in der Line im PRE-Tag
HTMLOptions
*
pOptions
;
// die Optionen des Start-Tags
String
aEndToken
;
protected
:
...
...
@@ -223,7 +225,7 @@ public:
// Ermitteln der Optionen. pNoConvertToken ist das optionale Token
// einer Option, fuer die CR/LFs nicht aus dem Wert der Option
// geloescht werden.
const
HTMLOptions
*
GetOptions
(
sal_uInt16
*
pNoConvertToken
=
0
)
const
;
const
HTMLOptions
&
GetOptions
(
sal_uInt16
*
pNoConvertToken
=
0
)
const
;
// fuers asynchrone lesen aus dem SvStream
virtual
void
Continue
(
int
nToken
);
...
...
@@ -241,7 +243,7 @@ private:
bool
ParseMetaOptionsImpl
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
document
::
XDocumentProperties
>&
,
SvKeyValueIterator
*
,
const
HTMLOptions
*
,
const
HTMLOptions
&
,
rtl_TextEncoding
&
rEnc
);
public
:
...
...
@@ -259,7 +261,7 @@ public:
bool
bSwitchToUCS2
=
false
,
rtl_TextEncoding
eEnc
=
RTL_TEXTENCODING_DONTKNOW
);
sal_B
ool
ParseScriptOptions
(
String
&
rLangString
,
const
String
&
,
HTMLScriptLanguage
&
rLang
,
b
ool
ParseScriptOptions
(
String
&
rLangString
,
const
String
&
,
HTMLScriptLanguage
&
rLang
,
String
&
rSrc
,
String
&
rLibrary
,
String
&
rModule
);
// Einen Kommentar um den Inhalt von <SCRIPT> oder <STYLE> entfernen
...
...
svtools/source/svhtml/htmlsupp.cxx
Dosyayı görüntüle @
8ebb30fb
...
...
@@ -51,13 +51,13 @@ static HTMLOptionEnum const aScriptLangOptEnums[] =
{
0
,
0
}
};
sal_B
ool
HTMLParser
::
ParseScriptOptions
(
String
&
rLangString
,
const
String
&
rBaseURL
,
b
ool
HTMLParser
::
ParseScriptOptions
(
String
&
rLangString
,
const
String
&
rBaseURL
,
HTMLScriptLanguage
&
rLang
,
String
&
rSrc
,
String
&
rLibrary
,
String
&
rModule
)
{
const
HTMLOptions
*
p
ScriptOptions
=
GetOptions
();
const
HTMLOptions
&
a
ScriptOptions
=
GetOptions
();
rLangString
.
Erase
();
rLang
=
HTML_SL_JAVASCRIPT
;
...
...
@@ -65,16 +65,16 @@ sal_Bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBas
rLibrary
.
Erase
();
rModule
.
Erase
();
for
(
s
al_uInt16
i
=
pScriptOptions
->
Count
();
i
;
)
for
(
s
ize_t
i
=
aScriptOptions
.
size
();
i
;
)
{
const
HTMLOption
*
pOption
=
(
*
pScriptOptions
)[
--
i
];
switch
(
pOption
->
GetToken
()
)
const
HTMLOption
&
aOption
=
aScriptOptions
[
--
i
];
switch
(
aOption
.
GetToken
()
)
{
case
HTML_O_LANGUAGE
:
{
rLangString
=
pOption
->
GetString
();
rLangString
=
aOption
.
GetString
();
sal_uInt16
nLang
;
if
(
pOption
->
GetEnum
(
nLang
,
aScriptLangOptEnums
)
)
if
(
aOption
.
GetEnum
(
nLang
,
aScriptLangOptEnums
)
)
rLang
=
(
HTMLScriptLanguage
)
nLang
;
else
rLang
=
HTML_SL_UNKNOWN
;
...
...
@@ -82,19 +82,19 @@ sal_Bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBas
break
;
case
HTML_O_SRC
:
rSrc
=
INetURLObject
::
GetAbsURL
(
rBaseURL
,
pOption
->
GetString
()
);
rSrc
=
INetURLObject
::
GetAbsURL
(
rBaseURL
,
aOption
.
GetString
()
);
break
;
case
HTML_O_SDLIBRARY
:
rLibrary
=
pOption
->
GetString
();
rLibrary
=
aOption
.
GetString
();
break
;
case
HTML_O_SDMODULE
:
rModule
=
pOption
->
GetString
();
rModule
=
aOption
.
GetString
();
break
;
}
}
return
sal_T
rue
;
return
t
rue
;
}
void
HTMLParser
::
RemoveSGMLComment
(
String
&
rString
,
sal_Bool
bFull
)
...
...
svtools/source/svhtml/parhtml.cxx
Dosyayı görüntüle @
8ebb30fb
...
...
@@ -52,6 +52,7 @@
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
#include <memory>
using
namespace
::
com
::
sun
::
star
;
...
...
@@ -108,10 +109,6 @@ static HTMLOptionEnum const aTableRulesOptEnums[] =
{
0
,
0
}
};
SV_IMPL_PTRARR
(
HTMLOptions
,
HTMLOptionPtr
)
sal_uInt16
HTMLOption
::
GetEnum
(
const
HTMLOptionEnum
*
pOptEnums
,
sal_uInt16
nDflt
)
const
{
sal_uInt16
nValue
=
nDflt
;
...
...
@@ -323,17 +320,12 @@ HTMLParser::HTMLParser( SvStream& rIn, bool bReadNewDoc ) :
bReadNextChar
(
false
),
bReadComment
(
false
)
{
pOptions
=
new
HTMLOptions
;
//#i76649, default to UTF-8 for HTML unless we know differently
SetSrcEncoding
(
RTL_TEXTENCODING_UTF8
);
}
HTMLParser
::~
HTMLParser
()
{
if
(
pOptions
&&
pOptions
->
Count
()
)
pOptions
->
DeleteAndDestroy
(
0
,
pOptions
->
Count
()
);
delete
pOptions
;
}
SvParserState
HTMLParser
::
CallParser
()
...
...
@@ -1085,8 +1077,8 @@ int HTMLParser::_GetNextToken()
sSaveToken
.
Erase
();
// Delete options
if
(
pOptions
->
Count
()
)
pOptions
->
DeleteAndDestroy
(
0
,
pOptions
->
Count
()
);
if
(
!
maOptions
.
empty
()
)
maOptions
.
clear
(
);
if
(
!
IsParserWorking
()
)
// Don't continue if already an error occured
return
0
;
...
...
@@ -1459,12 +1451,12 @@ void HTMLParser::UnescapeToken()
}
}
const
HTMLOptions
*
HTMLParser
::
GetOptions
(
sal_uInt16
*
pNoConvertToken
)
const
const
HTMLOptions
&
HTMLParser
::
GetOptions
(
sal_uInt16
*
pNoConvertToken
)
const
{
// If the options for the current token have already been returned,
// return them once again.
if
(
pOptions
->
Count
()
)
return
p
Options
;
if
(
!
maOptions
.
empty
()
)
return
ma
Options
;
xub_StrLen
nPos
=
0
;
while
(
nPos
<
aToken
.
Len
()
)
...
...
@@ -1613,11 +1605,10 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const
}
// Token is known and can be saved
HTMLOption
*
pOption
=
new
HTMLOption
(
sal
::
static_int_cast
<
sal_uInt16
>
(
nToken
),
sName
,
aValue
);
std
::
auto_ptr
<
HTMLOption
>
pOption
(
new
HTMLOption
(
sal
::
static_int_cast
<
sal_uInt16
>
(
nToken
),
sName
,
aValue
));
pOptions
->
Insert
(
pOption
,
pOptions
->
Count
()
);
maOptions
.
push_back
(
pOption
);
}
else
...
...
@@ -1625,7 +1616,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const
nPos
++
;
}
return
p
Options
;
return
ma
Options
;
}
int
HTMLParser
::
FilterPRE
(
int
nToken
)
...
...
@@ -2100,32 +2091,32 @@ void HTMLParser::AddMetaUserDefined( ::rtl::OUString const & )
bool
HTMLParser
::
ParseMetaOptionsImpl
(
const
uno
::
Reference
<
document
::
XDocumentProperties
>
&
i_xDocProps
,
SvKeyValueIterator
*
i_pHTTPHeader
,
const
HTMLOptions
*
i_p
Options
,
const
HTMLOptions
&
a
Options
,
rtl_TextEncoding
&
o_rEnc
)
{
String
aName
,
aContent
;
sal_uInt16
nAction
=
HTML_META_NONE
;
bool
bHTTPEquiv
=
false
,
bChanged
=
false
;
for
(
s
al_uInt16
i
=
i_pOptions
->
Count
();
i
;
)
for
(
s
ize_t
i
=
aOptions
.
size
();
i
;
)
{
const
HTMLOption
*
pOption
=
(
*
i_pOptions
)[
--
i
];
switch
(
pOption
->
GetToken
()
)
const
HTMLOption
&
aOption
=
aOptions
[
--
i
];
switch
(
aOption
.
GetToken
()
)
{
case
HTML_O_NAME
:
aName
=
pOption
->
GetString
();
aName
=
aOption
.
GetString
();
if
(
HTML_META_NONE
==
nAction
)
{
pOption
->
GetEnum
(
nAction
,
aHTMLMetaNameTable
);
aOption
.
GetEnum
(
nAction
,
aHTMLMetaNameTable
);
}
break
;
case
HTML_O_HTTPEQUIV
:
aName
=
pOption
->
GetString
();
pOption
->
GetEnum
(
nAction
,
aHTMLMetaNameTable
);
aName
=
aOption
.
GetString
();
aOption
.
GetEnum
(
nAction
,
aHTMLMetaNameTable
);
bHTTPEquiv
=
true
;
break
;
case
HTML_O_CONTENT
:
aContent
=
pOption
->
GetString
();
aContent
=
aOption
.
GetString
();
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment