summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-03-06 17:00:10 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-04-03 12:51:19 +0200
commitd888ed101b6c1a22ae2e6eb2536adda2fa45a802 (patch)
treed1b2cc556ce33fd6fcdd6ed63a229cb3a2548f02 /sw
parenta1b4eca5fc9898b9741325de52b89f406635b52a (diff)
Always update fields when loading document
to make sure that table formulas are re-evaluated after loading. When a document has a wrong sum saved (which seems to happen sometimes), this sum is used until user clicks into the table or otherwise refreshes the formula. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148355 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> (cherry picked from commit c132a1abd57c109331191c3b3fbd14e1c5e46631) Change-Id: I5cc3f983524b395089c17aa35d8641847a388bad
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/odfimport/data/incorrectsum.odtbin0 -> 17356 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx12
-rw-r--r--sw/source/filter/basflt/shellio.cxx2
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/extras/odfimport/data/incorrectsum.odt b/sw/qa/extras/odfimport/data/incorrectsum.odt
new file mode 100644
index 000000000000..0e1e99b0d699
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/incorrectsum.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index c14a4ac60c87..3fa5321389e4 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/lang/Locale.hpp>
+#include <vcl/scheduler.hxx>
#include <IDocumentSettingAccess.hxx>
#include <wrtsh.hxx>
@@ -465,6 +466,17 @@ DECLARE_ODFIMPORT_TEST(testFdo56272, "fdo56272.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape->getPosition().Y); // Was -2371
}
+DECLARE_ODFIMPORT_TEST(testIncorrectSum, "incorrectsum.odt")
+{
+ Scheduler::ProcessEventsToIdle();
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTextTable->getCellByName("C3"), uno::UNO_QUERY);
+ // Use indexOf instead of exact match since the result contains an Euro sign which OUString doesn't like
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xCell->getString().indexOf("1,278"));
+}
+
DECLARE_ODFIMPORT_TEST(testCalcFootnoteContent, "ooo32780-1.odt")
{
//this was a CalcFootnoteContent crash
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 5c80d7da6fef..06bbbe14e88c 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -378,7 +378,7 @@ ErrCode SwReader::Read( const Reader& rOptions )
// not insert: set the redline mode read from settings.xml
eOld = ePostReadRedlineFlags & ~RedlineFlags::Ignore;
- mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 0);
+ mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 0);
}
mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );