tdf#148380 docx export: support CREATEDATE without format

When CREATEDATE is given as a field command without the optional
format string, then export was treating it as bWriteExpand
(aka ww::eUNKNOWN) and just dumped out the field name.

Instead, accept an empty string as a valid number format
in order to maintain it as a field.

In order to do this, we have to also turn off write-expand
for fixed fields, since import always treats CREATEDATE as FIXED.

The other existing example is
writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx

DOC: not yet importing as FIXED
RTF: seems to just ignore bWriteExpand and does the right thing anyway.

Change-Id: If0aef38f6730f55b5fa1be6a62e0b6a0b4871658
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132662
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index fa0199e..ebc1cbf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -737,6 +737,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf83309, "tdf83309.docx")
    // behave same way)
    OUString sNodeType = parseDump("/root/page[1]/body/txt[1]/Text[1]", "nType");
    CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType);

    // tdf148380: creation-date field in header.xml was unsupported on export
    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
    auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
    uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
    uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(OUString("8/31/14 10:26 AM"), xField->getPresentation(false));
}

CPPUNIT_TEST_FIXTURE(Test, testTdf121661)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 0c35760..3df56e24 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -75,8 +75,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148380_createField, "tdf148380_createField.docx"
    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
    auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
    uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
    if (mbExported)
        return;
    uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY);
    // This should NOT be "Lorenzo Chavez", or a real date since the user hand-modified the result.
    CPPUNIT_ASSERT_EQUAL(OUString("Myself - that's who"), xField->getPresentation(false));
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d038bac..44063c8 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2935,8 +2935,12 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
                case DI_CREATE:
                    if (DI_SUB_AUTHOR == (nSubType & DI_SUB_MASK))
                        eField = ww::eAUTHOR;
                    else if (GetExport().GetNumberFormat(*pField, sStr))
                    else if (GetExport().GetNumberFormat(*pField, sStr) || sStr.isEmpty())
                        eField = ww::eCREATEDATE;

                    // Create author/time are always imported as fixed. Safe to ignore on export
                    if (GetExport().GetExportFormat() != MSWordExportBase::DOC)
                        bWriteExpand = false;
                    break;

                case DI_CHANGE: