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
6ba394e6
Kaydet (Commit)
6ba394e6
authored
Şub 28, 2014
tarafından
Markus Mohrhard
Kaydeden (comit)
Markus Mohrhard
Mar 01, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
handle OOXML strict namespaces
Change-Id: I198862388426161e3f054a5f128639c59f3c9d24
üst
a143beb3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
283 additions
and
5 deletions
+283
-5
namespacemap.hxx
include/oox/token/namespacemap.hxx
+10
-1
CustomTarget_generated.mk
oox/CustomTarget_generated.mk
+2
-0
fastparser.cxx
oox/source/core/fastparser.cxx
+17
-2
filterdetect.cxx
oox/source/core/filterdetect.cxx
+2
-1
namespacemap.cxx
oox/source/token/namespacemap.cxx
+11
-1
namespaces-strict.hxx.head
oox/source/token/namespaces-strict.hxx.head
+27
-0
namespaces-strict.hxx.tail
oox/source/token/namespaces-strict.hxx.tail
+62
-0
namespaces-strict.pl
oox/source/token/namespaces-strict.pl
+70
-0
namespaces-strict.txt
oox/source/token/namespaces-strict.txt
+82
-0
No files found.
include/oox/token/namespacemap.hxx
Dosyayı görüntüle @
6ba394e6
...
...
@@ -29,7 +29,16 @@ namespace oox {
// ============================================================================
/** A map that contains all XML namespace URLs used in the filters. */
struct
NamespaceMap
:
public
::
std
::
map
<
sal_Int32
,
OUString
>
{
NamespaceMap
();
};
struct
NamespaceMap
{
std
::
map
<
sal_Int32
,
OUString
>
maTransitionalNamespaceMap
;
std
::
map
<
sal_Int32
,
OUString
>
maStrictNamespaceMap
;
NamespaceMap
();
typedef
std
::
map
<
sal_Int32
,
OUString
>::
iterator
iterator
;
typedef
std
::
map
<
sal_Int32
,
OUString
>::
const_iterator
const_iterator
;
};
/** Thread-save singleton of a map of all supported XML namespace URLs. */
struct
StaticNamespaceMap
:
public
::
rtl
::
Static
<
NamespaceMap
,
StaticNamespaceMap
>
{};
...
...
oox/CustomTarget_generated.mk
Dosyayı görüntüle @
6ba394e6
...
...
@@ -43,6 +43,7 @@ $(oox_GENHEADERPATH)/$(1).hxx : $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt \
endef
$(eval $(call oox_GenTarget,namespaces,namespace,namespaces.txt))
$(eval $(call oox_GenTarget,namespaces-strict,namespace-strict,namespaces-strict.txt))
$(eval $(call oox_GenTarget,properties,property,))
$(eval $(call oox_GenTarget,tokens,token,tokenhash.gperf))
...
...
@@ -54,6 +55,7 @@ $(call gb_CustomTarget_get_target,oox/generated) : \
$(oox_INC)/propertynames.inc \
$(oox_GENHEADERPATH)/tokens.hxx \
$(oox_GENHEADERPATH)/namespaces.hxx \
$(oox_GENHEADERPATH)/namespaces-strict.hxx \
$(oox_GENHEADERPATH)/properties.hxx \
$(oox_MISC)/namespaces.txt \
...
...
oox/source/core/fastparser.cxx
Dosyayı görüntüle @
6ba394e6
...
...
@@ -94,11 +94,19 @@ void FastParser::registerNamespace( sal_Int32 nNamespaceId ) throw( IllegalArgum
if
(
!
mxParser
.
is
()
)
throw
RuntimeException
();
const
OUString
*
pNamespaceUrl
=
ContainerHelper
::
getMapElement
(
mrNamespaceMap
,
nNamespaceId
);
// add handling for OOXML strict here
const
OUString
*
pNamespaceUrl
=
ContainerHelper
::
getMapElement
(
mrNamespaceMap
.
maTransitionalNamespaceMap
,
nNamespaceId
);
if
(
!
pNamespaceUrl
)
throw
IllegalArgumentException
();
mxParser
->
registerNamespace
(
*
pNamespaceUrl
,
nNamespaceId
);
//also register the OOXML strict namespaces for the same id
const
OUString
*
pNamespaceStrictUrl
=
ContainerHelper
::
getMapElement
(
mrNamespaceMap
.
maStrictNamespaceMap
,
nNamespaceId
);
if
(
pNamespaceStrictUrl
&&
(
*
pNamespaceUrl
!=
*
pNamespaceStrictUrl
))
{
mxParser
->
registerNamespace
(
*
pNamespaceStrictUrl
,
nNamespaceId
);
}
}
void
FastParser
::
setDocumentHandler
(
const
Reference
<
XFastDocumentHandler
>&
rxDocHandler
)
throw
(
RuntimeException
)
...
...
@@ -150,9 +158,16 @@ bool FastParser::hasNamespaceURL( const OUString& rPrefix ) const
sal_Int32
FastParser
::
getNamespaceId
(
const
OUString
&
rUrl
)
{
for
(
NamespaceMap
::
const_iterator
aIt
=
mrNamespaceMap
.
begin
(),
aEnd
=
mrNamespaceMap
.
end
();
aIt
!=
aEnd
;
++
aIt
)
for
(
NamespaceMap
::
const_iterator
aIt
=
mrNamespaceMap
.
maTransitionalNamespaceMap
.
begin
(),
aEnd
=
mrNamespaceMap
.
maTransitionalNamespaceMap
.
end
();
aIt
!=
aEnd
;
++
aIt
)
if
(
rUrl
==
aIt
->
second
)
return
aIt
->
first
;
for
(
NamespaceMap
::
const_iterator
aIt
=
mrNamespaceMap
.
maStrictNamespaceMap
.
begin
(),
aEnd
=
mrNamespaceMap
.
maStrictNamespaceMap
.
end
();
aIt
!=
aEnd
;
++
aIt
)
if
(
rUrl
==
aIt
->
second
)
return
aIt
->
first
;
return
0
;
}
...
...
oox/source/core/filterdetect.cxx
Dosyayı görüntüle @
6ba394e6
...
...
@@ -155,7 +155,8 @@ void SAL_CALL FilterDetectDocHandler::processingInstruction(
void
FilterDetectDocHandler
::
parseRelationship
(
const
AttributeList
&
rAttribs
)
{
OUString
aType
=
rAttribs
.
getString
(
XML_Type
,
OUString
()
);
if
(
aType
==
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
)
if
(
aType
==
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
// OOXML Transitional
||
aType
==
"http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"
)
//OOXML strict
{
Reference
<
XUriReferenceFactory
>
xFactory
=
UriReferenceFactory
::
create
(
mxContext
);
try
...
...
oox/source/token/namespacemap.cxx
Dosyayı görüntüle @
6ba394e6
...
...
@@ -32,8 +32,18 @@ NamespaceMap::NamespaceMap()
{
-
1
,
""
}
};
static
const
struct
NamespaceStrictUrl
{
sal_Int32
mnId
;
const
sal_Char
*
mpcUrl
;
}
spNamespaceStrictUrls
[]
=
{
// include auto-generated C array with namespace URLs as C strings
#include "namespace-strictnames.inc"
{
-
1
,
""
}
};
for
(
const
NamespaceUrl
*
pNamespaceUrl
=
spNamespaceUrls
;
pNamespaceUrl
->
mnId
!=
-
1
;
++
pNamespaceUrl
)
operator
[](
pNamespaceUrl
->
mnId
)
=
OUString
::
createFromAscii
(
pNamespaceUrl
->
mpcUrl
);
maTransitionalNamespaceMap
[
pNamespaceUrl
->
mnId
]
=
OUString
::
createFromAscii
(
pNamespaceUrl
->
mpcUrl
);
for
(
const
NamespaceStrictUrl
*
pNamespaceUrl
=
spNamespaceStrictUrls
;
pNamespaceUrl
->
mnId
!=
-
1
;
++
pNamespaceUrl
)
maStrictNamespaceMap
[
pNamespaceUrl
->
mnId
]
=
OUString
::
createFromAscii
(
pNamespaceUrl
->
mpcUrl
);
}
}
...
...
oox/source/token/namespaces-strict.hxx.head
0 → 100644
Dosyayı görüntüle @
6ba394e6
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef OOX_TOKEN_NAMESPACES_HXX
#define OOX_TOKEN_NAMESPACES_HXX
#include <sal/types.h>
namespace oox {
// ============================================================================
oox/source/token/namespaces-strict.hxx.tail
0 → 100644
Dosyayı görüntüle @
6ba394e6
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// ============================================================================
const sal_Int32 TOKEN_MASK = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 );
const sal_Int32 NMSP_MASK = static_cast< sal_Int32 >( SAL_MAX_INT32 & ~TOKEN_MASK );
/** Returns the raw token identifier without namespace of the passed token. */
inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; }
/** Returns the namespace without token identifier of the passed token. */
inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
// defines for tokens with specific namespaces
#define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token)
#define A_TOKEN( token ) OOX_TOKEN( dml, token )
#define AX_TOKEN( token ) OOX_TOKEN( ax, token )
#define C_TOKEN( token ) OOX_TOKEN( dmlChart, token )
#define CDR_TOKEN( token ) OOX_TOKEN( dmlChartDr, token )
#define DGM_TOKEN( token ) OOX_TOKEN( dmlDiagram, token )
#define MCE_TOKEN( token ) OOX_TOKEN( mce, token)
#define O_TOKEN( token ) OOX_TOKEN( vmlOffice, token )
#define PC_TOKEN( token ) OOX_TOKEN( packageContentTypes, token )
#define PPT_TOKEN( token ) OOX_TOKEN( ppt, token )
#define PR_TOKEN( token ) OOX_TOKEN( packageRel, token )
#define R_TOKEN( token ) OOX_TOKEN( officeRel, token )
#define VML_TOKEN( token ) OOX_TOKEN( vml, token )
#define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token )
#define XDR_TOKEN( token ) OOX_TOKEN( dmlSpreadDr, token )
#define XLS_TOKEN( token ) OOX_TOKEN( xls, token )
#define XLS_EXT_TOKEN( token ) OOX_TOKEN( xlsExtLst, token )
#define XM_TOKEN( token ) OOX_TOKEN( xm, token )
#define XML_TOKEN( token ) OOX_TOKEN( xml, token )
#define VMLPPT_TOKEN( token ) OOX_TOKEN( vmlPowerpoint, token )
#define DSP_TOKEN( token ) OOX_TOKEN( dsp, token )
#define LC_TOKEN( token ) OOX_TOKEN( dmlLockedCanvas, token )
#define WPS_TOKEN( token ) OOX_TOKEN( wps, token )
#define WPG_TOKEN( token ) OOX_TOKEN( wpg, token )
// ============================================================================
} // namespace oox
#endif
oox/source/token/namespaces-strict.pl
0 → 100644
Dosyayı görüntüle @
6ba394e6
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
$ARGV0
=
shift
@ARGV
;
$ARGV1
=
shift
@ARGV
;
$ARGV2
=
shift
@ARGV
;
$ARGV3
=
shift
@ARGV
;
# parse input file
open
(
INFILE
,
$ARGV0
)
or
die
"cannot open input file: $!"
;
my
%
namespaces
;
while
(
<
INFILE
>
)
{
# trim newline
chomp
(
$_
);
# trim leading/trailing whitespace
$_
=~
s/^\s*//g
;
$_
=~
s/\s*$//g
;
# trim comments
$_
=~
s/^#.*//
;
# skip empty lines
if
(
$_
)
{
# check for valid characters
$_
=~
/^([a-zA-Z][a-zA-Z0-9]*)\s+([a-zA-Z0-9-.:\/]+)\s*$/
or
die
"Error: invalid character in input data"
;
$namespaces
{
$1
}
=
$2
;
}
}
close
(
INFILE
);
# generate output files
open
(
IDFILE
,
">$ARGV1"
)
or
die
"Error: cannot open output file: $!"
;
open
(
NAMEFILE
,
">$ARGV2"
)
or
die
"Error: cannot open output file: $!"
;
open
(
TXTFILE
,
">$ARGV3"
)
or
die
"Error: cannot open output file: $!"
;
# number of bits to shift the namespace identifier
$shift
=
16
;
print
(
IDFILE
"const size_t NMSP_SHIFT = $shift;\n"
);
$i
=
1
;
foreach
(
keys
(
%
namespaces
)
)
{
print
(
IDFILE
"const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n"
);
$id
=
$i
<<
$shift
;
print
(
NAMEFILE
"{ $id, \"$namespaces{$_}\" },\n"
);
print
(
TXTFILE
"$id $_ $namespaces{$_}\n"
);
++
$i
;
}
close
(
IDFILE
);
close
(
nameFILE
);
close
(
TXTFILE
);
oox/source/token/namespaces-strict.txt
0 → 100644
Dosyayı görüntüle @
6ba394e6
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
# generic XML -----------------------------------------------------------------
xml http://www.w3.org/XML/1998/namespace
schema http://purl.oclc.org/ooxml/schemaLibrary/main
# package ---------------------------------------------------------------------
packageContentTypes http://schemas.openxmlformats.org/package/2006/content-types
packageMetaCorePr http://schemas.openxmlformats.org/package/2006/metadata/core-properties
packageRel http://schemas.openxmlformats.org/package/2006/relationships
# office shared ---------------------------------------------------------------
officeCustomPr http://purl.oclc.org/ooxml/officeDocument/custom-properties
officeDocPropsVT http://purl.oclc.org/ooxml/officeDocument/docPropsVTypes
officeExtPr http://purl.oclc.org/ooxml/officeDocument/extended-properties
officeMath http://purl.oclc.org/ooxml/officeDocument/math
officeRel http://purl.oclc.org/ooxml/officeDocument/relationships
officeRelTheme http://purl.oclc.org/ooxml/officeDocument/relationships/theme
# applications ----------------------------------------------------------------
doc http://purl.oclc.org/ooxml/wordprocessingml/main
xls http://purl.oclc.org/ooxml/spreadsheetml/main
ppt http://purl.oclc.org/ooxml/presentationml/main
# drawing ---------------------------------------------------------------------
dml http://purl.oclc.org/ooxml/drawingml/main
dsp http://schemas.microsoft.com/office/drawing/2008/diagram
dmlChart http://purl.oclc.org/ooxml/drawingml/chart
dmlChartDr http://purl.oclc.org/ooxml/drawingml/chartDrawing
dmlDiagram http://purl.oclc.org/ooxml/drawingml/diagram
dmlLockedCanvas http://purl.oclc.org/ooxml/drawingml/lockedCanvas
dmlPicture http://purl.oclc.org/ooxml/drawingml/picture
dmlSpreadDr http://purl.oclc.org/ooxml/drawingml/spreadsheetDrawing
dmlWordDr http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing
# VML -------------------------------------------------------------------------
vml urn:schemas-microsoft-com:vml
vmlExcel urn:schemas-microsoft-com:office:excel
vmlOffice urn:schemas-microsoft-com:office:office
vmlPowerpoint urn:schemas-microsoft-com:office:powerpoint
vmlWord urn:schemas-microsoft-com:office:word
# other -----------------------------------------------------------------------
ax http://schemas.microsoft.com/office/2006/activeX
dc http://purl.org/dc/elements/1.1/
dcTerms http://purl.org/dc/terms/
xm http://schemas.microsoft.com/office/excel/2006/main
sprm http://sprm
mce http://schemas.openxmlformats.org/markup-compatibility/2006
mceTest http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2
wps http://schemas.microsoft.com/office/word/2010/wordprocessingShape
wpg http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
wp14 http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
w14 http://schemas.microsoft.com/office/word/2010/wordml
# extlst namespaces
# xlsExtLst for features introduced by excel 2010
xlsExtLst http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
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