dbaccess: ODF export: set "Version" property on target Storage

... like SfxObjectShell::SetupStorage() does, and not on the property
set that is passed to the XML export filters where it probably does
nothing.

Change-Id: I21da1b92fc921eb47e492169e69ef15ac2f0e19d
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 5dbf3a1..007a3b3 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1615,7 +1615,6 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
        { OUString("BaseURI"), 0, ::getCppuType( (OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 },
        { OUString("StreamName"), 0, ::getCppuType( (OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 },
        { OUString("UsePrettyPrinting"), 0, ::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0},
        { OUString("Version"), 0, ::getCppuType( (OUString *)0 ),beans::PropertyAttribute::MAYBEVOID, 0 },
        { OUString(), 0, css::uno::Type(), 0, 0 }
    };
    uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
@@ -1625,24 +1624,6 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
    if ( aSaveOpt.IsSaveRelFSys() )
        xInfoSet->setPropertyValue("BaseURI", uno::makeAny(_rMediaDescriptor.getOrDefault("URL",OUString())));

    OUString aVersion;
    SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();

    // older versions can not have this property set, it exists only starting from ODF1.2
    if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
        aVersion = ODFVER_012_TEXT;

    if ( !aVersion.isEmpty() )
    {
        try
        {
            xInfoSet->setPropertyValue( "Version" , uno::makeAny( aVersion ) );
        }
        catch( const uno::Exception& )
        {
        }
    }

    sal_Int32 nArgsLen = aDelegatorArguments.getLength();
    aDelegatorArguments.realloc(nArgsLen+1);
    aDelegatorArguments[nArgsLen++] <<= xInfoSet;
@@ -1650,6 +1631,26 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
    Reference< XPropertySet > xProp( _rxTargetStorage, UNO_QUERY_THROW );
    xProp->setPropertyValue( INFO_MEDIATYPE, makeAny( (OUString)MIMETYPE_OASIS_OPENDOCUMENT_DATABASE ) );

    OUString aVersion;
    SvtSaveOptions::ODFDefaultVersion const nDefVersion =
        aSaveOpt.GetODFDefaultVersion();
    // older versions can not have this property set,
    // it exists only starting from ODF1.2
    if (nDefVersion >= SvtSaveOptions::ODFVER_012)
        aVersion = ODFVER_012_TEXT;

    if (!aVersion.isEmpty())
    {
        try
        {
            xProp->setPropertyValue("Version" , uno::makeAny(aVersion));
        }
        catch (const uno::Exception& e)
        {
            SAL_WARN("dbaccess", "exception setting Version: " << e.Message);
        }
    }

    Reference< XComponent > xComponent( *const_cast< ODatabaseDocument* >( this ), UNO_QUERY_THROW );

    Sequence< PropertyValue > aMediaDescriptor;