summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2009-11-24 14:45:31 +0100
committerVladimir Glazunov <vg@openoffice.org>2009-11-24 14:45:31 +0100
commit3c65332e3ccd132f08c1ea294a1ed4366340ef51 (patch)
tree9073d9d4d78f6d8eeb5e0ce9311d5a5f5e9fe5ef /oox
parent7ccefb01c0246603f247d12877e2be9b534f6165 (diff)
parent0211e8bc457a12570988f4aee7dea42c2fc6d56f (diff)
CWS-TOOLING: integrate CWS writerfilter32bugfixes01_DEV300
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/core/namespaces.hxx104
-rw-r--r--oox/prj/d.lst1
-rw-r--r--oox/source/core/filterbase.cxx2
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx12
-rw-r--r--oox/source/token/gennamespaces.pl65
-rw-r--r--oox/source/token/makefile.mk16
-rw-r--r--oox/source/token/namespaces.txt48
7 files changed, 140 insertions, 108 deletions
diff --git a/oox/inc/oox/core/namespaces.hxx b/oox/inc/oox/core/namespaces.hxx
deleted file mode 100644
index 643e595b8051..000000000000
--- a/oox/inc/oox/core/namespaces.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: namespaces.hxx,v $
- * $Revision: 1.5.4.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_CORE_NAMESPACES_HXX
-#define OOX_CORE_NAMESPACES_HXX
-
-#include <sal/types.h>
-
-namespace oox {
-
-// ============================================================================
-
-// relations, XML
-const sal_Int32 NMSP_XML = 1 << 16;
-const sal_Int32 NMSP_PACKAGE_RELATIONSHIPS = 2 << 16;
-const sal_Int32 NMSP_RELATIONSHIPS = 3 << 16;
-const sal_Int32 NMSP_CONTENT_TYPES = 4 << 16;
-// office global
-const sal_Int32 NMSP_ACTIVATION = 12 << 16;
-// DrawingML
-const sal_Int32 NMSP_DRAWINGML = 21 << 16;
-const sal_Int32 NMSP_DIAGRAM = 22 << 16;
-const sal_Int32 NMSP_CHART = 23 << 16;
-// VML
-const sal_Int32 NMSP_VML = 31 << 16;
-const sal_Int32 NMSP_OFFICE = 32 << 16;
-const sal_Int32 NMSP_VML_DOC = 33 << 16; // Word VML
-const sal_Int32 NMSP_VML_XLS = 34 << 16; // Excel VML
-const sal_Int32 NMSP_VML_PPT = 35 << 16; // PowerPoint VML
-const sal_Int32 NMSP_AX = 36 << 16; // ActiveX (for OCX form controls)
-// SpreadsheetML
-const sal_Int32 NMSP_XLS = 41 << 16;
-const sal_Int32 NMSP_XDR = 42 << 16; // SpreadsheetDrawingML
-const sal_Int32 NMSP_XM = 43 << 16; // Macro sheet
-// PresentationML
-const sal_Int32 NMSP_PPT = 51 << 16;
-// Document properties
-const sal_Int32 NMSP_COREPR = 61 << 16;
-const sal_Int32 NMSP_DC = 62 << 16;
-const sal_Int32 NMSP_DCTERMS = 63 << 16;
-const sal_Int32 NMSP_EXTPR = 64 << 16;
-const sal_Int32 NMSP_CUSTPR = 65 << 16;
-const sal_Int32 NMSP_VT = 66 << 16;
-
-// ----------------------------------------------------------------------------
-
-const sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;
-const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;
-
-/** Returns the token identifier of the passed element without namespace. */
-inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }
-
-/** Returns the namespace of the passed element without token identifier. */
-inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }
-
-// ----------------------------------------------------------------------------
-
-// defines for tokens with specific namespaces, can be used in switch/cases
-#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)
-#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)
-#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)
-#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)
-#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)
-#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)
-#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token)
-#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token)
-#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token)
-#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token)
-#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token)
-#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token)
-
-// ============================================================================
-
-} // namespace oox
-
-#endif // OOX_CORE_NAMESPACES_HXX
-
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 50ec05955ca6..2c9d8d5bae74 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -18,6 +18,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\vml
..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
+..\source\token\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index c5b423380e82..f2f9ef09b9e5 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -600,7 +600,7 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDes
{
setMediaDescriptor( rMediaDescSeq );
DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
- if( aOpenedGuard.isValid() )
+ if( aOpenedGuard.isValid() || !mxImpl->maFileUrl.getLength() )
{
mxImpl->initializeFilter();
switch( mxImpl->meDirection )
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 8f5165726710..204ed459c7fc 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -33,6 +33,11 @@
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
+#if DEBUG
+#include <iostream>
+using namespace std;
+#endif
+
namespace oox { namespace shape {
using namespace ::com::sun::star;
@@ -90,6 +95,9 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
uno::Reference<xml::sax::XFastContextHandler>
ShapeContextHandler::getDrawingShapeContext()
{
+#if DEBUG
+ clog << "ShapeContextHandler::getDrawingShapeContext" << endl;
+#endif
if (!mxDrawingFragmentHandler.is())
{
mpDrawing.reset( new oox::vml::Drawing( *mxFilterBase, mxDrawPage, oox::vml::VMLDRAWING_WORD ) );
@@ -109,6 +117,7 @@ ShapeContextHandler::getContextHandler()
switch (mnStartToken & NMSP_MASK)
{
+ case NMSP_DOC:
case NMSP_VML:
xResult.set(getDrawingShapeContext());
break;
@@ -179,6 +188,9 @@ ShapeContextHandler::createFastChildContext
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
throw (uno::RuntimeException, xml::sax::SAXException)
{
+#if DEBUG
+ clog << "ShapeContextHandler::createFastChildContext" << endl;
+#endif
uno::Reference< xml::sax::XFastContextHandler > xResult;
uno::Reference< xml::sax::XFastContextHandler > xContextHandler(getContextHandler());
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