diff options
Diffstat (limited to 'filter/source/svg/svgwriter.cxx')
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index e4a7c4bac7a7..2e4c00b7fbf8 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1091,9 +1091,9 @@ bool SVGTextWriter::nextTextPortion() { mrCurrentTextPortion.clear(); mbIsURLField = false; - mbIsPlaceholderShape = false; if( mrTextPortionEnumeration.is() && mrTextPortionEnumeration->hasMoreElements() ) { + mbIsPlaceholderShape = false; #if OSL_DEBUG_LEVEL > 0 OUString sInfo; #endif @@ -1111,6 +1111,7 @@ bool SVGTextWriter::nextTextPortion() } #endif msPageCount = ""; + msDateTimeType = ""; if( xPortionTextRange.is() ) { #if OSL_DEBUG_LEVEL > 0 @@ -1157,6 +1158,31 @@ bool SVGTextWriter::nextTextPortion() #if OSL_DEBUG_LEVEL > 0 sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; "; #endif + // This case handle Date or Time text field inserted by the user + // on both page/master page. It doesn't handle the standard Date/Time field. + if( sFieldName == "DateTime" ) + { + Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY); + if( xTextFieldPropSet.is() ) + { + Reference<XPropertySetInfo> xPropSetInfo = xTextFieldPropSet->getPropertySetInfo(); + if( xPropSetInfo.is() ) + { + // The standard Date/Time field has no property. + // Trying to get a property value on such field would cause a runtime exception. + // So the hasPropertyByName check is needed. + bool bIsFixed = true; + if( xPropSetInfo->hasPropertyByName("IsFixed") && ( ( xTextFieldPropSet->getPropertyValue( "IsFixed" ) ) >>= bIsFixed ) && !bIsFixed ) + { + bool bIsDate; + if( xPropSetInfo->hasPropertyByName("IsDate") && ( ( xTextFieldPropSet->getPropertyValue( "IsDate" ) ) >>= bIsDate ) ) + { + msDateTimeType = OUString::createFromAscii( bIsDate ? "<date>" : "<time>" ); + } + } + } + } + } if( sFieldName == "DateTime" || sFieldName == "Header" || sFieldName == "Footer" || sFieldName == "PageNumber" ) { @@ -1684,6 +1710,13 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); mrExport.GetDocHandler()->characters( msPageCount ); } + // This case handle Date or Time text field inserted by the user + // on both page/master page. It doesn't handle the standard Date/Time field. + else if ( !msDateTimeType.isEmpty() ) + { + SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.GetDocHandler()->characters( msDateTimeType ); + } else { SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); |