summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authormb93783 <mb93783@v60x-so15.Germany.Sun.COM>2009-12-02 12:43:33 +0100
committermb93783 <mb93783@v60x-so15.Germany.Sun.COM>2009-12-02 12:43:33 +0100
commit220470d1830fd0aa07dae1c70da38cae8c8ab959 (patch)
tree83808f417789db8c368975a4edf25fe740cd1b9c /oox/source
parent6eb24b9220a7a5653405b09b0eb130a84b310020 (diff)
parent81087627f30494064a791bffd61ec99b5b289b4f (diff)
merge to m66
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/core/filterbase.cxx2
-rw-r--r--oox/source/docprop/docprophandler.cxx6
-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
6 files changed, 143 insertions, 6 deletions
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/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 185a061acea4..3e5a4830b691 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -78,13 +78,15 @@ void OOXMLDocPropHandler::AddCustomProperty( const uno::Any& aAny )
{
if ( m_aCustomPropertyName.getLength() )
{
- uno::Reference< beans::XPropertyContainer > xUserProps = m_xDocProp->getUserDefinedProperties();
+ const uno::Reference< beans::XPropertyContainer > xUserProps =
+ m_xDocProp->getUserDefinedProperties();
if ( !xUserProps.is() )
throw uno::RuntimeException();
try
{
- xUserProps->addProperty( m_aCustomPropertyName, beans::PropertyAttribute::TRANSIENT, aAny );
+ xUserProps->addProperty( m_aCustomPropertyName,
+ beans::PropertyAttribute::REMOVEABLE, aAny );
}
catch( beans::PropertyExistException& )
{
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