connectivity/source/drivers/dbase/DTable.cxx | 2 cui/uiconfig/ui/optviewpage.ui | 4 sc/inc/scmod.hxx | 2 sc/qa/unit/tiledrendering/data/validity.xlsx |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 57 +++++++- sc/source/core/data/column2.cxx | 2 sc/source/ui/app/inputhdl.cxx | 12 + sc/source/ui/app/scmod.cxx | 4 sc/source/ui/inc/inputhdl.hxx | 2 sc/source/ui/view/tabvwsha.cxx | 11 + sw/qa/extras/rtfexport/data/tdf95706_2.rtf | 17 ++ sw/qa/extras/rtfexport/rtfexport4.cxx | 12 + sw/source/core/text/porfld.cxx | 14 +- sw/source/ui/dbui/mmoutputtypepage.cxx | 4 vcl/inc/qt5/QtMenu.hxx | 1 vcl/qt5/QtData.cxx | 2 vcl/qt5/QtMenu.cxx | 8 - vcl/source/outdev/text.cxx | 2 writerfilter/source/rtftok/rtfdispatchvalue.cxx | 4 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 162 +++++++++++++----------- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 21 files changed, 220 insertions(+), 103 deletions(-)
New commits: commit 0a8e00063ef6868c1a661c883ccb5b2a93325925 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Thu Apr 7 13:14:59 2022 +0530 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:19 2022 +0200 lok: unit test for invalid entry save Unit test related to the fix lok: avoid validation-dialog yield when saving e0175ee821eaff56c4b8e0a1b7afa1cabe0ab593 The test ensures that the document is marked unmodified after save has been executed in the middle of entering partial data to a validation cell. Conflicts: sc/qa/unit/tiledrendering/tiledrendering.cxx Change-Id: Idffd6d647034e128d0d800fe8e29efc333c03db6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132657 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/sc/qa/unit/tiledrendering/data/validity.xlsx b/sc/qa/unit/tiledrendering/data/validity.xlsx new file mode 100644 index 000000000000..54a92acd5979 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/validity.xlsx differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 09c198adbf1b..e17bf999a010 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -126,6 +126,7 @@ public: void testSheetViewDataCrash(); void testTextBoxInsert(); void testCommentCellCopyPaste(); + void testInvalidEntrySave(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -182,6 +183,7 @@ public: CPPUNIT_TEST(testSheetViewDataCrash); CPPUNIT_TEST(testTextBoxInsert); CPPUNIT_TEST(testCommentCellCopyPaste); + CPPUNIT_TEST(testInvalidEntrySave); CPPUNIT_TEST_SUITE_END(); private: @@ -2691,18 +2693,25 @@ void ScTiledRenderingTest::testSortAscendingDescending() CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry); } -void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabViewShell* pView, ScModelObj* pModelObj) +void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabViewShell* pView, + ScModelObj* pModelObj, bool bInEdit = false, bool bCommit = true) { - pView->SetCursor(nCol, nRow); + if (!bInEdit) + pView->SetCursor(nCol, nRow); + for (const char& cChar : aStr) { pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, cChar, 0); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, cChar, 0); Scheduler::ProcessEventsToIdle(); } - pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); - pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); - Scheduler::ProcessEventsToIdle(); + + if (bCommit) + { + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); + Scheduler::ProcessEventsToIdle(); + } } void ScTiledRenderingTest::testAutoInputStringBlock() @@ -3044,6 +3053,44 @@ void ScTiledRenderingTest::testCommentCellCopyPaste() comphelper::LibreOfficeKit::setTiledAnnotations(true); } +void ScTiledRenderingTest::testInvalidEntrySave() +{ + // Load a document + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("validity.xlsx"); + const ScDocument* pDoc = pModelObj->GetDocument(); + ViewCallback aView; + int nView = SfxLokHelper::getView(); + + SfxLokHelper::setView(nView); + + ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() ); + ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + CPPUNIT_ASSERT(pTabViewShell); + + // Type partial date "7/8" of "7/8/2013" that + // the validation cell at A8 can accept + lcl_typeCharsInCell("7/8", 0, 7, pTabViewShell, pModelObj, + false /* bInEdit */, false /* bCommit */); // Type "7/8" in A8 + + uno::Sequence<beans::PropertyValue> aArgs; + comphelper::dispatchCommand(".uno:Save", aArgs); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_MESSAGE("Should not be marked modified after save", !pDocSh->IsModified()); + + // Complete the date in A8 by appending "/2013" and commit. + lcl_typeCharsInCell("/2013", 0, 7, pTabViewShell, pModelObj, + true /* bInEdit */, true /* bCommit */); + + // This would hang if the date entered "7/8/2013" is not acceptable. + Scheduler::ProcessEventsToIdle(); + + // Ensure that the correct date is recorded in the document. + CPPUNIT_ASSERT_EQUAL(double(41463), pDoc->GetValue(ScAddress(0, 7, 0))); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit 8159408dc2e3daeed1947342e546d87fbd3e1d09 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Fri Apr 1 14:50:42 2022 +0530 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 lok: avoid validation-dialog yield when saving Disable error dialog box when about to save in lok mode as this ultimately invokes SvpSalInstance::DoYield() when we want to save immediately without committing any erroneous input in possibly a cell with validation rules. After save is complete the user can continue editing. Conflicts: sc/source/ui/app/inputhdl.cxx Change-Id: Iffa0766ad594db75f57158986c4e1d2646f71da4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132410 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit e0175ee821eaff56c4b8e0a1b7afa1cabe0ab593) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132656 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 3d327387b75e..c9a37084d62b 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -198,7 +198,7 @@ public: bool IsInputMode(); // also for SC_INPUT_TYPE void SetInputMode( ScInputMode eMode, const OUString* pInitText = nullptr ); bool InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit = false ); - SC_DLLPUBLIC void InputEnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL ); + SC_DLLPUBLIC void InputEnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL, bool bBeforeSavingInLOK = false ); void InputCancelHandler(); void InputSelection( const EditView* pView ); void InputChanged( const EditView* pView ); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d844401a8807..30f18a075c7c 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3002,7 +3002,7 @@ static void lcl_SelectionToEnd( EditView* pView ) } } -void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) +void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInLOK ) { if (!mbDocumentDisposing && comphelper::LibreOfficeKit::isActive() && pActiveViewSh != SfxViewShell::Current()) @@ -3082,6 +3082,16 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) pSelEngine->ReleaseMouse(); } + if (bBeforeSavingInLOK) + { + // Invalid entry but not applied to the document model. + // Exit to complete the "save", leaving the edit view as it is + // for the user to continue after save. + bInOwnChange = false; + bInEnterHandler = false; + return; + } + if (pData->DoError(pActiveViewSh->GetFrameWeld(), aString, aCursorPos)) bForget = true; // Do not take over input } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index a5dbf216f0ec..508e05771c66 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1404,13 +1404,13 @@ bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit ) return pHdl && pHdl->KeyInput( rKEvt, bStartEdit ); } -void ScModule::InputEnterHandler( ScEnterMode nBlockMode ) +void ScModule::InputEnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInLOK ) { if ( !SfxGetpApp()->IsDowning() ) // Not when quitting the program { ScInputHandler* pHdl = GetInputHdl(); if (pHdl) - pHdl->EnterHandler( nBlockMode ); + pHdl->EnterHandler( nBlockMode, bBeforeSavingInLOK ); } } diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index fb3880e97a69..f66688a257ca 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -198,7 +198,7 @@ public: void MergeLanguageAttributes( ScEditEngineDefaulter& rDestEngine ) const; bool KeyInput( const KeyEvent& rKEvt, bool bStartEdit ); - void EnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL ); + void EnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL, bool bBeforeSavingInLOK = false ); void CancelHandler(); void SetReference( const ScRange& rRef, const ScDocument& rDoc ); void AddRefEntry(); diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 414a293d854d..209f935a729f 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -757,9 +757,16 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq ) // Finish entering unless 'DontTerminateEdit' is specified, even if a formula is being processed if (bCommitChanges) { - SC_MOD()->InputEnterHandler(); + bool bLOKActive = comphelper::LibreOfficeKit::isActive(); - if (comphelper::LibreOfficeKit::isActive()) + // Disable error dialog box when about to save in lok mode as + // this ultimately invokes SvpSalInstance::DoYield() when we want + // to save immediately without committing any erroneous input in possibly + // a cell with validation rules. After save is complete the user + // can continue editing. + SC_MOD()->InputEnterHandler(ScEnterMode::NORMAL, bLOKActive /* bBeforeSavingInLOK */); + + if (bLOKActive) { // Normally this isn't needed, but in Calc when editing a cell formula // and manually saving (without changing cells or hitting enter), while commit 33b08b859aef055e08f2e1397a4798521c12cdef Author: Adolfo Jayme Barrientos <fit...@ubuntu.com> AuthorDate: Thu Mar 24 01:02:52 2022 -0600 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 Clean up unused translatable strings These icon themes no longer exist, and these items are ignored anyway since the list was made dynamic in tdf#63962, back in 2014. Change-Id: I5a4dd5001b449f94775447f22b726b99a4fe63ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132025 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> (cherry picked from commit 19c215e948678c5c8809df6ce8052122b32c97d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132037 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui index fb330f2aa048..fdb2fde0d23d 100644 --- a/cui/uiconfig/ui/optviewpage.ui +++ b/cui/uiconfig/ui/optviewpage.ui @@ -416,10 +416,6 @@ <property name="hexpand">True</property> <items> <item translatable="yes" context="optviewpage|iconstyle">Automatic</item> - <item translatable="yes" context="optviewpage|iconstyle">Galaxy</item> - <item translatable="yes" context="optviewpage|iconstyle">High Contrast</item> - <item translatable="yes" context="optviewpage|iconstyle">Oxygen</item> - <item translatable="yes" context="optviewpage|iconstyle">Classic</item> <item translatable="yes" context="optviewpage|iconstyle">Sifr</item> <item translatable="yes" context="optviewpage|iconstyle">Breeze</item> </items> commit dd2e94b8859de4b7af9bf24973f6731501eea149 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Wed Apr 6 16:42:24 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 tdf#148491 Qt reconnect the QMenuBar close button When the QMenuBar of a QMainWindow is replaced, an existing corner widget is preserved / transferred, but its connections are still severed; a bit unexpected... The documentation for QMenuBar::setCornerWidget is not really clear what is happening, but the code has this nice comment: "// Reparent corner widgets before we delete the old menu". At least there is no need to explicitly delete the button. Still we must reconnect an existing button on each SetFrame. Regression from commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60 ("tdf#145954 Qt unshare QMenubar usage"). This includes commit 4a537cf77affc4f1f2e2e5be9ff0b1ff11724509 ("Qt drop unused QtMenu::mpCloseButton"). Change-Id: I13c31734e665b78231a08cd76ca6305122e08879 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132836 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit f751417b77e6573a0c639778e76ec943449f4573) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132894 Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx index f39be7e8d506..11f3f00c5aa6 100644 --- a/vcl/inc/qt5/QtMenu.hxx +++ b/vcl/inc/qt5/QtMenu.hxx @@ -49,7 +49,6 @@ private: std::unique_ptr<QMenu> mpOwnedQMenu; // pointer to QMenu owned by the corresponding QtMenuItem or self (-> mpOwnedQMenu) QMenu* mpQMenu; - QPushButton* mpCloseButton; void DoFullMenuUpdate(Menu* pMenuBar); static void NativeItemText(OUString& rItemText); diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index 44873ce3384d..9400f5e129bf 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -40,7 +40,6 @@ QtMenu::QtMenu(bool bMenuBar) , mbMenuBar(bMenuBar) , mpQMenuBar(nullptr) , mpQMenu(nullptr) - , mpCloseButton(nullptr) { } @@ -431,7 +430,9 @@ void QtMenu::SetFrame(const SalFrame* pFrame) mpQMenuBar = new QMenuBar(); pMainWindow->setMenuBar(mpQMenuBar); - mpCloseButton = nullptr; + QPushButton* pButton = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner)); + if (pButton) + connect(pButton, &QPushButton::clicked, this, &QtMenu::slotCloseDocument); mpQMenu = nullptr; DoFullMenuUpdate(mpVCLMenu); @@ -650,6 +651,8 @@ void QtMenu::ShowCloseButton(bool bShow) return; QPushButton* pButton = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner)); + if (!pButton && !bShow) + return; if (!pButton) { QIcon aIcon; @@ -665,7 +668,6 @@ void QtMenu::ShowCloseButton(bool bShow) pButton->setToolTip(toQString(VclResId(SV_HELPTEXT_CLOSEDOCUMENT))); mpQMenuBar->setCornerWidget(pButton, Qt::TopRightCorner); connect(pButton, &QPushButton::clicked, this, &QtMenu::slotCloseDocument); - mpCloseButton = pButton; } if (bShow) commit 4e565d4af74699721a53c146302f1256272d4996 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Mar 11 21:47:43 2022 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 an inconsistent SwTextFormatInfo index, len, text length case seen on loading sw/qa/python/testdocuments/TESTMETA.odt maybe since: commit 2f3684b2289a8c46dc6144064a452cc529400f28 Date: Tue Jul 31 16:00:02 2018 +0200 [API CHANGE] add some more asserts to the string functions but probably an underlying issue since conversion from UniString to OUString Change-Id: If731163fbc5e05b813ccd21df65164fe476cba9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131361 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index c366401c9153..6ef492c1b9d5 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -175,10 +175,18 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() ); pInf->SetIdx(TextFrameIndex(0)); } - else if (nIdx < TextFrameIndex(pOldText->getLength())) + else { - sal_Int32 const nFieldLen(pPor->GetFieldLen()); - aText = (*pOldText).replaceAt(sal_Int32(nIdx), nFieldLen, aText); + TextFrameIndex nEnd(pOldText->getLength()); + if (nIdx < nEnd) + { + sal_Int32 const nFieldLen(pPor->GetFieldLen()); + aText = (*pOldText).replaceAt(sal_Int32(nIdx), nFieldLen, aText); + } + else if (nIdx == nEnd) + aText = *pOldText + aText; + else + SAL_WARN("sw.core", "SwFieldSlot bad SwFieldPortion index."); } pInf->SetText( aText ); } commit e06274e4f76deddb59b4ca808bc5c7fa85bca61b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Apr 12 08:45:23 2022 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 ofz: Use-of-uninitialized-value Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132856 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 3d773e56d488..8825530e4d76 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1775,7 +1775,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicX = 0; tools::Long nMnemonicY = 0; DeviceCoordinate nMnemonicWidth = 0; - if ( nMnemonicPos != -1 ) + if (nMnemonicPos != -1 && nMnemonicPos < aStr.getLength()) { std::unique_ptr<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() ); commit e1179893ff4477e206850e0c2ed55cd372b8532f Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Apr 8 15:05:50 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 tdf#148423: Half a hack "Regression" introduced with de4d296619b978ec303f1d7b1e2c78e13fa7a512 "Avoid overflow in ScColumn::GetOptimalColWidth", which, for this bug document's nWidth/nPPTX = 6004/0.0647708 = 92696.1, changed the calculation of nTwips from the undefined-behavior 92696 % 65536 = 27161 to the clamped 65535, but which is apparently a value large enough to cause "silent" issues (i.e., not causing further undefined behavior) down the road, leading to a super-narrow column. That commit already wondered whether sal_uInt16 is a useful choice here, but lets keep that question unanswered and just clamp at half the previous value, which happens to cause presumably more pleasing results. Change-Id: I1df642b2b9d6818c8be0f8d8f4567a00c399c154 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132734 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 126b1826c465002dccc7c354a584731fa70ec5fd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132708 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 2fbf42388ead..aeb28bf2ae00 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -824,7 +824,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth( { nWidth += 2; sal_uInt16 nTwips = static_cast<sal_uInt16>( - std::min(nWidth / nPPTX, double(std::numeric_limits<sal_uInt16>::max()))); + std::min(nWidth / nPPTX, double(std::numeric_limits<sal_uInt16>::max() / 2))); return nTwips; } else commit a07740fcef9380ba34ff517ad753120b603846bc Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Mon Apr 11 17:07:36 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 tdf#148481 Map RefHand cursor to Qt::PointingHand Change-Id: I79c7008655f22737f92a4a6430f1380e81c1c386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132833 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> (cherry picked from commit 9ae398054833120df36bf51738cc4cfd7efb3fdc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132713 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/qt5/QtData.cxx b/vcl/qt5/QtData.cxx index e67abdd76224..a4b9141e43db 100644 --- a/vcl/qt5/QtData.cxx +++ b/vcl/qt5/QtData.cxx @@ -228,7 +228,7 @@ QCursor& QtData::getCursor(PointerStyle ePointerStyle) MAP_BUILTIN(PointerStyle::HSizeBar, Qt::SizeHorCursor); MAP_BUILTIN(PointerStyle::VSizeBar, Qt::SizeVerCursor); - MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor); + MAP_BUILTIN(PointerStyle::RefHand, Qt::PointingHandCursor); MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor); #if 0 MAP_BUILTIN( PointerStyle::Pen, GDK_PENCIL ); commit 98b1141544d45c75ecfaadce1b7491f900a957df Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Apr 9 09:56:23 2022 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:18 2022 +0200 ofz#46526 Abrt Change-Id: Iaec536b0989c4ec11b39b1534c7798e46715d7a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132704 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index c5da1d6b2477..2665469076d9 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -946,7 +946,7 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool { case DataType::DATE: { - if (aStr.getLength() != nLen) + if (nLen < 8 || aStr.getLength() != nLen) { (*_rRow)[i]->setNull(); break; commit 4071b01d2f5a1e18c06547502b88154dfcbf9840 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Thu Apr 7 20:59:08 2022 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:17 2022 +0200 tdf#95706: RTF import: tolerant font table parsing While font name in font table should end with semicolon ({\fonttbl{\f42 Arial;}}) it is not always true and MS Word is tolerant to it: it still able to parse this correctly. Seems LO also should not require strict spec conformance. So idea of font parsing is changed: instead of inserting font on semicolon, it is done on next \fN or destination end. All collected text to this moment is a font name. Change-Id: I6b41951217442a71fd2ebbfc58a3fc79f6f913db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132686 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 844be7358f1eec00094a55fa1fb4fadadb8cd1bf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132699 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/rtfexport/data/tdf95706_2.rtf b/sw/qa/extras/rtfexport/data/tdf95706_2.rtf new file mode 100644 index 000000000000..d36d2ccd2396 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf95706_2.rtf @@ -0,0 +1,17 @@ +{\rtf\ansi +{\fonttbl +{\f1 Arial} +\f2 Impact +\f3 T\'69mes New Roman +\f4 T +a +h +o +m +a +} +\pard\f1\fs26 Arial\par +\pard\f2\fs26 Impact\par +\pard\f3\fs26 Times New Roman\par +\pard\f4\fs26 Tahoma\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index ecb070e58ee3..36c908c222bd 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -523,6 +523,18 @@ DECLARE_RTFEXPORT_TEST(testTdf95706, "tdf95706.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(xRun16, "CharFontName")); } +DECLARE_RTFEXPORT_TEST(testTdf95706_2, "tdf95706_2.rtf") +{ + CPPUNIT_ASSERT_EQUAL(OUString("Arial"), + getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Impact"), + getProperty<OUString>(getRun(getParagraph(2), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), + getProperty<OUString>(getRun(getParagraph(3), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Tahoma"), + getProperty<OUString>(getRun(getParagraph(4), 1), "CharFontName")); +} + DECLARE_RTFEXPORT_TEST(testTdf111851, "tdf111851.rtf") { uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index b3c04bb0f1f1..ca092fb66a37 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -762,6 +762,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (m_aStates.top().getDestination() == Destination::FONTTABLE || m_aStates.top().getDestination() == Destination::FONTENTRY) { + // Some text in buffer? It is font name. So previous font definition is complete + if (m_aStates.top().getCurrentDestinationText()->getLength()) + handleFontTableEntry(); + m_aFontIndexes.push_back(nParam); m_nCurrentFontIndex = getFontIndex(nParam); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 8ea858abada5..9e77cbf4602e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1332,6 +1332,74 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) } } +void RTFDocumentImpl::handleFontTableEntry() +{ + OUString aName = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); + + if (aName.isEmpty()) + return; + + if (aName.endsWith(";")) + { + aName = aName.copy(0, aName.getLength() - 1); + } + + // Old documents can contain no encoding information in fontinfo, + // but there can be font name suffixes: Arial CE is not a special + // font, it is ordinal Arial, but with used cp 1250 encoding. + // Moreover these suffixes have priority over \cpgN and \fcharsetN + // in MS Word. + OUString aFontSuffix; + OUString aNameNoSuffix(aName); + sal_Int32 nLastSpace = aName.lastIndexOf(' '); + if (nLastSpace >= 0) + { + aFontSuffix = aName.copy(nLastSpace + 1); + aNameNoSuffix = aName.copy(0, nLastSpace); + sal_Int32 nEncoding = RTL_TEXTENCODING_DONTKNOW; + for (int i = 0; aRTFFontNameSuffixes[i].codepage != RTL_TEXTENCODING_DONTKNOW; i++) + { + if (aFontSuffix.equalsAscii(aRTFFontNameSuffixes[i].suffix)) + { + nEncoding = aRTFFontNameSuffixes[i].codepage; + break; + } + } + if (nEncoding > RTL_TEXTENCODING_DONTKNOW) + { + m_nCurrentEncoding = nEncoding; + m_aStates.top().setCurrentEncoding(m_nCurrentEncoding); + } + else + { + // Unknown suffix: looks like it is just a part of font name, restore it + aNameNoSuffix = aName; + } + } + + m_aFontNames[m_nCurrentFontIndex] = aNameNoSuffix; + if (m_nCurrentEncoding >= 0) + { + m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding; + m_nCurrentEncoding = -1; + } + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_Font_name, + new RTFValue(aNameNoSuffix)); + + writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties( + m_aStates.top().getTableAttributes(), m_aStates.top().getTableSprms())); + + //See fdo#47347 initial invalid font entry properties are inserted first, + //so when we attempt to insert the correct ones, there's already an + //entry in the map for them, so the new ones aren't inserted. + auto lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex); + if (lb != m_aFontTableEntries.end() + && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first))) + lb->second = pProp; + else + m_aFontTableEntries.insert(lb, std::make_pair(m_nCurrentFontIndex, pProp)); +} + void RTFDocumentImpl::text(OUString& rString) { if (rString.getLength() == 1 && m_aStates.top().getDestination() != Destination::DOCCOMM) @@ -1345,10 +1413,7 @@ void RTFDocumentImpl::text(OUString& rString) bool bRet = true; switch (m_aStates.top().getDestination()) { - // Note: in fonttbl there may or may not be groups; in stylesheet - // and revtbl groups are mandatory - case Destination::FONTTABLE: - case Destination::FONTENTRY: + // Note: in stylesheet and revtbl groups are mandatory case Destination::STYLEENTRY: case Destination::LISTNAME: case Destination::REVISIONENTRY: @@ -1368,68 +1433,6 @@ void RTFDocumentImpl::text(OUString& rString) = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); switch (m_aStates.top().getDestination()) { - case Destination::FONTTABLE: - case Destination::FONTENTRY: - { - // Old documents can contain no encoding information in fontinfo, - // but there can be font name suffixes: Arial CE is not a special - // font, it is ordinal Arial, but with used cp 1250 encoding. - // Moreover these suffixes have priority over \cpgN and \fcharsetN - // in MS Word. - OUString aFontSuffix; - OUString aNameNoSuffix(aName); - sal_Int32 nLastSpace = aName.lastIndexOf(' '); - if (nLastSpace >= 0) - { - aFontSuffix = aName.copy(nLastSpace + 1); - aNameNoSuffix = aName.copy(0, nLastSpace); - sal_Int32 nEncoding = RTL_TEXTENCODING_DONTKNOW; - for (int i = 0; - aRTFFontNameSuffixes[i].codepage != RTL_TEXTENCODING_DONTKNOW; i++) - { - if (aFontSuffix.equalsAscii(aRTFFontNameSuffixes[i].suffix)) - { - nEncoding = aRTFFontNameSuffixes[i].codepage; - break; - } - } - if (nEncoding > RTL_TEXTENCODING_DONTKNOW) - { - m_nCurrentEncoding = nEncoding; - m_aStates.top().setCurrentEncoding(m_nCurrentEncoding); - } - else - { - // Unknown suffix: looks like it is just a part of font name, restore it - aNameNoSuffix = aName; - } - } - - m_aFontNames[m_nCurrentFontIndex] = aNameNoSuffix; - if (m_nCurrentEncoding >= 0) - { - m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding; - m_nCurrentEncoding = -1; - } - m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_Font_name, - new RTFValue(aNameNoSuffix)); - - writerfilter::Reference<Properties>::Pointer_t const pProp( - new RTFReferenceProperties(m_aStates.top().getTableAttributes(), - m_aStates.top().getTableSprms())); - - //See fdo#47347 initial invalid font entry properties are inserted first, - //so when we attempt to insert the correct ones, there's already an - //entry in the map for them, so the new ones aren't inserted. - auto lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex); - if (lb != m_aFontTableEntries.end() - && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first))) - lb->second = pProp; - else - m_aFontTableEntries.insert(lb, - std::make_pair(m_nCurrentFontIndex, pProp)); - } - break; case Destination::STYLEENTRY: { RTFValue::Pointer_t pType @@ -1467,6 +1470,8 @@ void RTFDocumentImpl::text(OUString& rString) } } break; + case Destination::FONTTABLE: + case Destination::FONTENTRY: case Destination::LEVELTEXT: case Destination::SHAPEPROPERTYNAME: case Destination::SHAPEPROPERTYVALUE: @@ -2216,17 +2221,26 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) { switch (rState.getDestination()) { + //Note: in fonttbl there may or may not be groups, so process it as no groups case Destination::FONTTABLE: + case Destination::FONTENTRY: { - writerfilter::Reference<Table>::Pointer_t const pTable( - new RTFReferenceTable(m_aFontTableEntries)); - Mapper().table(NS_ooxml::LN_FONTTABLE, pTable); - if (m_nDefaultFontIndex >= 0) + // Some text unhandled? Seems it is last font name + if (m_aStates.top().getCurrentDestinationText()->getLength()) + handleFontTableEntry(); + + if (rState.getDestination() == Destination::FONTTABLE) { - auto pValue = new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); - putNestedAttribute(m_aDefaultState.getCharacterSprms(), - NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, - pValue); + writerfilter::Reference<Table>::Pointer_t const pTable( + new RTFReferenceTable(m_aFontTableEntries)); + Mapper().table(NS_ooxml::LN_FONTTABLE, pTable); + if (m_nDefaultFontIndex >= 0) + { + auto pValue = new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); + putNestedAttribute(m_aDefaultState.getCharacterSprms(), + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, + pValue); + } } } break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 66e27a509be5..14ffc2f630a4 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -777,6 +777,7 @@ private: writerfilter::Reference<Properties>::Pointer_t getProperties(const RTFSprms& rAttributes, RTFSprms const& rSprms, Id nStyleType); void checkNeedPap(); + void handleFontTableEntry(); void sectBreak(bool bFinal = false); void prepareProperties(RTFParserState& rState, writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties, commit 1cf1a837869794376b7c57c74fc14f0f55a7f314 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Apr 5 21:50:30 2022 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Apr 14 13:55:17 2022 +0200 Related tdf#148384: do not pause after last email's failure In this case, SwSendMailDialog::AllMailsSent will keep the dialog open anyway, to allow to see the resulting report containing errors. Change-Id: I351a5da01c3ab50677be1d735b261d8e5516cb43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132588 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 6453502fa8d3cc83e066c550d8df98facb1f4471) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132605 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 5a7ba198d6b1..dcf17151eca5 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -463,8 +463,8 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> const & bool bResult, const OUString* pError ) { - //sending should stop on send errors - if(pError && + //sending should stop on send errors, except after last error - it will stop in AllMailsSent + if (pError && m_nSendCount + 1 < m_nExpectedCount && m_pImpl->xMailDispatcher.is() && m_pImpl->xMailDispatcher->isStarted()) { Application::PostUserEvent( LINK( this, SwSendMailDialog,