summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-12-18 10:54:15 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-12-20 19:57:36 +0100
commit74f25206bc5a1a36b85683555cb27179e5da3275 (patch)
tree75cf39f42f78fb8894f0fc9347c40ac6818eaeb9 /sw
parent345b02e7d445ad69d608a11429e16f6d8eb6959a (diff)
tdf#68364 - Don't assume a database if only two dots are present
Additionally, a database table name (database.table.column) has to be retrieved from the database to be valid. Change-Id: I8949ae61d96043412425d634763d2ea33ce6a0f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160910 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uibase/fldui/fldui.cxx20
-rw-r--r--sw/source/core/fields/docufld.cxx3
2 files changed, 20 insertions, 3 deletions
diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx
index 78b2fcedd42a..0bf6bfa33fb6 100644
--- a/sw/qa/uibase/fldui/fldui.cxx
+++ b/sw/qa/uibase/fldui/fldui.cxx
@@ -121,6 +121,26 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark)
CPPUNIT_ASSERT_EQUAL(OUString("aaabbbccc"), pTextNode->GetText());
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots)
+{
+ // Create an empty document
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ // Insert a conditional field containing exactly two dots for its condition
+ SwFieldMgr aFieldMgr(pWrtShell);
+ SwInsertField_Data aFieldData(SwFieldTypesEnum::ConditionalText, 0, "true", "19.12.2023", 0);
+ CPPUNIT_ASSERT(aFieldMgr.InsertField(aFieldData));
+ pWrtShell->SttEndDoc(true);
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 19.12.2023
+ // - Actual :
+ CPPUNIT_ASSERT_EQUAL(OUString("19.12.2023"),
+ pWrtShell->GetCurField()->ExpandField(true, nullptr));
+}
+
CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection)
{
// Given a document with a single selected word:
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 37249555a0e4..ba5f45beceec 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1389,9 +1389,6 @@ void SwHiddenTextField::Evaluate(SwDoc& rDoc)
GetLanguage(), m_aContent, &fNumber );
m_bValid = true;
}
- else if( !sDBName.isEmpty() && !sDataSource.isEmpty() &&
- !sDataTableOrQuery.isEmpty() )
- m_bValid = true;
}
#endif
}