summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/docprop/docprophandler.cxx25
-rw-r--r--oox/source/docprop/docprophandler.hxx1
-rw-r--r--sax/source/fastparser/fastparser.cxx6
3 files changed, 30 insertions, 2 deletions
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 1a5000b03906..c5d89b92ff3e 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -45,6 +45,7 @@ OOXMLDocPropHandler::OOXMLDocPropHandler( const uno::Reference< uno::XComponentC
, m_nBlock( 0 )
, m_nType( 0 )
, m_nInBlock( 0 )
+ , m_CustomStringPropertyState(NONE)
{
if ( !xContext.is() || !rDocProp.is() )
throw uno::RuntimeException();
@@ -61,6 +62,7 @@ void OOXMLDocPropHandler::InitNew()
m_aCustomPropertyName.clear();
m_nType = 0;
m_nInBlock = 0;
+ m_CustomStringPropertyState = NONE;
}
void OOXMLDocPropHandler::AddCustomProperty( const uno::Any& aAny )
@@ -345,7 +347,29 @@ void SAL_CALL OOXMLDocPropHandler::endFastElement( ::sal_Int32 )
m_aCustomPropertyName.clear();
}
else if ( m_nInBlock == 2 )
+ {
+ if ( m_nState == CUSTPR_TOKEN(Properties)
+ && m_nBlock == CUSTPR_TOKEN(property))
+ {
+ switch (m_nType)
+ {
+ case VT_TOKEN(bstr):
+ case VT_TOKEN(lpstr):
+ case VT_TOKEN(lpwstr):
+ if (!m_aCustomPropertyName.isEmpty() &&
+ INSERTED != m_CustomStringPropertyState)
+ {
+ // the property has string type, so it is valid
+ // even with an empty value - characters() has
+ // not been called in that case
+ AddCustomProperty(uno::makeAny(OUString()));
+ }
+ break;
+ }
+ }
+ m_CustomStringPropertyState = NONE;
m_nType = 0;
+ }
}
}
@@ -595,6 +619,7 @@ void SAL_CALL OOXMLDocPropHandler::characters( const OUString& aChars )
case VT_TOKEN( lpwstr ):
// the property has string type
AddCustomProperty( uno::makeAny( AttributeConversion::decodeXString( aChars ) ) );
+ m_CustomStringPropertyState = INSERTED;
break;
case VT_TOKEN( date ):
diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx
index f0d8049bfe47..daabc03234b5 100644
--- a/oox/source/docprop/docprophandler.hxx
+++ b/oox/source/docprop/docprophandler.hxx
@@ -50,6 +50,7 @@ class OOXMLDocPropHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xm
sal_Int32 m_nInBlock;
+ enum { NONE, INSERTED } m_CustomStringPropertyState;
OUString m_aCustomPropertyName;
public:
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 79ab8991af78..c866618ea4f0 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1037,7 +1037,8 @@ void FastSaxParserImpl::parse()
void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xmlChar* prefix, const xmlChar* URI,
int numNamespaces, const xmlChar** namespaces, int numAttributes, int /*defaultedAttributes*/, const xmlChar **attributes)
{
- sendPendingCharacters();
+ if (!pendingCharacters.isEmpty())
+ sendPendingCharacters();
Entity& rEntity = getEntity();
if( rEntity.maNamespaceCount.empty() )
{
@@ -1144,7 +1145,8 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
void FastSaxParserImpl::callbackEndElement( const xmlChar*, const xmlChar*, const xmlChar* )
{
- sendPendingCharacters();
+ if (!pendingCharacters.isEmpty())
+ sendPendingCharacters();
Entity& rEntity = getEntity();
SAL_WARN_IF(rEntity.maNamespaceCount.empty(), "sax", "Empty NamespaceCount");
if( !rEntity.maNamespaceCount.empty() )