diff options
author | thb <thb@openoffice.org> | 2010-01-18 01:10:42 +0100 |
---|---|---|
committer | thb <thb@openoffice.org> | 2010-01-18 01:10:42 +0100 |
commit | 783ec4ee8e22d57b7ce3443ab1fc926476d8c522 (patch) | |
tree | d4faacf55a3828e17dc3dbbc9e7e65e2f4eb7c35 /oox/source/token | |
parent | 8748bccd375753ba2b043798a2853d1796c1d2a0 (diff) | |
parent | 61e959dac551c5984e9865edea9f2ad7203233fd (diff) |
thbfixes10: merge with DEV300 m69
Diffstat (limited to 'oox/source/token')
-rw-r--r-- | oox/source/token/gennamespaces.pl | 65 | ||||
-rw-r--r-- | oox/source/token/makefile.mk | 16 | ||||
-rw-r--r-- | oox/source/token/namespaces.txt | 48 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/token/tokenmap.cxx | 1 |
5 files changed, 128 insertions, 3 deletions
diff --git a/oox/source/token/gennamespaces.pl b/oox/source/token/gennamespaces.pl new file mode 100644 index 000000000000..b3d277b85c2f --- /dev/null +++ b/oox/source/token/gennamespaces.pl @@ -0,0 +1,65 @@ +$ARGV0 = shift @ARGV; +$ARGV1 = shift @ARGV; + +open ( NAMESPACES, $ARGV0 ) || die "can't open namespaces file: $!"; + + +open ( HXX, ">$ARGV1" ) or die "can't open namespaces.hxx file: $!"; + +print ( HXX "#ifndef OOX_NAMESPACES_HXX\n" ); +print ( HXX "#define OOX_NAMESPACES_HXX\n\n" ); +print ( HXX "#include <sal/types.h>\n\n" ); +print ( HXX "namespace oox {\n\n" ); + +$group = 0; +$i = 1; +while ( <NAMESPACES> ) +{ + chomp( $_ ); + $_ =~ s/\s*//g; + if ( $_ =~ m/^$/ ) + { + # Start a new group + print ( HXX "\n" ); + $i = 0; + $group++; + } + elsif ( $_ =~ m/^[^#]/ ) + { + # Neither an empty line nor a comment + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_"; + $id = "NMSP_$_"; + $id =~ s/-/_/g; + $no = $group*10 + $i; + print ( HXX "const sal_Int32 $id = $no << 16;\n" ); + ++$i; + } +} +close ( NAMESPACES ); + +print ( HXX "\nconst sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;\n" ); +print ( HXX "const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;\n" ); + +print ( HXX "/** Returns the token identifier of the passed element without namespace. */\n" ); +print ( HXX "inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }\n\n" ); + +print ( HXX "/** Returns the namespace of the passed element without token identifier. */\n" ); +print ( HXX "inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }\n\n" ); + +print ( HXX "// defines for tokens with specific namespaces, can be used in switch/cases\n\n" ); +print ( HXX "#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)\n" ); +print ( HXX "#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)\n" ); +print ( HXX "#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)\n" ); +print ( HXX "#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)\n" ); +print ( HXX "#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)\n" ); +print ( HXX "#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)\n" ); +print ( HXX "#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token)\n" ); +print ( HXX "#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token)\n" ); +print ( HXX "#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token)\n" ); +print ( HXX "#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token)\n" ); +print ( HXX "#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token)\n" ); +print ( HXX "#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token)\n" ); + + +print ( HXX "} // namespace oox\n\n" ); +print ( HXX "#endif // OOX_NAMESPACES_HXX\n" ); diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk index 3cce788d2508..cda48a6b11a0 100644 --- a/oox/source/token/makefile.mk +++ b/oox/source/token/makefile.mk @@ -51,16 +51,26 @@ SLOFILES = \ .INCLUDE : target.mk -$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx : +$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx $(INCCOM)$/oox$/core$/namespaces.hxx : @@noop $(assign do_phony:=.PHONY) $(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx - $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@ + $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@ + +$(INCCOM)$/oox: + $(MKDIR) $(INCCOM)$/oox + +$(INCCOM)$/oox$/core: $(INCCOM)$/oox + $(MKDIR) $(INCCOM)$/oox$/core + +$(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl + $(MKDIRHIER) $(INCCOM)$/oox$/core + $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@ $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc -$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(MISC)$/do_tokens +$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces $(MISC)$/do_properties $(do_phony) : properties.txt genproperties.pl $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@ diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt new file mode 100644 index 000000000000..63ca76e95f54 --- /dev/null +++ b/oox/source/token/namespaces.txt @@ -0,0 +1,48 @@ +# Relations, XML +XML +PACKAGE_RELATIONSHIPS +RELATIONSHIPS +CONTENT_TYPES + +# Office global +THEME +ACTIVATION +MATH + +#DrawingML +DRAWINGML +PICTURE +DIAGRAM +CHART +DOC_DRAWINGML + +# VML +VML +OFFICE +VML_DOC +VML_XLS +VML_PPT +AX + +#SpreadsheetML +XLS +XDR +XM + +#PresentationML +PPT + +#WordprocessingML +DOC +SML + +# Document properties +COREPR +DC +DCTERMS +EXTPR +CUSTPR +VT + +# Other elements: used by writerfilter +SPRM diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 958a9ac24e77..0ecd40ee6595 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -400,6 +400,7 @@ VisualEffect Weight WhiteDay Width +WriteProtectionPassword WritingMode ZoomType ZoomValue diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 6f225db876b6..ec254701b2b7 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -29,6 +29,7 @@ ************************************************************************/ #include "oox/token/tokenmap.hxx" +#include <string.h> #include <rtl/strbuf.hxx> #include <rtl/string.hxx> #include "tokens.hxx" |