[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 72712ef89282376aee8b0c7f41dcd8969e582d49 Author: Caolán McNamara AuthorDate: Fri Mar 27 19:21:19 2020 + Commit: Caolán McNamara CommitDate: Mon Mar 30 14:18:25 2020 +0200 spreadsheetml2ooo.xsl was not well formed xml broken by... commit 6909838e2966b3fd3c2de6b6db70d952cd8b3114 Date: Thu Apr 25 18:08:33 2019 +0200 Fix typo Change-Id: I40ee245faa75c885d76299ddee79fdaca9d0d715 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91184 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl index 2f4830d0b9ed..d58509a6a982 100644 --- a/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl +++ b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl @@ -8863,7 +8863,7 @@ - + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source sw/qa
filter/source/msfilter/dffpropset.cxx | 11 +++ sw/qa/extras/ww8import/data/tdf130262.doc |binary sw/qa/extras/ww8import/ww8import.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 82288db9bbc69892408ebccb96091d03b2d0dabb Author: Patrick Jaap AuthorDate: Thu Feb 6 18:33:19 2020 +0100 Commit: Patrick Jaap CommitDate: Tue Feb 11 17:17:41 2020 +0100 tdf#130262 ignore negative wrap distance values in doc prop import Change-Id: I2c06b12c958dfde09adcc2ae4c59532ffde6b6fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88127 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 8cbd7f59bb99282c4bcb60639da1263c8eb3a5e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88399 Reviewed-by: Patrick Jaap diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index 73c0e45d64db..f0a5aae5cc29 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1208,6 +1208,17 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) } if ( bSetProperty ) { +// tdf#130262: ignore negative values for distances (maybe this list needs to be extended) +// LO does not allow negative values but [MS-ODRAW] does not forbid them +if (nRecType == DFF_Prop_dxWrapDistLeft || nRecType == DFF_Prop_dxWrapDistRight + || nRecType == DFF_Prop_dyWrapDistTop || nRecType == DFF_Prop_dyWrapDistBottom ) +{ +if ( static_cast(nContent) < 0 ) +{ +break; +} +} + mpPropSetEntries[ nRecType ].nContent = nContent; mpPropSetEntries[ nRecType ].aFlags = aPropFlag; } diff --git a/sw/qa/extras/ww8import/data/tdf130262.doc b/sw/qa/extras/ww8import/data/tdf130262.doc new file mode 100644 index ..fb60beacd79d Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf130262.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c67f2c9385b0..468cacfd0967 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -365,6 +365,11 @@ DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987") CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage"); } +DECLARE_WW8IMPORT_TEST(testTdf130262, "tdf130262.doc") +{ +// We had an infinite layout loop +} + // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/msfilter/msdffimp.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit 35d57c1c8e5ad59b1fc43ff5f4a2bd5ff2542614 Author: Caolán McNamara AuthorDate: Mon Jan 13 12:12:19 2020 + Commit: Caolán McNamara CommitDate: Mon Jan 13 21:11:08 2020 +0100 ofz#20051 if duplicate exists then m_ObjToRecMap points to deleted element Change-Id: I854410ba1d5c0a622b5ba9c6816a24a3477e5089 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86686 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index ca958de9a5ad..4c5b90780817 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -5105,8 +5105,13 @@ SvxMSDffImportRec* SvxMSDffImportData::find(const SdrObject* pObj) void SvxMSDffImportData::insert(std::unique_ptr pImpRec) { -m_ObjToRecMap[pImpRec->pObj] = pImpRec.get(); -m_Records.insert(std::move(pImpRec)); +auto aRet = m_Records.insert(std::move(pImpRec)); +bool bSuccess = aRet.second; +if (bSuccess) +{ +SvxMSDffImportRec* pRec = aRet.first->get(); +m_ObjToRecMap[pRec->pObj] = pRec; +} } void SvxMSDffImportData::NotifyFreeObj(SdrObject* pObj) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/icgm/class7.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6bc3f02ed2378dd70f03df64f53e852e3c9dbfdd Author: Caolán McNamara AuthorDate: Sun Jan 5 20:37:20 2020 + Commit: Michael Stahl CommitDate: Wed Jan 8 15:42:38 2020 +0100 ofz#19803 check for negative values Change-Id: I30036a16cf1651a7e27c7aefa086b3725d58933a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86250 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit 0ab8ae4d98122f7de50365a062675d001ef0ca6a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86341 Reviewed-by: Michael Stahl diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx index 8c2478a308ae..b1652cc84ae0 100644 --- a/filter/source/graphicfilter/icgm/class7.cxx +++ b/filter/source/graphicfilter/icgm/class7.cxx @@ -80,7 +80,7 @@ void CGM::ImplDoClass7() mpChart->mDataNode[ 0 ] = *reinterpret_cast( pAppData ); sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum; -if ( nZoneEnum && ( nZoneEnum <= 6 ) ) +if (nZoneEnum > 0 && nZoneEnum <= 6) mpChart->mDataNode[ nZoneEnum ] = *reinterpret_cast( pAppData ); } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/pdf/impdialog.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 75406122dd7f6896d003aff46decb78bb40f2fa8 Author: Jan-Marek Glogowski AuthorDate: Wed Dec 11 19:14:31 2019 +0100 Commit: Xisco Faulí CommitDate: Thu Dec 12 17:00:16 2019 +0100 tdf#127493 store ExportFormFields checkbox value ... and also correctly set the initial frames sensitivity. The commit removed the no longer needed UserSelection variant of mbExportFormFields but forgit to actually set it now. Regression from my commit 76fcd878da1624e73f1eb9d9405485d4faf66edf. Change-Id: Ia5fcc1c37e2e4b4a330b59a492f817d2db8d7347 Reviewed-on: https://gerrit.libreoffice.org/84975 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit b06cba8f13e0b71346cb884cf827751f2086fd8e) Reviewed-on: https://gerrit.libreoffice.org/85037 Tested-by: Xisco Faulí Reviewed-by: Xisco Faulí diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index e19df5f9e0d7..bbb6c9973bb3 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -567,6 +567,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) mxLbFormsFormat->set_active(static_cast(pParent->mnFormsType)); mxCbAllowDuplicateFieldNames->set_active( pParent->mbAllowDuplicateFieldNames ); +mxFormsFrame->set_sensitive(pParent->mbExportFormFields); mxCbExportBookmarks->set_active( pParent->mbExportBookmarks ); @@ -670,6 +671,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent ) else mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDF; pParent->mbUseTaggedPDFUserSelection = mbUseTaggedPDFUserSelection; +pParent->mbExportFormFields = mxCbExportFormFields->get_active(); if( mxCbWatermark->get_active() ) pParent->maWatermarkText = mxEdWatermark->get_text(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/svg/presentation_engine.js | 46 ++- 1 file changed, 22 insertions(+), 24 deletions(-) New commits: commit d1b7271cd7e13c0243c359bd8f66351a1495f51c Author: Tor Lillqvist AuthorDate: Wed Oct 23 17:47:58 2019 +0300 Commit: Tor Lillqvist CommitDate: Thu Dec 5 14:33:01 2019 +0100 tdf#127939: Make slideshow touch input work properly again on iOS 13 For some reason, navigator.userAgent in WebKit on iOS 13 claims it to be a Macintosh, so our old code to recognise iOS did not work any longer. Also the Hammer.js included in this file looked at navigator.userAgent and its decision what to do based on that did not work properly either. Simplify our code by handling swipe gestures all the time, even when such won't be generated (on mouse-only devices). Also, Hammer.JS was too eager to think it detected a pointer-only device based on the presense of window.PointerEvent. That sems to be present now in iOS 13. Let's not blindly think that means it is a pointer-only device. If the device supports touch events, don't bother with PointerEvents. Change-Id: I57d972415798967e871c6e262f16043561ed6af5 Reviewed-on: https://gerrit.libreoffice.org/81404 Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist (cherry picked from commit 8f78d6a0d1b4d8d2e21aad9e90510fe6be4df5bb) Reviewed-on: https://gerrit.libreoffice.org/83731 Reviewed-on: https://gerrit.libreoffice.org/83883 Tested-by: Jenkins (cherry picked from commit 8012a200d1a7c5cd1b64a147ca6899fb8863ce8b) Reviewed-on: https://gerrit.libreoffice.org/84537 diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index 87f4dc162b0e..64561bed7b52 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -494,7 +494,7 @@ function createInputInstance(manager) { if (inputClass) { Type = inputClass; -} else if (SUPPORT_POINTER_EVENTS) { +} else if (!SUPPORT_TOUCH && SUPPORT_POINTER_EVENTS) { Type = PointerEventInput; } else if (SUPPORT_ONLY_TOUCH) { Type = TouchInput; @@ -823,6 +823,7 @@ inherit(MouseInput, Input, { * @param {Object} ev */ handler: function MEhandler(ev) { +// console.log('==> MouseInput handler'); var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down @@ -897,6 +898,7 @@ inherit(PointerEventInput, Input, { * @param {Object} ev */ handler: function PEhandler(ev) { +// console.log('==> PointerEventInput handler'); var store = this.store; var removePointer = false; @@ -966,6 +968,7 @@ function SingleTouchInput() { inherit(SingleTouchInput, Input, { handler: function TEhandler(ev) { +// console.log('==> SingleTouchInput handler'); var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? @@ -1033,6 +1036,7 @@ function TouchInput() { inherit(TouchInput, Input, { handler: function MTEhandler(ev) { +// console.log('==> TouchInput handler'); var type = TOUCH_INPUT_MAP[ev.type]; var touches = getTouches.call(this, ev, type); if (!touches) { @@ -1141,6 +1145,7 @@ inherit(TouchMouseInput, Input, { * @param {Object} inputData */ handler: function TMEhandler(manager, inputEvent, inputData) { +// console.log('==> TouchMouseInput handler'); var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); @@ -6467,26 +6472,22 @@ function init() theSlideIndexPage = new SlideIndexPage(); aSlideShow.displaySlide( theMetaDoc.nStartSlideNumber, false ); -// In the iOS app, allow slide switching with swipe gestures left +// Allow slide switching with swipe gestures left // and right. Swiping up or down will exit the slideshow. -var ua = navigator.userAgent; -if (ua.indexOf(' AppleWebKit/') !== -1 && -ua.indexOf(' Mobile/') !== -1) { -var hammer = new Hammer(ROOT_NODE); -hammer.on('swipeleft', function() { -switchSlide(1, false); -}); -hammer.on('swiperight', function() { -switchSlide(-1, false); -}); -hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL }); -hammer.on('swipeup', function() { -aSlideShow.exitSlideShowInApp(); -}); -hammer.on('swipedown', function() { -aSlideShow.exitSlideShowInApp(); -}); -} +var hammer = new Hammer(ROOT_NODE); +hammer.on('swipeleft', function() { +switchSlide(1, false); +}); +hammer.on('swiperight', function() { +switchSlide(-1, false); +}); +hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL }); +hammer.on(
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/icgm/class7.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 08cb6ed14be3c2b71377a9d16ad0f19086278362 Author: Caolán McNamara AuthorDate: Mon Dec 2 13:03:48 2019 + Commit: Michael Stahl CommitDate: Tue Dec 3 11:03:54 2019 +0100 ofz#19207 check max strlen possible Change-Id: I5fe9fde240ef375d9de097dda47953320ecc758d Reviewed-on: https://gerrit.libreoffice.org/84255 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx index c85e5284e026..8c2478a308ae 100644 --- a/filter/source/graphicfilter/icgm/class7.cxx +++ b/filter/source/graphicfilter/icgm/class7.cxx @@ -127,9 +127,11 @@ void CGM::ImplDoClass7() nAttributes >>= 12; pTextEntry->nAttributes = nAttributes; pAppData += 8; -sal_uInt32 nLen = strlen( reinterpret_cast( pAppData ) ) + 1; -pTextEntry->pText = new char[ nLen ]; +auto nMaxLen = mpEndValidSource - pAppData; +sal_uInt32 nLen = strnlen(reinterpret_cast(pAppData), nMaxLen); +pTextEntry->pText = new char[nLen + 1]; memcpy( pTextEntry->pText, pAppData, nLen ); +pTextEntry->pText[nLen] = 0; pAppData += nLen; mpChart->InsertTextEntry( std::move(pTextEntry) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/icgm/chart.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d78171b66dd57e017849187a9f1b8de7b3681d78 Author: Caolán McNamara AuthorDate: Mon Dec 2 12:55:43 2019 + Commit: Caolán McNamara CommitDate: Mon Dec 2 17:00:24 2019 +0100 new[]/delete mismatch Change-Id: Ife47f111b3910c2eca322678f3f7a67b5cc2cd24 Reviewed-on: https://gerrit.libreoffice.org/84221 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/filter/source/graphicfilter/icgm/chart.cxx b/filter/source/graphicfilter/icgm/chart.cxx index afd39f69e556..0029d88db170 100644 --- a/filter/source/graphicfilter/icgm/chart.cxx +++ b/filter/source/graphicfilter/icgm/chart.cxx @@ -36,7 +36,7 @@ CGMChart::~CGMChart() for (auto & pTextEntry : maTextEntryList) { if ( pTextEntry ) -delete pTextEntry->pText; +delete [] pTextEntry->pText; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source include/filter
filter/source/msfilter/svdfppt.cxx |5 - include/filter/msfilter/msdffimp.hxx |2 +- include/filter/msfilter/svdfppt.hxx |1 - 3 files changed, 1 insertion(+), 7 deletions(-) New commits: commit 06693f2c27a20ff52c14bcdbfe808aec543b0f70 Author: Caolán McNamara AuthorDate: Sun Nov 3 20:56:02 2019 + Commit: Michael Stahl CommitDate: Tue Nov 12 17:16:19 2019 +0100 ofz#18683 NotifyFreeObj override is not helpful the base one works fine, the override on the SvxMSDffClientData is sufficient to do what we want here if the base method check of groupobj children was in use Change-Id: I8ee65532d95c167ee83d6c2918dd0b8508d98b48 Reviewed-on: https://gerrit.libreoffice.org/81970 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 71fbe72b2f52..7086026d9407 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -737,11 +737,6 @@ void ProcessData::NotifyFreeObj(SdrObject* pObj) } } -void SdrEscherImport::NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj) -{ -rData.NotifyFreeObj(pObj); -} - /* ProcessObject is called from ImplSdPPTImport::ProcessObj to handle all application specific things, such as the import of text, animation effects, header footer and placeholder. diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 84e66803b6dc..848b7fa0669a 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -516,7 +516,7 @@ protected: SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj); -virtual void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj); +void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj); void FreeObj(SvxMSDffClientData& rData, SdrObject* pObj); diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index c378a10ebb6f..2da3dd166124 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -483,7 +483,6 @@ public: voidRecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph ); virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const; virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj ) override; -virtual voidNotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj) override; virtual voidProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, SvxMSDffClientData& rData, DffObjData& rObj ) override; voidImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry ); }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/icgm/cgm.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f576e45957a24839d6e75e08e3fb4761e7b0b57e Author: Caolán McNamara AuthorDate: Fri Nov 1 17:29:56 2019 + Commit: Adolfo Jayme Barrientos CommitDate: Tue Nov 5 15:03:07 2019 +0100 ofz#18646 ensure we are inside valid range Change-Id: Ide4d4bfad5b365a42790454cca709d175054c933 Reviewed-on: https://gerrit.libreoffice.org/81909 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index 3004d346522e..8ae42deb1fe8 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -97,7 +97,7 @@ sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision ) sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision ) { sal_uInt8* pSource = mpSource + mnParaSize; -if (static_cast(mpEndValidSource - pSource) < nPrecision) +if (pSource > mpEndValidSource || static_cast(mpEndValidSource - pSource) < nPrecision) throw css::uno::Exception("attempt to read past end of input", nullptr); mnParaSize += nPrecision; switch( nPrecision ) @@ -129,7 +129,7 @@ sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision ) sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision ) { sal_uInt8* pSource = mpSource + mnParaSize; -if (static_cast(mpEndValidSource - pSource) < nPrecision) +if (pSource > mpEndValidSource || static_cast(mpEndValidSource - pSource) < nPrecision) throw css::uno::Exception("attempt to read past end of input", nullptr); mnParaSize += nPrecision; switch( nPrecision ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/icgm/bitmap.cxx | 58 filter/source/graphicfilter/icgm/bitmap.hxx |2 2 files changed, 53 insertions(+), 7 deletions(-) New commits: commit e4fc6559775a601eedb2ca3c634b495523688f62 Author: Caolán McNamara AuthorDate: Wed Oct 23 10:47:30 2019 +0100 Commit: Michael Stahl CommitDate: Wed Oct 23 17:03:48 2019 +0200 ofz#18467 check against end of buffer Change-Id: Ibeed87e2e3af90219e7bbbd773d369c90f78a364 Reviewed-on: https://gerrit.libreoffice.org/81373 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx index 12e3f25416dc..825c90243e0a 100644 --- a/filter/source/graphicfilter/icgm/bitmap.cxx +++ b/filter/source/graphicfilter/icgm/bitmap.cxx @@ -81,6 +81,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) switch ( rDesc.mnDstBitsPerPixel ) { case 1 : { +bool bOk = true; std::vector palette(2); if ( rDesc.mnLocalColorPrecision == 1 ) palette = ImplGeneratePalette( rDesc ); @@ -90,11 +91,18 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) ? BMCOL( mpCGM->pElement->pFillBundle->GetColor() ) : BMCOL( mpCGM->pElement->aFillBundle.GetColor() ); }; -for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { +for (ny = 0; bOk && --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize) { nxC = nxCount; for ( nx = 0; --nxC; nx++ ) { // this is not fast, but a one bit/pixel format is rarely used -sal_uInt8 colorIndex = static_cast( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1; +const sal_uInt8* pPos = rDesc.mpBuf + (nx >> 3); +if (pPos >= rDesc.mpEndBuf) +{ +SAL_WARN("filter.icgm", "buffer is too small"); +bOk = false; +break; +} +sal_uInt8 colorIndex = static_cast((*pPos >> ((nx & 7)^7))) & 1; aBitmap.SetPixel(ny, nx, palette[colorIndex]); } } @@ -102,23 +110,40 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) break; case 2 : { +bool bOk = true; auto palette = ImplGeneratePalette( rDesc ); -for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { +for (ny = 0; bOk && --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize) { nxC = nxCount; for ( nx = 0; --nxC; nx++ ) { // this is not fast, but a two bits/pixel format is rarely used -aBitmap.SetPixel(ny, nx, palette[static_cast( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3]); +const sal_uInt8* pPos = rDesc.mpBuf + (nx >> 2); +if (pPos >= rDesc.mpEndBuf) +{ +SAL_WARN("filter.icgm", "buffer is too small"); +bOk = false; +break; +} +aBitmap.SetPixel(ny, nx, palette[static_cast( (*pPos >> (((nx & 3)^3) << 1))) & 3]); } } } break; case 4 : { +bool bOk = true; auto palette = ImplGeneratePalette( rDesc ); -for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { +for (ny = 0; bOk && --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize) { nxC = nxCount; sal_uInt8* pTemp = rDesc.mpBuf; for ( nx = 0; --nxC; nx++ ) { + +if (pTemp >= rDesc.mpEndBuf) +{ +SAL_WARN("filter.icgm", "buffer is too small"); +bOk = false; +break; +} + sal_uInt8 nDat = *pTemp++; aBitmap.SetPixel(ny, nx, palette[static_cast(nDat >> 4)]); @@ -133,11 +158,20 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) break; case 8 : { +bool bOk = true; auto palette = ImplGeneratePalette( rDesc ); -for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { +for (ny = 0; bOk && --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize) { sal_uInt8* pTemp = rDesc.mpBuf; nxC = nxCount; for ( nx = 0; --nxC; nx++ ) { + +if (pTemp >= rDesc.mpEndBuf) +{ +SAL_WARN("filter.icgm", "buffer is too small"); +bOk = false; +break; +} + aBitmap.SetPixel(ny, nx, palette[*(pTemp++)]); } } @@ -145,11 +179,20 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) break; case 24 : { +bool bOk = true; Color aBitmapColor; -for ( ny = 0; --
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) New commits: commit fd0c09a906ae14aeb244bc04e4a1e09ce0e962f4 Author: Michael Stahl AuthorDate: Fri Sep 27 15:18:25 2019 +0200 Commit: Caolán McNamara CommitDate: Mon Sep 30 17:35:57 2019 +0200 filter: XHTML: make "calc-heading-digit" a little faster Exporting OpenDocument-v1.3-csd01-part3-schema.odt to XHTML fails with: runtime error: file share/xslt/export/xhtml/body.xsl line 1404 element variable xsltApplySequenceConstructor: A potential infinite template recursion was detected. You can adjust xsltMaxDepth (--maxdepth) in order to raise the maximum number of nested template calls and variables/params (currently set to 3000). Unfortunately the document contains this many headings, and the calc-heading-digit computes the value by recursively looking at every preceding heading in the document, without TCO apparently... Try to improve this by using XPath to filter early the headings that are effectively ignored in the 3rd xsl:when case anyway: the ones with a level lower than the one for which the number is requested; this limits the recursive calls to the number of headings on the same level. Change-Id: Iddf5a91664402a57a0138731ddc9cebb06b0a126 Reviewed-on: https://gerrit.libreoffice.org/79720 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 86cca6b40ced4031dec4b708ac67b5cbe70cddf9) Reviewed-on: https://gerrit.libreoffice.org/79744 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index 541417b2f36e..f6cebb35146e 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -1401,9 +1401,10 @@ - + + - + @@ -1421,11 +1422,7 @@ - - - - - +this should not happen ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/pdf/pdfexport.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 190f0621c2f799e5f44599ae93339aa93c9b9237 Author: Aron Budea AuthorDate: Fri Sep 20 04:54:00 2019 +0200 Commit: Andras Timar CommitDate: Mon Sep 30 14:34:27 2019 +0200 tdf#124377: enable anti-aliasing metafile during redaction Change-Id: I6c8a0f6ceaad5d9ec47cce1b00b8ccdd77530aaf Reviewed-on: https://gerrit.libreoffice.org/79266 Tested-by: Jenkins Reviewed-by: Muhammet Kara (cherry picked from commit cd6780aae1392d4c1af0b15b311a4966834a9602) Reviewed-on: https://gerrit.libreoffice.org/79478 Reviewed-by: Andras Timar diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 175cc4150c4e..7617146338d3 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -239,7 +239,8 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, try { Graphic aGraph(aMtf); -BitmapEx bmp = aGraph.GetBitmapEx(); +// use antialiasing to improve how graphic objects look +BitmapEx bmp = aGraph.GetBitmapEx(GraphicConversionParameters(Size(0, 0), false, true, false)); Graphic bgraph(bmp); aMtf = bgraph.GetGDIMetaFile(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/itiff/itiff.cxx | 53 +--- 1 file changed, 40 insertions(+), 13 deletions(-) New commits: commit fda86dd781a80703f06ae1b6056439bafed190a8 Author: Caolán McNamara AuthorDate: Mon Jul 22 15:44:12 2019 +0100 Commit: Michael Stahl CommitDate: Tue Jul 23 13:17:13 2019 +0200 Resolves: tdf#126460 implement reading grayscale+alpha tiff format Change-Id: I3300ae21c74f5a25c767ce643e93d2232f3b9381 Reviewed-on: https://gerrit.libreoffice.org/76124 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 7509777b6122..0e1241a9484a 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -1144,15 +1144,34 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) } } else if ( ( nSamplesPerPixel == 2 ) && ( nBitsPerSample == 8 ) && -( nPlanarConfiguration == 1 ) && aColorMap.empty() ) // grayscale +( nPlanarConfiguration == 1 ) && aColorMap.empty() ) // grayscale + alpha { if ( nMaxSampleValue > nMinSampleValue ) { -sal_uInt32 nMinMax = ( ( 1 << 8 /*nDstBitsPerPixel*/ ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); -sal_uInt8* pt = getMapData(0); -for (sal_Int32 nx = 0; nx < nImageWidth; nx++, pt += 2 ) +sal_uInt8* pt = getMapData(0); + +if (nPredictor == 2) { -SetPixel(nY, nx, static_cast( (static_cast(*pt) - nMinSampleValue) * nMinMax)); +sal_uInt8 nLastPixel = 0; +sal_uInt8 nLastAlpha = 0; +for (sal_Int32 nx = 0; nx < nImageWidth; nx++, pt += 2) +{ +nLastPixel = (nLastPixel + pt[0]) & 0xFF; +SetPixel(nY, nx, nLastPixel); + +nLastAlpha = (nLastAlpha + pt[1]) & 0xFF; +SetPixelAlpha(nY, nx, ~nLastAlpha); +} +} +else +{ +sal_uInt32 nMinMax = ( ( 1 << 8 /*nDstBitsPerPixel*/ ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); +for (sal_Int32 nx = 0; nx < nImageWidth; nx++, pt += 2) +{ +SetPixel(nY, nx, static_cast( (static_cast(pt[0]) - nMinSampleValue) * nMinMax )); +sal_uInt8 nAlpha = static_cast( (static_cast(pt[1]) - nMinSampleValue) * nMinMax ); +SetPixelAlpha(nY, nx, ~nAlpha); +} } } } @@ -1235,13 +1254,21 @@ void TIFFReader::ReadHeader() bool TIFFReader::HasAlphaChannel() const { /*There are undoubtedly more variants we could support, but keep it simple for now*/ -return ( - nDstBitsPerPixel == 24 && - nBitsPerSample == 8 && - nSamplesPerPixel >= 4 && - nPlanes == 1 && - nPhotometricInterpretation == 2 - ); +bool bRGBA = nDstBitsPerPixel == 24 && + nBitsPerSample == 8 && + nSamplesPerPixel >= 4 && + nPlanes == 1 && + nPhotometricInterpretation == 2; +if (bRGBA) +return true; + +// additionally support the format used in tdf#126460 +bool bGrayScaleAlpha = nDstBitsPerPixel == 8 && + nBitsPerSample == 8 && + nSamplesPerPixel == 2 && + nPlanarConfiguration == 1; + +return bGrayScaleAlpha; } namespace @@ -1619,7 +1646,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) { for (sal_Int32 nX = 0; nX < nImageWidth; ++nX) { -auto p = maBitmap.data() + ((maBitmapPixelSize.Width() * nY + nX) * 3); +auto p = maBitmap.data() + ((maBitmapPixelSize.Width() * nY + nX) * (HasAlphaChannel() ? 4 : 3)); auto c = SanitizePaletteIndex(*p, mvPalette); *p = c.GetRed(); p++; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source
filter/source/graphicfilter/itiff/itiff.cxx | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) New commits: commit d743130a98a168ba17dcb082cd3fb6efc335a86a Author: Caolán McNamara AuthorDate: Wed Jul 17 16:13:17 2019 +0100 Commit: Michael Stahl CommitDate: Thu Jul 18 10:43:40 2019 +0200 Resolves: tdf#126147 relax sanity check and allow truncated tiffs now the start of the row of data must still exist, but the full length of the row doesn't have to exist Change-Id: I5ed8ffef2cab19f040ba789a5d82560ca6847f26 Reviewed-on: https://gerrit.libreoffice.org/75794 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 956efdbb4f6c..7509777b6122 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -570,9 +570,11 @@ bool TIFFReader::ReadMap() if ( nStrip >= aStripOffsets.size()) return false; pTIFF->Seek( aStripOffsets[ nStrip ] + ( ny % GetRowsPerStrip() ) * nStripBytesPerRow ); -pTIFF->ReadBytes(getMapData(np), nBytesPerRow); -if (!pTIFF->good()) -return false; +// tdf#126147 allow a short incomplete read +auto pDest = getMapData(np); +auto nRead = pTIFF->ReadBytes(pDest, nBytesPerRow); +if (nRead != nBytesPerRow) +memset(pDest + nRead, 0, nBytesPerRow - nRead); } if ( !ConvertScanline( ny ) ) return false; @@ -1512,8 +1514,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) if (bStatus) { auto nStart = aStripOffsets[ nStrip ] + ( ny % GetRowsPerStrip() ) * nStripBytesPerRow; -auto nEnd = nStart + nBytesPerRow; -if (nEnd > nEndOfFile) +if (nStart > nEndOfFile) bStatus = false; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source filter/uiconfig
filter/source/pdf/impdialog.cxx | 52 +++-- filter/source/pdf/impdialog.hxx |6 +- filter/uiconfig/ui/pdfgeneralpage.ui | 86 --- 3 files changed, 110 insertions(+), 34 deletions(-) New commits: commit 0aed9cf0126409f0a2d215212becc6d562a58a98 Author: Thorsten Behrens AuthorDate: Mon Jul 1 03:56:37 2019 +0200 Commit: Thorsten Behrens CommitDate: Mon Jul 1 19:51:02 2019 +0200 tdf#62728 Provide both A/1 and A/2 in PDF export dialog Followup commit to ed4a0eed82e2f, adding back the A/1 option. Change-Id: I9f509cb77f045de260bc22fc494fe4ecaac29bbc Reviewed-on: https://gerrit.libreoffice.org/74941 Tested-by: Jenkins Reviewed-by: Katarina Behrens (cherry picked from commit 49cfcf777d03abf59557cad021b4e5c4445de3c0) Reviewed-on: https://gerrit.libreoffice.org/74960 diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 52e22cf01a28..213f2cc2dc02 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -462,7 +462,9 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(TabPageParent pParent, const SfxItemS , mxNfQuality(m_xBuilder->weld_metric_spin_button("quality", FieldUnit::PERCENT)) , mxCbReduceImageResolution(m_xBuilder->weld_check_button("reduceresolution")) , mxCoReduceImageResolution(m_xBuilder->weld_combo_box("resolution")) -, mxCbPDFA2b(m_xBuilder->weld_check_button("pdfa")) +, mxCbPDFA(m_xBuilder->weld_check_button("pdfa")) +, mxRbPDFA1b(m_xBuilder->weld_radio_button("pdfa1")) +, mxRbPDFA2b(m_xBuilder->weld_radio_button("pdfa2")) , mxCbTaggedPDF(m_xBuilder->weld_check_button("tagged")) , mxCbExportFormFields(m_xBuilder->weld_check_button("forms")) , mxFormsFrame(m_xBuilder->weld_widget("formsframe")) @@ -530,16 +532,31 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) mxCbWatermark->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleWatermarkHdl ) ); mxFtWatermark->set_sensitive(false ); mxEdWatermark->set_sensitive( false ); -mxCbPDFA2b->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl)); +mxCbPDFA->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl)); +mxRbPDFA1b->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl)); +mxRbPDFA2b->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl)); switch( pParent->mnPDFTypeSelection ) { default: -mxCbPDFA2b->set_active( false ); // PDF 1.5 +// PDF 1.5 +mxCbPDFA->set_active( false ); +mxRbPDFA1b->set_active( false ); +mxRbPDFA2b->set_active( true ); break; -case 2: mxCbPDFA2b->set_active(true); // PDF/A-2a +case 1: +// PDF A-1b +mxCbPDFA->set_active(true); +mxRbPDFA1b->set_active(true); +mxRbPDFA2b->set_active(false); +break; +case 2: +// PDF A-2b +mxCbPDFA->set_active(true); +mxRbPDFA2b->set_active(true); +mxRbPDFA1b->set_active(false); break; } -ToggleExportPDFAHdl( *mxCbPDFA2b ); +ToggleExportPDFAHdl( *mxCbPDFA ); mxCbExportFormFields->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) ); @@ -547,7 +564,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) mbTaggedPDFUserSelection = pParent->mbUseTaggedPDF; mbExportFormFieldsUserSelection = pParent->mbExportFormFields; -if( !mxCbPDFA2b->get_active() ) +if( !mxCbPDFA->get_active() ) { // the value for PDF/A set by the ToggleExportPDFAHdl method called before mxCbTaggedPDF->set_active( mbTaggedPDFUserSelection ); @@ -643,9 +660,12 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent ) } pParent->mnPDFTypeSelection = 0; -if( mxCbPDFA2b->get_active() ) +if( mxCbPDFA->get_active() ) { pParent->mnPDFTypeSelection = 2; +if( mxRbPDFA1b->get_active() ) +pParent->mnPDFTypeSelection = 1; + pParent->mbUseTaggedPDF = mbTaggedPDFUserSelection; pParent->mbExportFormFields = mbExportFormFieldsUserSelection; } @@ -758,12 +778,10 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, weld::ToggleButton&, // set the security page status (and its controls as well) ImpPDFTabSecurityPage* pSecPage = mpParent ? mpParent->getSecurityPage() : nullptr; if (pSecPage) -{ -pSecPage->ImplPDFASecurityControl(!mxCbPDFA2b->get_active()); -} +pSecPage->ImplPDFASecurityControl(!mxCbPDFA->get_active()); // PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport. -bool bPDFA1Sel = mxCbPDFA2b->get_active(); +bool bPDFA1Sel = mxCbPDFA->get_active(); mxFormsFrame->set_sensitive(bPDFA1Sel); if(bPDFA1Sel) { @@ -774,24 +79
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source include/vcl sw/qa vcl/inc vcl/source
filter/source/msfilter/msdffimp.cxx |8 -- include/vcl/graphicfilter.hxx|2 - sw/qa/extras/ww8import/ww8import.cxx |9 +++ vcl/inc/impgraph.hxx |2 - vcl/source/filter/graphicfilter.cxx |5 ++-- vcl/source/gdi/impgraph.cxx | 42 --- 6 files changed, 44 insertions(+), 24 deletions(-) New commits: commit 78a21c7d94f8ff391f9c470bf10f4ae3c1d90307 Author: Miklos Vajna AuthorDate: Tue Jun 11 08:09:14 2019 +0200 Commit: Miklos Vajna CommitDate: Wed Jun 12 12:18:03 2019 +0200 tdf#125591 DOC import: lazy-load metafiles with explicit size Regression from commit 69b62cfcbd364d7f62142149c2f690104b217ca1 (tdf#125281 DOC import: fix size of lazy-loaded metafiles, 2019-05-27), the problem is that setting the preferred size of a Graphic swaps it in. Avoid this by extending ImportUnloadedGraphic(): if a size hint is provided, then that will be used instead of info from the graphic descriptor (which is usually only meaningful for bitmaps). This way we maintain the correct size and we're back to lazy-loading metafiles from binary MSO files as well. (cherry picked from commit acb803b730f2c6bd82e39beab58949ec14f85eb0) and: CppunitTest_sw_ww8import: disable failing assert on Windows It fails only sometimes, it's yet clear why. (cherry picked from commit b5d624c4af1085d4670149e9c1d280da7bc9add0) Change-Id: Ide12d12166110e98ea47b5347dd24fb203b22da3 Reviewed-on: https://gerrit.libreoffice.org/73818 Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 5341f3cd7734..ca958de9a5ad 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -6609,11 +6609,13 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool // which may be very large if the whole document is large. Limit the read // size to the size of this record. sal_uInt64 maxSize = pGrStream == &rBLIPStream ? nLength : 0; -Graphic aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize); +Graphic aGraphic; -// Size available in metafile header, set that here. +// Size available in metafile header. if (aMtfSize100.getWidth() && aMtfSize100.getHeight()) -aGraphic.SetPrefSize(aMtfSize100); +aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize, &aMtfSize100); +else +aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize); if (!aGraphic.IsNone()) { diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 9a8068d40f2f..69fbc215ba77 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -295,7 +295,7 @@ public: WmfExternal const *pExtHeader = nullptr ); // Setting sizeLimit limits how much will be read from the stream. -Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0); +Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0, Size* pSizeHint = nullptr); const FilterErrorEx&GetLastError() const { return *pErrorEx;} voidResetLastError(); diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 1af645f90cb1..73495cea2754 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -207,6 +207,10 @@ DECLARE_WW8IMPORT_TEST(testTdf121734, "tdf121734.doc") DECLARE_WW8IMPORT_TEST(testTdf125281, "tdf125281.doc") { +#if !defined(_WIN32) +// Windows fails with actual == 26171 for some reason; also lazy load isn't lazy in Windows +// debug builds, reason is not known at the moment. + // Load a .doc file which has an embedded .emf image. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -219,6 +223,11 @@ DECLARE_WW8IMPORT_TEST(testTdf125281, "tdf125281.doc") // an actual Paint() was performed (and even then, it was wrong). long nExpected = 25664; CPPUNIT_ASSERT_EQUAL(nExpected, rGraphic.GetPrefSize().getWidth()); + +// Without the accompanying fix in place, this test would have failed, as setting the pref size +// swapped the image in. +CPPUNIT_ASSERT(!rGraphic.isAvailable()); +#endif } DECLARE_WW8IMPORT_TEST(testTdf122425_1, "tdf122425_1.doc") diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index b97f736c770d..ce6ad8616e92 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -114,7 +114,7 @@ public: ImpGraphic( const GDIMetaFile& rMtf ); ~ImpGraphic(); -void ImplSetPrepared(bool bAnimated)