basctl/source/basicide/baside3.cxx | 2 chart2/source/controller/dialogs/tp_Scale.cxx | 7 + include/sfx2/dialoghelper.hxx | 5 - oox/inc/drawingml/table/tablecell.hxx | 2 oox/source/drawingml/table/tablecell.cxx | 106 ++++++++++++++++++++++--- oox/source/drawingml/table/tableproperties.cxx | 16 +++ oox/source/export/shapes.cxx | 6 + sc/qa/unit/tiledrendering/tiledrendering.cxx | 30 ++++++- sc/source/ui/docshell/impex.cxx | 2 sc/source/ui/miscdlgs/sharedocdlg.cxx | 6 - sd/qa/unit/data/pptx/bnc480256-2.pptx |binary sd/qa/unit/data/pptx/tdf135843_insideH.pptx |binary sd/qa/unit/export-tests.cxx | 3 sd/qa/unit/layout-tests.cxx | 38 ++++++++ sfx2/source/dialog/dialoghelper.cxx | 8 - sfx2/source/dialog/versdlg.cxx | 8 - ucb/source/ucp/webdav-curl/CurlSession.cxx | 20 ++++ vcl/inc/qt5/QtFrame.hxx | 3 vcl/inc/qt5/QtWidget.hxx | 2 vcl/qt5/QtFrame.cxx | 8 + vcl/qt5/QtWidget.cxx | 19 ++++ vcl/win/window/salframe.cxx | 5 - 22 files changed, 258 insertions(+), 38 deletions(-)
New commits: commit 5041e2901513b46df7881d492ebe941324793a69 Author: Michael Stahl <[email protected]> AuthorDate: Wed Apr 13 16:50:30 2022 +0200 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:12 2022 +0200 ucb: webdav-curl: only allow system credentials for auth once ... and in any case abort authentication after 10 failed attempts. Apparently some PasswordContainer can turn this into an infinite loop. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132974 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 2bc4d1d22fdbd9d97c66bb53762b4b4bf7b61b47) ucb: webdav-curl: oops, increment after checking Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132982 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins (cherry picked from commit ab65a74998b498ff49c15db87fc14a9afa89d8bf) Change-Id: Ib2333b371a770999e8407ce7e1af21512aadb70d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132867 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 70f9f828467d..813988c78489 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -1223,6 +1223,8 @@ auto CurlProcessor::ProcessRequest( } } bool isRetry(false); + int nAuthRequests(0); + int nAuthRequestsProxy(0); // libcurl does not have an authentication callback so handle auth // related status codes and requesting credentials via this loop @@ -1365,7 +1367,14 @@ auto CurlProcessor::ProcessRequest( case SC_UNAUTHORIZED: case SC_PROXY_AUTHENTICATION_REQUIRED: { - if (pEnv && pEnv->m_xAuthListener) + auto& rnAuthRequests(statusCode == SC_UNAUTHORIZED ? nAuthRequests + : nAuthRequestsProxy); + if (rnAuthRequests == 10) + { + SAL_INFO("ucb.ucp.webdav.curl", "aborting authentication after " + << rnAuthRequests << " attempts"); + } + else if (pEnv && pEnv->m_xAuthListener) { ::std::optional<OUString> const oRealm(ExtractRealm( headers, statusCode == SC_UNAUTHORIZED ? "WWW-Authenticate" @@ -1383,7 +1392,14 @@ auto CurlProcessor::ProcessRequest( &authAvail); assert(rc == CURLE_OK); (void)rc; - bool const isSystemCredSupported((authAvail & authSystem) != 0); + // only allow SystemCredentials once - the + // PasswordContainer may have stored it in the + // Config (TrySystemCredentialsFirst or + // AuthenticateUsingSystemCredentials) and then it + // will always force its use no matter how hopeless + bool const isSystemCredSupported((authAvail & authSystem) != 0 + && rnAuthRequests == 0); + ++rnAuthRequests; // Ask user via XInteractionHandler. // Warning: This likely runs an event loop which may commit 43bb6472ef3942585f0991ee02a64565e8c751c6 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Apr 13 16:49:27 2022 +0100 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:12 2022 +0200 Resolves: tdf#141625 give enough space to see full date+time Change-Id: I31193783231f27494ed1507faa143697e8facc30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132987 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index 6c7effde6707..3bb247a7075b 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -26,6 +26,7 @@ #include <svx/svxids.hrc> #include <osl/diagnose.h> +#include <sfx2/dialoghelper.hxx> #include <svx/chrtitem.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> @@ -558,6 +559,12 @@ void ScaleTabPage::SetNumFormat() nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME, pFormat->GetLanguage() ); else nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME ); + + // tdf#141625 give enough space to see full date+time + int nWidestTime(m_xFmtFldMin->get_pixel_size(getWidestDateTime(Application::GetSettings().GetLocaleDataWrapper(), true)).Width()); + int nWidthChars = std::ceil(nWidestTime / m_xFmtFldMin->get_approximate_digit_width()) + 1; + m_xFmtFldMin->set_width_chars(nWidthChars); + m_xFmtFldMax->set_width_chars(nWidthChars); } if( m_nAxisType == chart2::AxisType::DATE && ( eType != SvNumFormatType::DATE && eType != SvNumFormatType::DATETIME) ) diff --git a/include/sfx2/dialoghelper.hxx b/include/sfx2/dialoghelper.hxx index e76304ac6808..a853d5d9de5c 100644 --- a/include/sfx2/dialoghelper.hxx +++ b/include/sfx2/dialoghelper.hxx @@ -31,9 +31,10 @@ Size SFX2_DLLPUBLIC getPreviewStripSize(const OutputDevice& rReference); Size SFX2_DLLPUBLIC getPreviewOptionsSize(const OutputDevice& rReference); -OUString SFX2_DLLPUBLIC getWidestTime(const LocaleDataWrapper& rWrapper); +OUString SFX2_DLLPUBLIC getWidestDateTime(const LocaleDataWrapper& rWrapper, bool bWithSec); -OUString SFX2_DLLPUBLIC formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper); +OUString SFX2_DLLPUBLIC formatDateTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper, + bool bWithSec); #endif diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index ec019fb70655..294a69e93c2b 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star; IMPL_LINK(ScShareDocumentDlg, SizeAllocated, const Size&, rSize, void) { - OUString sWidestAccessString = getWidestTime(ScGlobal::getLocaleData()); + OUString sWidestAccessString = getWidestDateTime(ScGlobal::getLocaleData(), false); const int nAccessWidth = m_xLbUsers->get_pixel_size(sWidestAccessString).Width() * 2; std::vector<int> aWidths { @@ -151,7 +151,7 @@ void ScShareDocumentDlg::UpdateView() tools::Time aTime( nHours, nMinutes ); DateTime aDateTime( aDate, aTime ); - OUString aString = formatTime(aDateTime, ScGlobal::getLocaleData()); + OUString aString = formatDateTime(aDateTime, ScGlobal::getLocaleData(), false); m_xLbUsers->append_text(aUser); m_xLbUsers->set_text(m_xLbUsers->n_children() - 1, aString, 1); @@ -201,7 +201,7 @@ void ScShareDocumentDlg::UpdateView() util::DateTime uDT(xDocProps->getModificationDate()); DateTime aDateTime(uDT); - OUString aString = formatTime(aDateTime, ScGlobal::getLocaleData()) + " " + + OUString aString = formatDateTime(aDateTime, ScGlobal::getLocaleData(), false) + " " + ScGlobal::getLocaleData().getTime( aDateTime, false ); m_xLbUsers->append_text(aUser); diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx index 93e697b29517..9585c8baac80 100644 --- a/sfx2/source/dialog/dialoghelper.cxx +++ b/sfx2/source/dialog/dialoghelper.cxx @@ -32,17 +32,17 @@ Size getPreviewOptionsSize(const OutputDevice& rReference) return rReference.LogicToPixel(Size(70, 27), MapMode(MapUnit::MapAppFont)); } -OUString getWidestTime(const LocaleDataWrapper& rWrapper) +OUString getWidestDateTime(const LocaleDataWrapper& rWrapper, bool bWithSec) { Date aDate(22, 12, 2000); tools::Time aTime(22, 59, 59); DateTime aDateTime(aDate, aTime); - return formatTime(aDateTime, rWrapper); + return formatDateTime(aDateTime, rWrapper, bWithSec); } -OUString formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper) +OUString formatDateTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper, bool bWithSec) { - return rWrapper.getDate(rDateTime) + " " + rWrapper.getTime(rDateTime, false); + return rWrapper.getDate(rDateTime) + " " + rWrapper.getTime(rDateTime, bWithSec); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 6de0d866c30b..53ea62b0eccd 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -115,7 +115,7 @@ namespace void setColSizes(weld::TreeView& rVersionBox) { // recalculate the datetime column width - int nWidestTime(rVersionBox.get_pixel_size(getWidestTime(Application::GetSettings().GetLocaleDataWrapper())).Width()); + int nWidestTime(rVersionBox.get_pixel_size(getWidestDateTime(Application::GetSettings().GetLocaleDataWrapper(), false)).Width()); int nW1 = rVersionBox.get_pixel_size(rVersionBox.get_column_title(1)).Width(); int nMax = std::max(nWidestTime, nW1) + 12; // max width + a little offset @@ -217,7 +217,7 @@ void SfxVersionDialog::Init_Impl() for (size_t n = 0; n < m_pTable->size(); ++n) { SfxVersionInfo *pInfo = m_pTable->at( n ); - OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); + OUString aEntry = formatDateTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper(), false); m_xVersionBox->append(OUString::number(reinterpret_cast<sal_Int64>(pInfo)), aEntry); auto nLastRow = m_xVersionBox->n_children() - 1; m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1); @@ -394,7 +394,7 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(weld::Window *pParent, SfxV OUString sAuthor = rInfo.aAuthor.isEmpty() ? SfxResId(STR_NO_NAME_SET) : rInfo.aAuthor; const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - m_xDateTimeText->set_label(m_xDateTimeText->get_label() + formatTime(rInfo.aCreationDate, rLocaleWrapper)); + m_xDateTimeText->set_label(m_xDateTimeText->get_label() + formatDateTime(rInfo.aCreationDate, rLocaleWrapper, false)); m_xSavedByText->set_label(m_xSavedByText->get_label() + sAuthor); m_xEdit->set_text(rInfo.aComment); m_xEdit->set_size_request(40 * m_xEdit->get_approximate_digit_width(), @@ -459,7 +459,7 @@ void SfxCmisVersionsDialog::LoadVersions() for (size_t n = 0; n < m_pTable->size(); ++n) { SfxVersionInfo *pInfo = m_pTable->at( n ); - OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); + OUString aEntry = formatDateTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper(), false); m_xVersionBox->append(OUString::number(reinterpret_cast<sal_Int64>(pInfo)), aEntry); auto nLastRow = m_xVersionBox->n_children() - 1; m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1); commit d3842b708a71bcadddf79a518de1175b622a4917 Author: Jan-Marek Glogowski <[email protected]> AuthorDate: Tue Apr 12 00:29:56 2022 +0200 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:11 2022 +0200 tdf#148115 Qt handle tooltips via event loop Instead of calling QToolTip::showText directly from LO, this defers showing the tooltip to the QEvent processing, which takes the tooltip timeouts into account. So tooltips are shown with a slight delay, therefore they happen less fast on mouse move, reducing / avoiding artifacts of fast changing windows. This unfortunately comes with yet an other hack in the area of our fake popup windows... New handling is based on the code of the Qt Tool Tips example. Change-Id: I42634ad36dd12171c30f52f07a02a88d3c48a718 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132841 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins (cherry picked from commit af6dd54d53eee0d0de1164bff0a77c6b433b3935) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132864 Reviewed-by: Jan-Marek Glogowski <[email protected]> diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index 5ffaacf3ad94..23a4fd9887f1 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -111,6 +111,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame LanguageType m_nInputLanguage; + OUString m_aTooltipText; + QRect m_aTooltipArea; + void SetDefaultPos(); Size CalcDefaultSize(); void SetDefaultSize(); diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx index 575cef11014f..878c8b1229ce 100644 --- a/vcl/inc/qt5/QtWidget.hxx +++ b/vcl/inc/qt5/QtWidget.hxx @@ -87,7 +87,7 @@ public: void endExtTextInput(); void fakeResize(); - static bool handleEvent(QtFrame&, const QWidget&, QEvent*); + static bool handleEvent(QtFrame&, QWidget&, QEvent*); // key events might be propagated further down => call base on false static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*); // mouse events are always accepted diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index c78417b3070a..f6f4b6c2611d 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -175,7 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) m_pTopLevel->setFocusProxy(m_pQWidget); } else + { m_pQWidget = new QtWidget(*this, aWinFlags); + // from Qt's POV the popup window doesn't have the input focus, so we must force tooltips... + if (isPopup()) + m_pQWidget->setAttribute(Qt::WA_AlwaysShowToolTips); + } QWindow* pChildWindow = windowHandle(); connect(pChildWindow, &QWindow::screenChanged, this, &QtFrame::screenChanged); @@ -855,7 +860,8 @@ bool QtFrame::ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpAr QRect aHelpArea(toQRect(rHelpArea)); if (QGuiApplication::isRightToLeft()) aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - aHelpArea.left() - 1); - QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, aHelpArea); + m_aTooltipText = rText; + m_aTooltipArea = aHelpArea; return true; } diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 1fe2ce9a7159..017249b05434 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -42,6 +42,7 @@ #include <QtGui/QTextCharFormat> #include <QtGui/QWheelEvent> #include <QtWidgets/QMainWindow> +#include <QtWidgets/QToolTip> #include <QtWidgets/QWidget> #include <cairo.h> @@ -562,7 +563,7 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent return bStopProcessingKey; } -bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& rWidget, QEvent* pEvent) +bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) { if (pEvent->type() == QEvent::ShortcutOverride) { @@ -589,6 +590,22 @@ bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& rWidget, QEvent* pEve ButtonKeyState::Pressed)) return true; } + else if (pEvent->type() == QEvent::ToolTip) + { + // Qt's POV on focus is wrong for our fake popup windows, so check LO's state. + // Otherwise Qt will continue handling ToolTip events from the "parent" window. + const vcl::Window* pFocusWin = Application::GetFocusWindow(); + if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin + && pFocusWin->GetFrameWindow() == rFrame.GetWindow()) + QToolTip::showText(QCursor::pos(), toQString(rFrame.m_aTooltipText), &rWidget, + rFrame.m_aTooltipArea); + else + { + QToolTip::hideText(); + pEvent->ignore(); + } + return true; + } return false; } commit 255de49a7a38d1d64d4e4d6c82cf26f05b3d0e9f Author: Mark Hung <[email protected]> AuthorDate: Mon Apr 4 20:12:36 2022 +0800 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:11 2022 +0200 tdf#143447 ignore IME candidate window state. Some traditional Chinese IMEs ( Input Method Editors ) under Windows10 send WM_IME_NOTIFY with IMN_OPENCANDIDATE but not IMN_CLOSECANDIDATE. The behavior is different if users configure the IME and enable "legacy" option. That caused the cursor been hidden, misled by mbCandidateMode. The patch ignores the candidate window mode in case the length of the composition string is 0, assume in that case candidate window is useless, and resets the candidate window mode when composition ended to maintain the state as much as we can. Change-Id: I91a1c23ee1a031313243e032653f50f39b0f2a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132512 Tested-by: Jenkins Reviewed-by: Mark Hung <[email protected]> (cherry picked from commit 2b2d1c08c94fdc3982971c2b19ea241f05e578c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132858 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 6593b2fbebb6..4556c850edec 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5079,7 +5079,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame, if ( (nTextLen > 0) || !(lParam & GCS_RESULTSTR) ) { // End the mode, if the last character is deleted - if ( !nTextLen && !pFrame->mbCandidateMode ) + if ( !nTextLen ) { pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt ); pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr ); @@ -5164,7 +5164,10 @@ static bool ImplHandleIMEEndComposition( HWND hWnd ) if ( pFrame && pFrame->mbHandleIME ) { if ( pFrame->mbAtCursorIME ) + { + pFrame->mbCandidateMode = false; bDef = false; + } } ImplSalYieldMutexRelease(); commit 5e046e3a9ebc95792c1c54cf91f520ece6339c6e Author: Caolán McNamara <[email protected]> AuthorDate: Tue Apr 12 12:26:54 2022 +0100 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:11 2022 +0200 ofz#46352 assert on bad string offset Change-Id: I60123fd0460b8038f08582a0bcbf2307af321df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132861 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index f98847bd4e18..a422901bc329 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2351,7 +2351,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) aFormats.push_back( nKey ); } } - else if( cTag == 'I' && *p == 'D' ) + else if (cTag == 'I' && *p == 'D' && aLine.getLength() > 4) { aLine = aLine.copy(4); if (aLine == "CALCOOO32") commit c6c3a6c3fdf18de7b24863bb949f8d1a69b2d39e Author: Gülşah Köse <[email protected]> AuthorDate: Mon Mar 14 14:52:59 2022 +0300 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:11 2022 +0200 tdf#147766 Export empty lines as line with noFill We have a case that 0 width line but has auto color. If that case exported there is no line over there, LO handles normally but MSO draws back borders as default. To prevent this we have to export them as line with noFill. testTableBorderLineStyle change reverts a workaround for 3faf005a367cbd28077403bf93810bbaf4805851 testBnc480256 Cell(1,0) still invisible. We are just checking this with another way. Change-Id: If5f6d2dbdba5c295d58307fcfe3b37629ede8a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131532 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> Reviewed-by: Gülşah Köse <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132886 diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 15ab06303e3b..fdf7950dcf2c 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -73,20 +73,12 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } - else if ( rLineProperties.moLineWidth.get(0)!=0 ) - { - aBorderLine.Color = sal_Int32( COL_AUTO ); - aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); - aBorderLine.LineDistance = 0; - } else { aBorderLine.Color = sal_Int32( COL_AUTO ); aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.LineWidth = 12700; + aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 138106938ee2..97d09ca1be2e 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1975,6 +1975,12 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) ); mpFS->endElementNS( XML_a, XML_line ); } + else if( nBorderWidth == 0) + { + mpFS->startElementNS(XML_a, XML_line); + mpFS->singleElementNS(XML_a, XML_noFill); + mpFS->endElementNS( XML_a, XML_line ); + } } void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPropSet) diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index f1d0281aab0d..729d9f154b12 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -602,9 +602,10 @@ void SdExportTest::testBnc480256() xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(Color(0x4697e0), nColor); + // This border should be invisible. xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("BottomBorder") >>= aBorderLine; - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, aBorderLine.Color)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sal_Int32(aBorderLine.LineWidth)); xDocShRef->DoClose(); } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c7b508de5dc3..e49892d3a738 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1474,7 +1474,7 @@ void SdImportTest::testTableBorderLineStyle() xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("TopBorder") >>= aBorderLine; - if (aBorderLine.Color != -1) { + if (aBorderLine.LineWidth > 0) { CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle); } } commit 6adb8e3e72bcc3fbbaa2a09e6cda8a22a72c0f50 Author: Gülşah Köse <[email protected]> AuthorDate: Mon Apr 11 18:33:30 2022 +0300 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:10 2022 +0200 Revert "Revert "tdf#135843 Implement inside horizontal vertical borders."" This reverts commit ea5a3e0247b1230c1fe7e2cb0afc597e56d0b4c2. Change-Id: Ibd333c1e7b1530a2b6d9b8c5efbf4d9c822fa058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132885 Tested-by: Jenkins Reviewed-by: Gülşah Köse <[email protected]> diff --git a/oox/inc/drawingml/table/tablecell.hxx b/oox/inc/drawingml/table/tablecell.hxx index d6e91da042f7..988b0d057a13 100644 --- a/oox/inc/drawingml/table/tablecell.hxx +++ b/oox/inc/drawingml/table/tablecell.hxx @@ -82,6 +82,8 @@ private: oox::drawingml::LineProperties maLinePropertiesRight; oox::drawingml::LineProperties maLinePropertiesTop; oox::drawingml::LineProperties maLinePropertiesBottom; + oox::drawingml::LineProperties maLinePropertiesInsideH; + oox::drawingml::LineProperties maLinePropertiesInsideV; oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight; oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight; diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index e5ab3372d42e..15ab06303e3b 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -81,6 +81,14 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } + else + { + aBorderLine.Color = sal_Int32( COL_AUTO ); + aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); + aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); + aBorderLine.LineWidth = 12700; + aBorderLine.LineDistance = 0; + } if ( rLineProperties.moPresetDash.has() ) { @@ -150,9 +158,16 @@ static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, oox::drawingml::LineProperties& rRightBorder, oox::drawingml::LineProperties& rTopBorder, oox::drawingml::LineProperties& rBottomBorder, + oox::drawingml::LineProperties& rInsideHBorder, + oox::drawingml::LineProperties& rInsideVBorder, oox::drawingml::LineProperties& rTopLeftToBottomRightBorder, oox::drawingml::LineProperties& rBottomLeftToTopRightBorder, - TableStylePart& rTableStylePart ) + TableStylePart& rTableStylePart, + bool bIsWholeTable = false, + sal_Int32 nCol = 0, + sal_Int32 nMaxCol = 0, + sal_Int32 nRow = 0, + sal_Int32 nMaxRow = 0) { ::oox::drawingml::FillPropertiesPtr& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() ); if ( rPartFillPropertiesPtr ) @@ -169,12 +184,35 @@ static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, } } - applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder ); - applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder ); - applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder ); - applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder ); - applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder ); - applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder ); + // Left, right, top and bottom side of the whole table should be mean outer frame of the whole table. + // Without this check it means left top right and bottom of whole cells of whole table. + if (bIsWholeTable) + { + if (nCol == 0) + applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder ); + if (nCol == nMaxCol) + applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder ); + if (nRow == 0) + applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder ); + if (nRow == nMaxRow) + applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder ); + + applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder ); + } + else + { + applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder ); + } aTextCharProps.maLatinFont = rTableStylePart.getLatinFont(); aTextCharProps.maAsianFont = rTableStylePart.getAsianFont(); @@ -233,6 +271,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons oox::drawingml::LineProperties aLinePropertiesRight; oox::drawingml::LineProperties aLinePropertiesTop; oox::drawingml::LineProperties aLinePropertiesBottom; + oox::drawingml::LineProperties aLinePropertiesInsideH; + oox::drawingml::LineProperties aLinePropertiesInsideV; oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight; oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight; @@ -241,9 +281,16 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, - rTable.getWholeTbl() ); + rTable.getWholeTbl(), + true, + nColumn, + nMaxColumn, + nRow, + nMaxRow ); if ( rProperties.isFirstRow() && ( nRow == 0 ) ) { @@ -252,6 +299,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getFirstRow() ); @@ -263,6 +312,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getLastRow() ); @@ -274,6 +325,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getFirstCol() ); @@ -285,6 +338,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getLastCol() ); @@ -306,6 +361,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getBand2H() ); @@ -317,6 +374,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getBand1H() ); @@ -330,6 +389,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getNwCell() ); @@ -341,6 +402,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getSwCell() ); @@ -352,6 +415,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getNeCell() ); @@ -363,6 +428,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getSeCell() ); @@ -384,6 +451,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getBand2V() ); @@ -395,6 +464,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight, aLinePropertiesTop, aLinePropertiesBottom, + aLinePropertiesInsideH, + aLinePropertiesInsideV, aLinePropertiesTopLeftToBottomRight, aLinePropertiesBottomLeftToTopRight, rTable.getBand1V() ); @@ -405,8 +476,11 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aLinePropertiesRight.assignUsed( maLinePropertiesRight ); aLinePropertiesTop.assignUsed( maLinePropertiesTop ); aLinePropertiesBottom.assignUsed( maLinePropertiesBottom ); + aLinePropertiesInsideH.assignUsed( maLinePropertiesInsideH ); + aLinePropertiesInsideV.assignUsed( maLinePropertiesInsideV ); aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight ); aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight ); + applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder ); applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder ); applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder ); @@ -414,6 +488,28 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR ); applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR ); + // Convert insideH to Top and Bottom, InsideV to Left and Right. Exclude the outer borders. + if(nRow != 0) + { + aLinePropertiesInsideH.assignUsed( aLinePropertiesTop ); + applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideH, PROP_TopBorder ); + } + if(nRow != nMaxRow) + { + aLinePropertiesInsideH.assignUsed( aLinePropertiesBottom ); + applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideH, PROP_BottomBorder ); + } + if(nColumn != 0) + { + aLinePropertiesInsideV.assignUsed( aLinePropertiesLeft ); + applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideV, PROP_LeftBorder ); + } + if(nColumn != nMaxColumn) + { + aLinePropertiesInsideV.assignUsed( aLinePropertiesRight ); + applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideV, PROP_RightBorder ); + } + if (rProperties.getBgColor().isUsed() && !maFillProperties.maFillColor.isUsed() && maFillProperties.moFillType.get() == XML_noFill) { maFillProperties.moFillType = XML_solidFill; diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index 1622b8fc22ca..2c45004b3357 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -143,7 +143,8 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas { sal_Int32 nColumn = 0; sal_Int32 nColumnSize = tableRow.getTableCells().size(); - sal_Int32 nRemovedColumn = 0; // + sal_Int32 nRemovedColumn = 0; + sal_Int32 nRemovedRow = 0; for (sal_Int32 nColIndex = 0; nColIndex < nColumnSize; nColIndex++) { @@ -169,6 +170,9 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas // props with pushToXCell. bMerged = true; } + + if (rTableCell.getRowSpan() > 1) + nRemovedRow = (rTableCell.getRowSpan() - 1); } Reference<XCellRange> xCellRange(xTable, UNO_QUERY_THROW); @@ -190,11 +194,17 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas else xCell = xCellRange->getCellByPosition(nColumn, nRow); + + sal_Int32 nMaxCol = tableRow.getTableCells().size() - nRemovedColumn - 1; + sal_Int32 nMaxRow = mvTableRows.size() - nRemovedRow - 1; + rTableCell.pushToXCell(rFilterBase, pMasterTextListStyle, xCell, *this, rTableStyle, - nColumn, tableRow.getTableCells().size() - 1, nRow, - mvTableRows.size() - 1); + nColumn, nMaxCol, nRow, nMaxRow); + if (bMerged) nColumn += nRemovedColumn; + + nRemovedRow = 0; } ++nColumn; } diff --git a/sd/qa/unit/data/pptx/bnc480256-2.pptx b/sd/qa/unit/data/pptx/bnc480256-2.pptx new file mode 100644 index 000000000000..a622d77acef0 Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc480256-2.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf135843_insideH.pptx b/sd/qa/unit/data/pptx/tdf135843_insideH.pptx new file mode 100644 index 000000000000..9b7864adb325 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf135843_insideH.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index e49892d3a738..c7b508de5dc3 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1474,7 +1474,7 @@ void SdImportTest::testTableBorderLineStyle() xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("TopBorder") >>= aBorderLine; - if (aBorderLine.LineWidth > 0) { + if (aBorderLine.Color != -1) { CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle); } } diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index e4dfe0e3d47c..f34e2fb136f2 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -253,6 +253,44 @@ void SdLayoutTest::tdf143258_testTbRlLayout() CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest); +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf135843_InsideHBorders) +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf135843_insideH.pptx"), PPTX); + + std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile(); + MetafileXmlDump dumper; + + xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + // Without the fix, the test fails with: + //- Expected: 34 + //- Actual : 36 + // We shouldn't see two vertical borders inside the table on ui. + + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push", 34); + xDocShRef->DoClose(); +} + +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testBnc480256) +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/bnc480256-2.pptx"), PPTX); + + std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile(); + MetafileXmlDump dumper; + + xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + // Without the fix, the test fails with: + //- Expected: #ff0000 + //- Actual : #ffffff + // We should see the red vertical border inside the table. + + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[8]/linecolor[1]", "color", "#ff0000"); + xDocShRef->DoClose(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit b6be7a5ab3380f8bcb434edfac9aa97bc6cc8b02 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Fri Apr 8 15:59:11 2022 +0200 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:10 2022 +0200 tdf#147876 Fix crash when cancelling Dialog import dlg Regression from 9a55b97e980bbf2a0ce12841f6168f1f7545ac96 Change-Id: I3fc35981a0cb81e5b59236ec3b07450aec10541a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132737 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> (cherry picked from commit 618d40799d25474c48d984ce1d52b0f08f220958) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132855 Reviewed-by: Christian Lohmaier <[email protected]> diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 920e82da3d0a..7b7e5db43b89 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -851,7 +851,7 @@ bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All ); xFP->setCurrentFilter( aDialogStr ); - if( aDlg.Execute() != ERRCODE_NONE ) + if( aDlg.Execute() == ERRCODE_NONE ) { Sequence< OUString > aPaths = xFP->getSelectedFiles(); commit d4dc6e88d1697c17c2d3676d5e4568e8c011bd56 Author: Dennis Francis <[email protected]> AuthorDate: Tue Apr 12 10:43:00 2022 +0530 Commit: Andras Timar <[email protected]> CommitDate: Thu Apr 14 14:02:10 2022 +0200 unit test: use temp copy in testInvalidEntrySave() Use a temporary copy of the source file to run this test otherwise it will execute a .uno:Save on the original document in the git tree! Change-Id: I673aad64453e72a9140efcad2b0ff9c0ceabc038 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index e17bf999a010..8c42ff99fa45 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -40,6 +40,8 @@ #include <docoptio.hxx> #include <postit.hxx> #include <test/lokcallback.hxx> +#include <osl/file.hxx> +#include <unotools/tempfile.hxx> #include <chrono> #include <cstddef> @@ -187,10 +189,11 @@ public: CPPUNIT_TEST_SUITE_END(); private: - ScModelObj* createDoc(const char* pName); + ScModelObj* createDoc(const char* pName, bool bMakeTempCopy = false); void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell); static void callback(int nType, const char* pPayload, void* pData); void callbackImpl(int nType, const char* pPayload); + void makeTempCopy(const OUString& rOrigURL); /// document size changed callback. osl::Condition m_aDocSizeCondition; @@ -198,6 +201,7 @@ private: uno::Reference<lang::XComponent> mxComponent; TestLokCallbackWrapper m_callbackWrapper; + std::unique_ptr<utl::TempFile> mpTempFile; }; ScTiledRenderingTest::ScTiledRenderingTest() @@ -236,11 +240,29 @@ void ScTiledRenderingTest::tearDown() test::BootstrapFixture::tearDown(); } -ScModelObj* ScTiledRenderingTest::createDoc(const char* pName) +void ScTiledRenderingTest::makeTempCopy(const OUString& rOrigURL) +{ + mpTempFile.reset(new utl::TempFile()); + mpTempFile->EnableKillingFile(); + auto const aError = osl::File::copy(rOrigURL, mpTempFile->GetURL()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUString("<" + rOrigURL + "> -> <" + mpTempFile->GetURL() + ">").toUtf8().getStr(), + osl::FileBase::E_None, aError); +} + +ScModelObj* ScTiledRenderingTest::createDoc(const char* pName, bool bMakeTempCopy) { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument"); + + OUString aOriginalSrc = m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName); + if (bMakeTempCopy) + makeTempCopy(aOriginalSrc); + + mxComponent = loadFromDesktop( + bMakeTempCopy ? mpTempFile->GetURL() : aOriginalSrc, + "com.sun.star.sheet.SpreadsheetDocument"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); CPPUNIT_ASSERT(pModelObj); pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); @@ -3058,7 +3080,7 @@ void ScTiledRenderingTest::testInvalidEntrySave() // Load a document comphelper::LibreOfficeKit::setActive(); - ScModelObj* pModelObj = createDoc("validity.xlsx"); + ScModelObj* pModelObj = createDoc("validity.xlsx", true /* bMakeTempCopy */); const ScDocument* pDoc = pModelObj->GetDocument(); ViewCallback aView; int nView = SfxLokHelper::getView();
