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
15174177
Kaydet (Commit)
15174177
authored
Mar 09, 2015
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
detect MSO 2007 OOXML documents
Change-Id: I4052c6f1e5dde71ce4cede1ec9a313f461861d71
üst
180e1de3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
xmlfilterbase.hxx
include/oox/core/xmlfilterbase.hxx
+2
-0
xmlfilterbase.cxx
oox/source/core/xmlfilterbase.cxx
+39
-2
No files found.
include/oox/core/xmlfilterbase.hxx
Dosyayı görüntüle @
15174177
...
@@ -234,6 +234,8 @@ public:
...
@@ -234,6 +234,8 @@ public:
FastParser
*
createParser
()
const
;
FastParser
*
createParser
()
const
;
bool
isMSO2007Document
()
const
;
protected
:
protected
:
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
io
::
XInputStream
>
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
io
::
XInputStream
>
implGetInputStream
(
utl
::
MediaDescriptor
&
rMediaDesc
)
const
SAL_OVERRIDE
;
implGetInputStream
(
utl
::
MediaDescriptor
&
rMediaDesc
)
const
SAL_OVERRIDE
;
...
...
oox/source/core/xmlfilterbase.cxx
Dosyayı görüntüle @
15174177
...
@@ -206,7 +206,8 @@ XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext )
...
@@ -206,7 +206,8 @@ XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext )
FilterBase
(
rxContext
),
FilterBase
(
rxContext
),
mxImpl
(
new
XmlFilterBaseImpl
(
rxContext
)
),
mxImpl
(
new
XmlFilterBaseImpl
(
rxContext
)
),
mnRelId
(
1
),
mnRelId
(
1
),
mnMaxDocId
(
0
)
mnMaxDocId
(
0
),
mbMSO2007
(
false
)
{
{
}
}
...
@@ -222,6 +223,35 @@ XmlFilterBase::~XmlFilterBase()
...
@@ -222,6 +223,35 @@ XmlFilterBase::~XmlFilterBase()
mxImpl
->
maFastParser
.
setDocumentHandler
(
0
);
mxImpl
->
maFastParser
.
setDocumentHandler
(
0
);
}
}
namespace
{
bool
is2007MSODocument
(
Reference
<
XDocumentProperties
>
xDocProps
)
{
if
(
!
xDocProps
->
getGenerator
().
startsWithIgnoreAsciiCase
(
"Microsoft"
))
return
false
;
uno
::
Reference
<
beans
::
XPropertyAccess
>
xUserDefProps
(
xDocProps
->
getUserDefinedProperties
(),
uno
::
UNO_QUERY
);
if
(
!
xUserDefProps
.
is
())
return
false
;
comphelper
::
SequenceAsHashMap
aUserDefinedProperties
(
xUserDefProps
->
getPropertyValues
());
comphelper
::
SequenceAsHashMap
::
iterator
it
=
aUserDefinedProperties
.
find
(
"AppVersion"
);
if
(
it
==
aUserDefinedProperties
.
end
())
return
false
;
OUString
aValue
;
if
(
!
(
it
->
second
>>=
aValue
))
return
false
;
if
(
!
aValue
.
startsWithIgnoreAsciiCase
(
"12."
))
return
false
;
SAL_WARN
(
"oox"
,
"a MSO 2007 document"
);
return
true
;
}
}
void
XmlFilterBase
::
importDocumentProperties
()
void
XmlFilterBase
::
importDocumentProperties
()
{
{
Reference
<
XMultiServiceFactory
>
xFactory
(
getComponentContext
()
->
getServiceManager
(),
UNO_QUERY
);
Reference
<
XMultiServiceFactory
>
xFactory
(
getComponentContext
()
->
getServiceManager
(),
UNO_QUERY
);
...
@@ -238,7 +268,9 @@ void XmlFilterBase::importDocumentProperties()
...
@@ -238,7 +268,9 @@ void XmlFilterBase::importDocumentProperties()
xContext
);
xContext
);
Reference
<
XOOXMLDocumentPropertiesImporter
>
xImporter
(
xTemp
,
UNO_QUERY
);
Reference
<
XOOXMLDocumentPropertiesImporter
>
xImporter
(
xTemp
,
UNO_QUERY
);
Reference
<
XDocumentPropertiesSupplier
>
xPropSupplier
(
xModel
,
UNO_QUERY
);
Reference
<
XDocumentPropertiesSupplier
>
xPropSupplier
(
xModel
,
UNO_QUERY
);
xImporter
->
importProperties
(
xDocumentStorage
,
xPropSupplier
->
getDocumentProperties
()
);
Reference
<
XDocumentProperties
>
xDocProps
=
xPropSupplier
->
getDocumentProperties
();
xImporter
->
importProperties
(
xDocumentStorage
,
xDocProps
);
mbMSO2007
=
is2007MSODocument
(
xDocProps
);
}
}
FastParser
*
XmlFilterBase
::
createParser
()
const
FastParser
*
XmlFilterBase
::
createParser
()
const
...
@@ -880,6 +912,11 @@ StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutSt
...
@@ -880,6 +912,11 @@ StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutSt
return
StorageRef
(
new
ZipStorage
(
getComponentContext
(),
rxOutStream
)
);
return
StorageRef
(
new
ZipStorage
(
getComponentContext
(),
rxOutStream
)
);
}
}
bool
XmlFilterBase
::
isMSO2007Document
()
const
{
return
mbMSO2007
;
}
}
// namespace core
}
// namespace core
}
// namespace oox
}
// namespace oox
...
...
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