Question unoType for getXmlToken (dbaccess/reportdesign module)

Lionel Elie Mamane lionel at
Fri May 16 21:29:32 PDT 2014

On Fri, May 16, 2014 at 10:30:27AM -0700, julien2412 [via Document Foundation Mail Archive] wrote:

> I noticed this:
> s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<double>::get();
> present at 2 locations:
> See

> Why shouldn't be this:
> s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<float>::get();
> ?

Also in xmloff/source/forms/propertyimport.cxx (which is not found by
the above search).

In that file I also see:

    token::XMLTokenEnum OPropertyExport::implGetPropertyXMLType(const ::com::sun::star::uno::Type& _rType)
        // handle the type description
        switch (_rType.getTypeClass())
            case TypeClass_DOUBLE:
            case TypeClass_BYTE:
            case TypeClass_SHORT:
            case TypeClass_LONG:
            case TypeClass_HYPER:
            case TypeClass_ENUM:
                return token::XML_FLOAT;

So there, clearly, all numeric types (including the UNO double)
consistently map to XML_FLOAT, so taking the extra precision from the
C++ type "float" to "double" makes absolute sense. What is called
"float" in XML seems to be the general notion of number, not
specifically the IEE754 single precision 32-bit floating point.

Looking into an .odb file's reports, I don't see "double" used at
all. Again, "float" seems to be used in the general sense of
"number". This is confirmed by
which shows that the ODF format uses the XML token "float" to mean
"number", and does not have a difference between the notion of
"integer" and "floating point", much less between different precision
levels of floating point data types.

So again, it makes sense to use the C++ type "double" for that (extra
precision, matches the type used by our numeric formatters, ...).


View this message in context:
Sent from the Dev mailing list archive at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the LibreOffice mailing list