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
fcb1e4d8
Kaydet (Commit)
fcb1e4d8
authored
Şub 13, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#60471: svgio, sax: enable internal entity declarations for SVG
Change-Id: I147acac61dfe0b626268fe1e600dcf641ca63a0c
üst
2f4bd9d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
+41
-10
sax_expat.cxx
sax/source/expatwrap/sax_expat.cxx
+32
-10
xsvgparser.cxx
svgio/source/svguno/xsvgparser.cxx
+9
-0
No files found.
sax/source/expatwrap/sax_expat.cxx
Dosyayı görüntüle @
fcb1e4d8
...
...
@@ -24,7 +24,7 @@
#include <osl/diagnose.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/
util/XCloneable
.hpp>
#include <com/sun/star/
lang/XInitialization
.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
...
...
@@ -32,8 +32,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <expat.h>
...
...
@@ -45,7 +44,6 @@ using namespace ::com::sun::star::uno;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
registry
;
using
namespace
::
com
::
sun
::
star
::
xml
::
sax
;
using
namespace
::
com
::
sun
::
star
::
util
;
using
namespace
::
com
::
sun
::
star
::
io
;
#include "factory.hxx"
...
...
@@ -136,11 +134,10 @@ class SaxExpatParser_Impl;
// This class implements the external Parser interface
class
SaxExpatParser
:
public
WeakImplHelper2
<
XParser
,
XServiceInfo
>
class
SaxExpatParser
:
public
WeakImplHelper3
<
XInitialization
,
XServiceInfo
,
XParser
>
{
public
:
...
...
@@ -153,6 +150,10 @@ public:
static
Sequence
<
OUString
>
getSupportedServiceNames_Static
(
void
)
throw
();
public
:
// ::com::sun::star::lang::XInitialization:
virtual
void
SAL_CALL
initialize
(
Sequence
<
Any
>
const
&
rArguments
)
throw
(
RuntimeException
,
Exception
);
// The SAX-Parser-Interface
virtual
void
SAL_CALL
parseStream
(
const
InputSource
&
structSource
)
throw
(
SAXException
,
...
...
@@ -222,6 +223,7 @@ class SaxExpatParser_Impl
public
:
// module scope
Mutex
aMutex
;
OUString
sCDATA
;
bool
m_bEnableDoS
;
// fdo#60471 thank you Adobe Illustrator
Reference
<
XDocumentHandler
>
rDocumentHandler
;
Reference
<
XExtendedDocumentHandler
>
rExtendedDocumentHandler
;
...
...
@@ -257,6 +259,7 @@ public: // module scope
public
:
SaxExpatParser_Impl
()
:
sCDATA
(
"CDATA"
)
,
m_bEnableDoS
(
false
)
{
}
...
...
@@ -452,6 +455,22 @@ SaxExpatParser::~SaxExpatParser()
delete
m_pImpl
;
}
// ::com::sun::star::lang::XInitialization:
void
SAL_CALL
SaxExpatParser
::
initialize
(
Sequence
<
Any
>
const
&
rArguments
)
throw
(
RuntimeException
,
Exception
)
{
// possible arguments: a string "DoSmeplease"
if
(
rArguments
.
getLength
())
{
OUString
str
;
if
((
rArguments
[
0
]
>>=
str
)
&&
"DoSmeplease"
==
str
)
{
MutexGuard
guard
(
m_pImpl
->
aMutex
);
m_pImpl
->
m_bEnableDoS
=
true
;
}
}
}
/***************
*
...
...
@@ -500,7 +519,10 @@ void SaxExpatParser::parseStream( const InputSource& structSource)
XML_SetCharacterDataHandler
(
entity
.
pParser
,
call_callbackCharacters
);
XML_SetProcessingInstructionHandler
(
entity
.
pParser
,
call_callbackProcessingInstruction
);
XML_SetEntityDeclHandler
(
entity
.
pParser
,
call_callbackEntityDecl
);
if
(
!
m_pImpl
->
m_bEnableDoS
)
{
XML_SetEntityDeclHandler
(
entity
.
pParser
,
call_callbackEntityDecl
);
}
XML_SetNotationDeclHandler
(
entity
.
pParser
,
call_callbackNotationDecl
);
XML_SetExternalEntityRefHandler
(
entity
.
pParser
,
call_callbackExternalEntityRef
);
...
...
svgio/source/svguno/xsvgparser.cxx
Dosyayı görüntüle @
fcb1e4d8
...
...
@@ -21,6 +21,7 @@
#include <com/sun/star/graphic/XSvgParser.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <cppuhelper/implbase2.hxx>
#include <svgio/svgreader/svgdocumenthandler.hxx>
#include <com/sun/star/xml/sax/XParser.hpp>
...
...
@@ -131,6 +132,14 @@ namespace svgio
// get parser
uno
::
Reference
<
xml
::
sax
::
XParser
>
xParser
(
xml
::
sax
::
Parser
::
create
(
context_
));
// fdo#60471 need to enable internal entities because
// certain ... popular proprietary products write SVG files
// that use entities to define XML namespaces.
uno
::
Reference
<
lang
::
XInitialization
>
const
xInit
(
xParser
,
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
uno
::
Any
>
args
(
1
);
args
[
0
]
<<=
OUString
(
"DoSmeplease"
);
xInit
->
initialize
(
args
);
// connect parser and filter
xParser
->
setDocumentHandler
(
xSvgDocHdl
);
...
...
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