diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:03:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:03:24 +0000 |
commit | e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch) | |
tree | 3c1753125149dcf36ba42a57f1574369e8524225 /sc/source/ui | |
parent | Adding debian version 4:24.2.2-3. (diff) | |
download | libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip |
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/solveroptions.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 192 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/view/tabview4.cxx | 45 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 3 |
8 files changed, 255 insertions, 31 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 8e6315db94..a61ee53d25 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1662,7 +1662,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) ScDocumentImport aDocImport(rDoc); do { - SCCOL nLastCol = nEndCol; // tdf#129701 preserve value of nEndCol + const SCCOL nLastCol = nEndCol; // tdf#129701 preserve value of nEndCol for( ;; ) { aLine = ReadCsvLine(rStrm, !bFixed, aSeps, cStr, cDetectSep); @@ -1784,15 +1784,15 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) aTransliteration, aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get()); } + ++nCol; if (bIsLastColEmpty) { bIsLastColEmpty = false; // toggle to stop } else { - ++nCol; // tdf#129701 detect if there is a last empty column when we need it - bIsLastColEmpty = !(*p) && !bSkipEmptyCells && !bDetermineRange && nCol == nLastCol; + bIsLastColEmpty = (nCol == nLastCol) && !(*p) && !bSkipEmptyCells && !bDetermineRange; } } diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 66bbc010ea..e13488e302 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -241,7 +241,7 @@ private: void UpdateVarZoom(); static void SetScrollBar( ScrollAdaptor& rScroll, tools::Long nRangeMax, tools::Long nVisible, tools::Long nPos, bool bLayoutRTL ); - static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll ); + static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll, bool bLayoutRTL ); void GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, SCCOL& rAreaX, SCROW& rAreaY, ScFollowMode& rMode, diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 3d5b2b47c1..81f5c8b7b4 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -69,7 +69,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, , m_xBtnEdit(m_xBuilder->weld_button("edit")) { m_xLbSettings->set_size_request(m_xLbSettings->get_approximate_digit_width() * 32, - m_xLbSettings->get_height_rows(6)); + m_xLbSettings->get_height_rows(12)); m_xLbSettings->enable_toggle_buttons(weld::ColumnToggleType::Check); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c906f39336..6d94542095 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -27,6 +27,9 @@ #include <editeng/editview.hxx> #include <editeng/memberids.h> #include <editeng/outliner.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/sizeitem.hxx> #include <o3tl/any.hxx> #include <o3tl/safeint.hxx> #include <svx/fmview.hxx> @@ -131,6 +134,7 @@ #include <table.hxx> #include <appoptio.hxx> #include <formulaopt.hxx> +#include <stlpool.hxx> #include <strings.hrc> @@ -2059,7 +2063,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 bWasCellRange = pPrintFunc->GetLastSourceRange( aCellRange ); Size aTwips = pPrintFunc->GetPageSize(); - if (!m_pPrintState) + if (!m_pPrintState || nRenderer == nTabStart) { m_pPrintState.reset(new ScPrintState()); pPrintFunc->GetPrintState(*m_pPrintState, true); @@ -2105,6 +2109,174 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 return aSequence; } +static void lcl_SetMediaScreen(const uno::Reference<drawing::XShape>& xMediaShape, + const OutputDevice* pDev, tools::Rectangle& aRect, + sal_Int32 nPageNumb) +{ + OUString sMediaURL; + uno::Reference<beans::XPropertySet> xPropSet(xMediaShape, uno::UNO_QUERY); + xPropSet->getPropertyValue("MediaURL") >>= sMediaURL; + if (sMediaURL.isEmpty()) + return; + vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); + if (!pPDF) + return; + + OUString sTitle; + xPropSet->getPropertyValue("Title") >>= sTitle; + OUString sDescription; + xPropSet->getPropertyValue("Description") >>= sDescription; + OUString const altText(sTitle.isEmpty() ? sDescription + : sDescription.isEmpty() + ? sTitle + : OUString::Concat(sTitle) + OUString::Concat("\n") + + OUString::Concat(sDescription)); + + OUString const mimeType(xPropSet->getPropertyValue("MediaMimeType").get<OUString>()); + SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape)); + sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, nPageNumb, pSdrObj); + if (sMediaURL.startsWith("vnd.sun.star.Package:")) + { + // Embedded media + OUString aTempFileURL; + xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; + pPDF->SetScreenStream(nScreenId, aTempFileURL); + } + else // Linked media + pPDF->SetScreenURL(nScreenId, sMediaURL); +} + +static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrintState& rState, + ScDocument& rDoc, SCTAB nTab, tools::Long nStartPage, + bool bSinglePageSheets) +{ + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); + vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); + if (pPDF && pPDF->GetIsExportTaggedPDF() && pDrawLayer) + { + + if (!bSinglePageSheets) + { + SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); + OSL_ENSURE(pPage, "Page ?"); + if (pPage) + { + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pStylePool->Find(rDoc.GetPageStyle(nTab), SfxStyleFamily::Page); + SfxItemSet* pItemSet = &pStyleSheet->GetItemSet(); + + tools::Long nLeftMargin(pItemSet->Get(ATTR_LRSPACE).GetLeft()); + nLeftMargin = o3tl::convert(nLeftMargin, o3tl::Length::twip, o3tl::Length::mm100); + + tools::Long nTopMargin(pItemSet->Get(ATTR_ULSPACE).GetUpper()); + nTopMargin = o3tl::convert(nTopMargin, o3tl::Length::twip, o3tl::Length::mm100); + + tools::Long nHeader = 0; + const SvxSetItem* pHeaderSetItem = &pItemSet->Get(ATTR_PAGE_HEADERSET); + bool bHasHdr = pHeaderSetItem->GetItemSet().Get(ATTR_PAGE_ON).GetValue(); + if (bHasHdr) + { + const SfxItemSet* pHeaderSet = &pHeaderSetItem->GetItemSet(); + tools::Long nHdrHeight = pHeaderSet->Get(ATTR_PAGE_SIZE).GetSize().Height(); + nHeader = o3tl::convert(nHdrHeight, o3tl::Length::twip, o3tl::Length::mm100); + } + + bool bTopDown = pItemSet->Get(ATTR_PAGE_TOPDOWN).GetValue(); + + SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups); + SdrObject* pObj = aIter.Next(); + while (pObj && pObj->IsVisible()) + { + uno::Reference<drawing::XShape> xShape(pObj->getUnoShape(), uno::UNO_QUERY); + if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape") + { + SCCOL nX1, nX2; + SCROW nY1, nY2; + sal_Int32 nPageNumb = nStartPage; + if (bTopDown) // top-bottom page order + { + nX1 = 0; + for (size_t i = 0; i < rState.nPagesX; ++i) + { + nX2 = (*rState.xPageEndX)[i]; + for (size_t j = 0; j < rState.nPagesY; ++j) + { + auto& rPageRow = (*rState.xPageRows)[j]; + nY1 = rPageRow.GetStartRow(); + nY2 = rPageRow.GetEndRow(); + + tools::Rectangle aPageRect(rDoc.GetMMRect(nX1, nY1, nX2, nY2, nTab)); + tools::Rectangle aTmpRect(aPageRect.GetIntersection(pObj->GetCurrentBoundRect())); + if (!aTmpRect.IsEmpty()) + { + tools::Long nPosX(aTmpRect.getX() - aPageRect.getX() + nLeftMargin); + tools::Long nPosY(aTmpRect.getY() - aPageRect.getY() + nHeader + nTopMargin); + tools::Rectangle aRect(Point(nPosX, nPosY), aTmpRect.GetSize()); + lcl_SetMediaScreen(xShape, pDev, aRect, nPageNumb); + } + ++nPageNumb; + } + nX1 = nX2 + 1; + } + } + else // left to right page order + { + for (size_t i = 0; i < rState.nPagesY; ++i) + { + auto& rPageRow = (*rState.xPageRows)[i]; + nY1 = rPageRow.GetStartRow(); + nY2 = rPageRow.GetEndRow(); + nX1 = 0; + for (size_t j = 0; j < rState.nPagesX; ++j) + { + nX2 = (*rState.xPageEndX)[j]; + + tools::Rectangle aPageRect(rDoc.GetMMRect(nX1, nY1, nX2, nY2, nTab)); + tools::Rectangle aTmpRect(aPageRect.GetIntersection(pObj->GetCurrentBoundRect())); + if (!aTmpRect.IsEmpty()) + { + tools::Long nPosX(aTmpRect.getX() - aPageRect.getX() + nLeftMargin); + tools::Long nPosY(aTmpRect.getY() - aPageRect.getY() + nHeader + nTopMargin); + tools::Rectangle aRect(Point(nPosX, nPosY), aTmpRect.GetSize()); + lcl_SetMediaScreen(xShape, pDev, aRect, nPageNumb); + } + ++nPageNumb; + nX1 = nX2 + 1; + } + } + } + } + pObj = aIter.Next(); + } + } + } + else // export whole sheet + { + SCTAB nTabCount = rDoc.GetTableCount(); + for (SCTAB i = 0; i < nTabCount; ++i) + { + SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i)); + OSL_ENSURE(pPage, "Page ?"); + if (pPage) + { + SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups); + SdrObject* pObj = aIter.Next(); + while (pObj && pObj->IsVisible()) + { + uno::Reference<drawing::XShape> xShape(pObj->getUnoShape(), uno::UNO_QUERY); + if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape") + { + tools::Rectangle aRect(pObj->GetCurrentBoundRect()); + lcl_SetMediaScreen(xShape, pDev, aRect, i); + } + pObj = aIter.Next(); + } + } + } + } + } +} + void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelection, const uno::Sequence<beans::PropertyValue>& rOptions ) { @@ -2151,6 +2323,17 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTab; + if (!maValidPages.empty()) + nTab = pPrintFuncCache->GetTabForPage(maValidPages.at(nRenderer) - 1); + else + nTab = pPrintFuncCache->GetTabForPage(nRenderer); + + tools::Long nTabStart = pPrintFuncCache->GetTabStart(nTab); + + if (nRenderer == nTabStart) + lcl_PDFExportMediaShapeScreen(pDev, *m_pPrintState, rDoc, nTab, nTabStart, bSinglePageSheets); + ScRange aRange; const ScRange* pSelRange = nullptr; if ( bSinglePageSheets ) @@ -2225,12 +2408,6 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec } } aDrawViewKeeper; - SCTAB nTab; - if ( !maValidPages.empty() ) - nTab = pPrintFuncCache->GetTabForPage( maValidPages.at( nRenderer )-1 ); - else - nTab = pPrintFuncCache->GetTabForPage( nRenderer ); - ScDrawLayer* pModel = rDoc.GetDrawLayer(); if( pModel ) @@ -2285,7 +2462,6 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec aPage.Select( nRenderer+1 ); tools::Long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); - tools::Long nTabStart = pPrintFuncCache->GetTabStart( nTab ); vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(pDev->GetExtOutDevData() ); if ( nRenderer == nTabStart ) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index d419981d8e..877675c0ac 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1877,8 +1877,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic) // Cells to the left are marked directly, cells to the // right are handled by the flag for nX2 SCCOL nMarkX = ( nCellX <= nX2 ) ? nCellX : nX2; - RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : &pRowInfo[0]; - pMarkRowInfo->basicCellInfo(nMarkX).bEditEngine = true; + pThisRowInfo->basicCellInfo(nMarkX).bEditEngine = true; bDoCell = false; // don't draw here } if ( bDoCell ) @@ -4429,14 +4428,17 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) SCROW nCellY = nY; bool bDoCell = false; + // if merged cell contains hidden row or column or both + const ScMergeFlagAttr* pMergeFlag = mpDoc->GetAttr(nX, nY, nTab, ATTR_MERGE_FLAG); + bool bOverlapped = (pMergeFlag->IsHorOverlapped() || pMergeFlag->IsVerOverlapped()); + tools::Long nPosY = nRowPosY; - if ( nArrY == 0 ) + if (bOverlapped) { - nPosY = nScrY; - nY = pRowInfo[1].nRowNo; + nY = pRowInfo[nArrY].nRowNo; SCCOL nOverX; // start of the merged cells SCROW nOverY; - if (GetMergeOrigin( nX,nY, 1, nOverX,nOverY, true )) + if (GetMergeOrigin( nX,nY, nArrY, nOverX,nOverY, true )) { nCellX = nOverX; nCellY = nOverY; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9eff50195e..a69ab1447f 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1091,7 +1091,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM ); - bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() ); + bool bLayoutRTL = bHoriz && aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() ); ScrollType eType = pScroll->GetScrollType(); if ( eType == ScrollType::Drag ) @@ -1129,7 +1129,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) nScrollMin = aViewData.GetFixPosX(); if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); - tools::Long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; + tools::Long nScrollPos = GetScrollBarPos( *pScroll, bLayoutRTL ) + nScrollMin; OUString aHelpStr; tools::Rectangle aRect; @@ -1162,6 +1162,22 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) else bDragging = false; + if ( bHoriz && bLayoutRTL ) + { + // change scroll type so visible/previous cells calculation below remains the same + switch ( eType ) + { + case ScrollType::LineUp: eType = ScrollType::LineDown; break; + case ScrollType::LineDown: eType = ScrollType::LineUp; break; + case ScrollType::PageUp: eType = ScrollType::PageDown; break; + case ScrollType::PageDown: eType = ScrollType::PageUp; break; + default: + { + // added to avoid warnings + } + } + } + tools::Long nDelta(0); switch ( eType ) { @@ -1194,7 +1210,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); - tools::Long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; + tools::Long nScrollPos = GetScrollBarPos( *pScroll, bLayoutRTL ) + nScrollMin; nDelta = nScrollPos - nViewPos; // tdf#152406 Disable anti-jitter code for scroll wheel events diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index a7de6bdf67..5c19b6cf07 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -352,16 +352,45 @@ void ScTabView::SetScrollBar( ScrollAdaptor& rScroll, tools::Long nRangeMax, too if ( nVisible == 0 ) nVisible = 1; // #i59893# don't use visible size 0 - rScroll.SetRange( Range( 0, nRangeMax ) ); - rScroll.SetVisibleSize( nVisible ); - rScroll.SetThumbPos( nPos ); + // RTL layout uses a negative range to simulate a mirrored scroll bar. + // SetScrollBar/GetScrollBarPos hide this so outside of these functions normal cell + // addresses can be used. + if ( bLayoutRTL ) + { + rScroll.SetRange( Range( -nRangeMax, 0 ) ); + rScroll.SetVisibleSize( nVisible ); + rScroll.SetThumbPos( -nPos - nVisible ); + } + else + { + rScroll.SetRange( Range( 0, nRangeMax ) ); + rScroll.SetVisibleSize( nVisible ); + rScroll.SetThumbPos( nPos ); + } - rScroll.EnableRTL( bLayoutRTL ); + // Related: tdf#93352 always disable RTL for scrollbars + // Enabling RTL causes the following bugs when clicking or + // dragging the mouse in scrollbars in Calc's RTL UI: + // - Click or drag events get mirrored so you must click or + // drag in unexpected locations to move the scrollbar thumb + // in the desired direction + // - Repeatedly dragging the scrollbar thumb leftward can only + // move no highter than the R, S, or T columns + rScroll.EnableRTL( false ); + + // Related: tdf#93352 swap arrows if layout is RTL + // We cannot use EnableRTL(true) to signal that the arrows + // should be swapped (see comment above) so explicitly enable + // or disable arrow swapping. + rScroll.SetSwapArrows( bLayoutRTL ); } -tools::Long ScTabView::GetScrollBarPos( const ScrollAdaptor& rScroll ) +tools::Long ScTabView::GetScrollBarPos( const ScrollAdaptor& rScroll, bool bLayoutRTL ) { - return rScroll.GetThumbPos(); + if ( bLayoutRTL ) + return -rScroll.GetThumbPos() - rScroll.GetVisibleSize(); + else + return rScroll.GetThumbPos(); } // UpdateScrollBars - set visible area and scroll width of scroll bars @@ -425,7 +454,7 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType ) nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); tools::Long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, rDoc.MaxRow(), nStartY ); - SetScrollBar( *aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); + SetScrollBar( *aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, false ); if (bRight) { @@ -438,7 +467,7 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType ) { nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP ); tools::Long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, rDoc.MaxRow(), 0 ); - SetScrollBar( *aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); + SetScrollBar( *aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), false ); } // test the range diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 7a6403237b..e52357f808 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -885,7 +885,8 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, // undo: save all or no content InsertDeleteFlags nContFlags = InsertDeleteFlags::NONE; - if (nFlags & InsertDeleteFlags::CONTENTS) + // tdf#160765 - save content for undo when pasting notes, even if no content was changed + if (nFlags & (InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ADDNOTES)) nContFlags |= InsertDeleteFlags::CONTENTS; if (nFlags & InsertDeleteFlags::ATTRIB) nContFlags |= InsertDeleteFlags::ATTRIB; |