summaryrefslogtreecommitdiff
path: root/sw/source/core/undo/untbl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/undo/untbl.cxx')
-rw-r--r--sw/source/core/undo/untbl.cxx45
1 files changed, 39 insertions, 6 deletions
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index d3294b5446a3..1e47d7799ef3 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -34,6 +34,8 @@
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentStylePoolAccess.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
#include <editsh.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
@@ -292,6 +294,8 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & rContext)
if( SfxItemState::SET == pTableFormat->GetItemState( RES_BREAK,
false, &pItem ) )
pNextNd->SetAttr( *pItem );
+
+ ::sw::NotifyTableCollapsedParagraph(pNextNd, nullptr);
}
m_sTableName = pTableNd->GetTable().GetFrameFormat()->GetName();
@@ -936,6 +940,12 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox )
{
m_bModifyBox = bMdfyBox;
+ FndBox_ aTmpBox( nullptr, nullptr );
+ bool bHideChanges = rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines();
+ // TODO delete/make frames only at changing line attribute TextChangesOnly (RES_PRINT) to true again
+ if ( bHideChanges )
+ aTmpBox.DelFrames( rTable );
+
// first, get back attributes of TableFrameFormat
SwFrameFormat* pFormat = rTable.GetFrameFormat();
SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet()));
@@ -944,14 +954,20 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox )
pFormat->InvalidateInSwCache(RES_ATTRSET_CHG);
+ // table without table frame
+ bool bHiddenTable = true;
+
// for safety, invalidate all TableFrames
SwIterator<SwTabFrame,SwFormat> aIter( *pFormat );
for( SwTabFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
+ {
if( pLast->GetTable() == &rTable )
{
pLast->InvalidateAll();
pLast->SetCompletePaint();
+ bHiddenTable = false;
}
+ }
// fill FrameFormats with defaults (0)
pFormat = nullptr;
@@ -976,6 +992,21 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox )
m_aFrameFormats.clear();
m_bModifyBox = false;
+
+ if ( bHideChanges )
+ {
+ if ( bHiddenTable )
+ {
+ SwTableNode* pTableNode = rTable.GetTableNode();
+ pTableNode->DelFrames();
+ SwNodeIndex aTableIdx( *pTableNode->EndOfSectionNode(), 1 );
+ pTableNode->MakeOwnFrames(&aTableIdx);
+ }
+ else
+ {
+ aTmpBox.MakeFrames( rTable );
+ }
+ }
}
void SaveTable::SaveContentAttrs( SwDoc* pDoc )
@@ -2446,11 +2477,11 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext)
else
*aPam.GetPoint() = SwPosition( aTmpIdx );
}
- pUndo = std::make_unique<SwUndoDelete>( aPam, bDeleteCompleteParagraph, true );
+ pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, bDeleteCompleteParagraph, true);
}
else
{
- pUndo = std::make_unique<SwUndoDelete>( aPam, true );
+ pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true);
if( pEntry->pUndo )
{
pEntry->pUndo->UndoImpl(rContext);
@@ -2524,7 +2555,9 @@ void SwUndoTableCpyTable::RedoImpl(::sw::UndoRedoContext & rContext)
// b62341295: Redline for copying tables - Start.
rDoc.GetNodes().MakeTextNode( aInsIdx, rDoc.GetDfltTextFormatColl() );
SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode());
- std::unique_ptr<SwUndo> pUndo = IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ? nullptr : std::make_unique<SwUndoDelete>( aPam, true );
+ std::unique_ptr<SwUndo> pUndo(IDocumentRedlineAccess::IsRedlineOn(GetRedlineFlags())
+ ? nullptr
+ : std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true));
if( pEntry->pUndo )
{
pEntry->pUndo->UndoImpl(rContext);
@@ -2601,7 +2634,7 @@ void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent
SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode() );
if( !pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
- pEntry->pUndo = std::make_unique<SwUndoDelete>( aPam, true );
+ pEntry->pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true);
}
pEntry->pBoxNumAttr = std::make_unique<SfxItemSetFixed<
@@ -2703,7 +2736,7 @@ std::unique_ptr<SwUndo> SwUndoTableCpyTable::PrepareRedline( SwDoc* pDoc, const
aCellEnd = SwPosition(
SwNodeIndex( *rBox.GetSttNd()->EndOfSectionNode() ));
SwPaM aTmpPam( aDeleteStart, aCellEnd );
- pUndo = std::make_unique<SwUndoDelete>( aTmpPam, true );
+ pUndo = std::make_unique<SwUndoDelete>(aTmpPam, SwDeleteFlags::Default, true);
}
SwPosition aCellStart( SwNodeIndex( *rBox.GetSttNd(), 2 ) );
pText = aCellStart.nNode.GetNode().GetTextNode();
@@ -2792,7 +2825,7 @@ void SwUndoCpyTable::UndoImpl(::sw::UndoRedoContext & rContext)
}
SwPaM aPam( *pTNd, *pTNd->EndOfSectionNode(), SwNodeOffset(0) , SwNodeOffset(1) );
- m_pDelete.reset( new SwUndoDelete( aPam, true ) );
+ m_pDelete.reset(new SwUndoDelete(aPam, SwDeleteFlags::Default, true));
}
void SwUndoCpyTable::RedoImpl(::sw::UndoRedoContext & rContext)