[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Nov 24 11:38:41 UTC 2018
compilerplugins/clang/unusedenumconstants.readonly.results | 6
sw/inc/tblenum.hxx | 6
sw/source/core/doc/tblrwcl.cxx | 1535 +------------
sw/source/core/docnode/ndtbl.cxx | 5
sw/source/core/frmedt/fetab.cxx | 86
sw/source/core/inc/dbg_lay.hxx | 4
sw/source/core/layout/dbg_lay.cxx | 3
7 files changed, 202 insertions(+), 1443 deletions(-)
New commits:
commit dcda5569c41b33077a1795d1e147572a2d483d04
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Nov 22 14:09:27 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Nov 24 12:38:31 2018 +0100
remove unused TableChgWidthHeightType::InsertDeleteMode
looks like as a consequence of
commit 2d5ce0e1b233c83f91481cd6b9306ac8de7f5ff8
Date: Mon Mar 26 13:08:54 2018 +0200
tdf#116452 Remove "3 seconds to add/delete col/row" functions
Change-Id: Iae3e2876ed0a0bc916bb4a53f3050d9baa45b0e7
Reviewed-on: https://gerrit.libreoffice.org/63923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results b/compilerplugins/clang/unusedenumconstants.readonly.results
index 8bd1747a6358..65e40e4cb73c 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1442,8 +1442,6 @@ sw/inc/poolfmt.hxx:422
enum RES_POOL_COLLFMT_TYPE RES_POOLCOLL_DOC_TITEL
sw/inc/reffld.hxx:38
enum REFERENCESUBTYPE REF_OUTLINE
-sw/inc/tblenum.hxx:37
- enum TableChgWidthHeightType InsertDeleteMode
sw/inc/undobj.hxx:134
enum DelContentType Fly
sw/inc/undobj.hxx:135
diff --git a/sw/inc/tblenum.hxx b/sw/inc/tblenum.hxx
index dd0504f80016..fd9ea7237fa7 100644
--- a/sw/inc/tblenum.hxx
+++ b/sw/inc/tblenum.hxx
@@ -34,14 +34,10 @@ enum class TableChgWidthHeightType : sal_uInt16
InvalidPos = 0x0f,
// The following can be "or"ed in.
- InsertDeleteMode = 0x4000, // Insert/Del-mode: the Bigger-Flag
- // tells what happens:
- // bBigger -> box gets removed.
- // !bBigger-> box gets inserted.
BiggerMode = 0x8000, // Box becomes larger -> else smaller.
};
namespace o3tl {
- template<> struct typed_flags<TableChgWidthHeightType> : is_typed_flags<TableChgWidthHeightType, 0xc00f> {};
+ template<> struct typed_flags<TableChgWidthHeightType> : is_typed_flags<TableChgWidthHeightType, 0x800f> {};
}
constexpr TableChgWidthHeightType extractPosition(TableChgWidthHeightType e) {
return static_cast<TableChgWidthHeightType>(static_cast<sal_uInt16>(e) & 0xf);
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 5b17b345666f..01af5d1d4d66 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -128,12 +128,6 @@ struct CR_SetBoxWidth
{
}
- std::unique_ptr<SwUndoTableNdsChg> CreateUndo( SwUndoId eUndoType )
- {
- pUndo = new SwUndoTableNdsChg( eUndoType, m_Boxes, *pTableNd );
- return std::unique_ptr<SwUndoTableNdsChg>(pUndo);
- }
-
void LoopClear()
{
nLowerDiff = 0; nRemainWidth = 0;
@@ -144,14 +138,6 @@ static bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
SwTwips nDist, bool bCheck );
static bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
SwTwips nDist, bool bCheck );
-static bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck );
-static bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck );
-static bool lcl_DelSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck );
-static bool lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck );
typedef bool (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, bool );
@@ -204,8 +190,6 @@ struct CR_SetLineHeight
{
bTop = TableChgWidthHeightType::CellTop == extractPosition( eType );
bBigger = bool(eType & TableChgWidthHeightType::BiggerMode );
- if( eType & TableChgWidthHeightType::InsertDeleteMode )
- bBigger = !bBigger;
nMode = pTableNd->GetTable().GetTableChgMode();
}
CR_SetLineHeight( const CR_SetLineHeight& rCpy )
@@ -214,20 +198,12 @@ struct CR_SetLineHeight
nMode( rCpy.nMode ),
bBigger( rCpy.bBigger ), bTop( rCpy.bTop )
{}
-
- std::unique_ptr<SwUndoTableNdsChg> CreateUndo( SwUndoId nUndoType )
- {
- pUndo = new SwUndoTableNdsChg( nUndoType, m_Boxes, *pTableNd );
- return std::unique_ptr<SwUndoTableNdsChg>(pUndo);
- }
};
static bool lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
SwTwips nDist, bool bCheck );
static bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
SwTwips nDist, bool bCheck );
-static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
- SwTwips nDist, bool bCheck );
typedef bool (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, bool );
@@ -2539,1119 +2515,232 @@ static bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
return true;
}
-static bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck )
+static void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam )
{
SwTableBoxes& rBoxes = pLine->GetTabBoxes();
- for( size_t n = 0; n < rBoxes.size(); ++n )
+ for( auto pBox : rBoxes )
{
- SwTableBox* pBox = rBoxes[ n ];
- SwTableBoxFormat* pFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat());
- const SwFormatFrameSize& rSz = pFormat->GetFrameSize();
- SwTwips nWidth = rSz.GetWidth();
+ SwFormatFrameSize aSz( pBox->GetFrameFormat()->GetFrameSize() );
+ SwTwips nWidth = aSz.GetWidth();
+ nWidth *= rParam.nDiff;
+ nWidth /= rParam.nMaxSize;
+ aSz.SetWidth( nWidth );
+ rParam.aShareFormats.SetSize( *pBox, aSz );
- int nCmp {0};
+ for( auto pLn : pBox->GetTabLines() )
+ ::lcl_AjustLines( pLn, rParam );
+ }
+}
- if( bCheck )
- {
- for( size_t i = 0; i < pBox->GetTabLines().size(); ++i )
- if( !::lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam,
- nDist, true ))
- return false;
+#ifdef DBG_UTIL
+void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize )
+{
+ const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
- // Collect all "ContentBoxes"
- if( std::abs( nDist + ( rParam.bLeft ? 0 : nWidth )
- - rParam.nSide ) < COLFUZZY )
- nCmp = 1;
- else if( nDist + ( rParam.bLeft ? 0 : nWidth/2 ) > rParam.nSide )
- nCmp = 2;
+ SwTwips nCurrentSize = 0;
+ // See if the tables have a correct width
+ for (const SwTableBox* pBox : rBoxes)
+ {
+ const SwTwips nBoxW = pBox->GetFrameFormat()->GetFrameSize().GetWidth();
+ nCurrentSize += nBoxW;
- if( nCmp )
- {
- rParam.bAnyBoxFnd = true;
- if( pFormat->GetProtect().IsContentProtected() )
- return false;
+ for( auto pLn : pBox->GetTabLines() )
+ CheckBoxWidth( *pLn, nBoxW );
+ }
- if( rParam.bSplittBox &&
- nWidth - rParam.nDiff <= COLFUZZY +
- ( 567 / 2 /*leave room for at least 0.5 cm*/) )
- return false;
+ if (sal::static_int_cast< unsigned long >(std::abs(nCurrentSize - nSize)) >
+ (COLFUZZY * rBoxes.size()))
+ {
+ OSL_FAIL( "Line's Boxes are too small or too large" );
+ }
+}
+#endif
- if( pBox->GetSttNd() )
- {
- rParam.m_Boxes.insert(pBox);
- }
+bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo )
+{
+ SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout
- break;
- }
- }
- else
- {
- SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
- for( auto pLn : pBox->GetTabLines() )
- {
- rParam.nLowerDiff = 0;
- lcl_InsSelBox( pLn, rParam, nDist, false );
+ const SwFormatFrameSize& rSz = GetFrameFormat()->GetFrameSize();
+ const SvxLRSpaceItem& rLR = GetFrameFormat()->GetLRSpace();
- if( nLowerDiff < rParam.nLowerDiff )
- nLowerDiff = rParam.nLowerDiff;
- }
- rParam.nLowerDiff = nOldLower;
+ std::unique_ptr<FndBox_> xFndBox; // for insertion/deletion
+ SwTableSortBoxes aTmpLst; // for Undo
+ bool bBigger,
+ bRet = false,
+ bLeft = TableChgWidthHeightType::ColLeft == extractPosition( eType ) ||
+ TableChgWidthHeightType::CellLeft == extractPosition( eType );
+ sal_uLong nBoxIdx = rCurrentBox.GetSttIdx();
+
+ // Get the current Box's edge
+ // Only needed for manipulating the width
+ const SwTwips nDist = ::lcl_GetDistance( &rCurrentBox, bLeft );
+ SwTwips nDistStt = 0;
+ CR_SetBoxWidth aParam( eType, nRelDiff, nDist, rSz.GetWidth(),
+ bLeft ? nDist : rSz.GetWidth() - nDist,
+ const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode()) );
+ bBigger = aParam.bBigger;
- if( nLowerDiff )
- nCmp = 1;
- else if( std::abs( nDist + ( rParam.bLeft ? 0 : nWidth )
- - rParam.nSide ) < COLFUZZY )
- nCmp = 2;
- else if( nDist + nWidth / 2 > rParam.nSide )
- nCmp = 3;
+ FN_lcl_SetBoxWidth fnSelBox, fnOtherBox;
+ fnSelBox = lcl_SetSelBoxWidth;
+ fnOtherBox = lcl_SetOtherBoxWidth;
- if( nCmp )
+ switch( extractPosition(eType) )
+ {
+ case TableChgWidthHeightType::ColRight:
+ case TableChgWidthHeightType::ColLeft:
+ if( TableChgMode::VarWidthChangeAbs == m_eTableChgMode )
+ {
+ // First test if we have room at all
+ bool bChgLRSpace = true;
+ if( bBigger )
{
- // This column contains the Cursor - so decrease/increase
- if( 1 == nCmp )
+ if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) &&
+ !rSz.GetWidthPercent() )
{
- if( !rParam.bSplittBox )
- {
- // the current Box on
- SwFormatFrameSize aNew( rSz );
- aNew.SetWidth( nWidth + rParam.nDiff );
- rParam.aShareFormats.SetSize( *pBox, aNew );
- }
+ // silence -Wsign-compare on Android with the static cast
+ bRet = rSz.GetWidth() < static_cast<unsigned short>(USHRT_MAX) - nRelDiff;
+ bChgLRSpace = bLeft ? rLR.GetLeft() >= nAbsDiff
+ : rLR.GetRight() >= nAbsDiff;
}
else
- {
- OSL_ENSURE( pBox->GetSttNd(), "This must be an EndBox!");
+ bRet = bLeft ? rLR.GetLeft() >= nAbsDiff
+ : rLR.GetRight() >= nAbsDiff;
- if( !rParam.bLeft && 3 != nCmp )
- ++n;
+ if( !bRet )
+ {
+ // Then call itself recursively; only with another mode (proportional)
+ TableChgMode eOld = m_eTableChgMode;
+ m_eTableChgMode = TableChgMode::FixedWidthChangeProp;
- ::InsTableBox( pFormat->GetDoc(), rParam.pTableNd,
- pLine, pFormat, pBox, n );
+ bRet = SetColWidth( rCurrentBox, eType, nAbsDiff, nRelDiff,
+ ppUndo );
+ m_eTableChgMode = eOld;
+ return bRet;
+ }
+ }
+ else
+ {
+ bRet = true;
+ for( auto const & n: m_aLines )
+ {
+ aParam.LoopClear();
+ if( !(*fnSelBox)( n, aParam, nDistStt, true ))
+ {
+ bRet = false;
+ break;
+ }
+ }
+ }
- SwTableBox* pNewBox = rBoxes[ n ];
- SwFormatFrameSize aNew( rSz );
- aNew.SetWidth( rParam.nDiff );
- rParam.aShareFormats.SetSize( *pNewBox, aNew );
+ if( bRet )
+ {
+ if( ppUndo )
+ ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
- // Special case: There is no space in the other Boxes, but in the Cell
- if( rParam.bSplittBox )
+ long nFrameWidth = LONG_MAX;
+ LockModify();
+ SwFormatFrameSize aSz( rSz );
+ SvxLRSpaceItem aLR( rLR );
+ if( bBigger )
+ {
+ // If the Table does not have any room to grow, we need to create some!
+ // silence -Wsign-compare on Android with the static cast
+ if( aSz.GetWidth() + nRelDiff > static_cast<unsigned short>(USHRT_MAX) )
{
- // the current Box on
- SwFormatFrameSize aNewSize( rSz );
- aNewSize.SetWidth( nWidth - rParam.nDiff );
- rParam.aShareFormats.SetSize( *pBox, aNewSize );
+ // Break down to USHRT_MAX / 2
+ CR_SetBoxWidth aTmpPara( TableChgWidthHeightType::ColLeft, aSz.GetWidth() / 2,
+ 0, aSz.GetWidth(), aSz.GetWidth(), aParam.pTableNd );
+ for( size_t nLn = 0; nLn < m_aLines.size(); ++nLn )
+ ::lcl_AjustLines( m_aLines[ nLn ], aTmpPara );
+ aSz.SetWidth( aSz.GetWidth() / 2 );
+ aParam.nDiff = nRelDiff /= 2;
+ aParam.nSide /= 2;
+ aParam.nMaxSize /= 2;
}
- // Special treatment for the Border
- // The right one needs to be removed
+ if( bLeft )
+ aLR.SetLeft( sal_uInt16( aLR.GetLeft() - nAbsDiff ) );
+ else
+ aLR.SetRight( sal_uInt16( aLR.GetRight() - nAbsDiff ) );
+ }
+ else if( bLeft )
+ aLR.SetLeft( sal_uInt16( aLR.GetLeft() + nAbsDiff ) );
+ else
+ aLR.SetRight( sal_uInt16( aLR.GetRight() + nAbsDiff ) );
+
+ if( bChgLRSpace )
+ GetFrameFormat()->SetFormatAttr( aLR );
+ const SwFormatHoriOrient& rHOri = GetFrameFormat()->GetHoriOrient();
+ if( text::HoriOrientation::FULL == rHOri.GetHoriOrient() ||
+ (text::HoriOrientation::LEFT == rHOri.GetHoriOrient() && aLR.GetLeft()) ||
+ (text::HoriOrientation::RIGHT == rHOri.GetHoriOrient() && aLR.GetRight()))
+ {
+ SwFormatHoriOrient aHOri( rHOri );
+ aHOri.SetHoriOrient( text::HoriOrientation::NONE );
+ GetFrameFormat()->SetFormatAttr( aHOri );
+
+ // If the Table happens to contain relative values (USHORT_MAX),
+ // we need to convert them to absolute ones now.
+ // Bug 61494
+ if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) &&
+ !rSz.GetWidthPercent() )
{
- const SvxBoxItem& rBoxItem = pBox->GetFrameFormat()->GetBox();
- if( rBoxItem.GetRight() )
+ SwTabFrame* pTabFrame = SwIterator<SwTabFrame,SwFormat>( *GetFrameFormat() ).First();
+ if( pTabFrame &&
+ pTabFrame->getFramePrintArea().Width() != rSz.GetWidth() )
{
- SvxBoxItem aTmp( rBoxItem );
- aTmp.SetLine( nullptr, SvxBoxItemLine::RIGHT );
- rParam.aShareFormats.SetAttr( rParam.bLeft
- ? *pNewBox
- : *pBox, aTmp );
+ nFrameWidth = pTabFrame->getFramePrintArea().Width();
+ if( bBigger )
+ nFrameWidth += nAbsDiff;
+ else
+ nFrameWidth -= nAbsDiff;
}
}
}
- rParam.nLowerDiff = rParam.nDiff;
- break;
- }
- }
+ if( bBigger )
+ aSz.SetWidth( aSz.GetWidth() + nRelDiff );
+ else
+ aSz.SetWidth( aSz.GetWidth() - nRelDiff );
- if( rParam.bLeft && rParam.nMode != TableChgMode::FixedWidthChangeAbs && nDist >= rParam.nSide )
- break;
+ if( rSz.GetWidthPercent() )
+ aSz.SetWidthPercent( static_cast<sal_uInt8>(( aSz.GetWidth() * 100 ) /
+ ( aSz.GetWidth() + aLR.GetRight() + aLR.GetLeft())));
- nDist += nWidth;
- }
- return true;
-}
+ GetFrameFormat()->SetFormatAttr( aSz );
+ aParam.nTableWidth = sal_uInt16( aSz.GetWidth() );
-static bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck )
-{
- // Special case: There is no space in the other Boxes, but in the cell
- if( rParam.bSplittBox )
- return true;
+ UnlockModify();
- SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 n = m_aLines.size(); n; )
+ {
+ --n;
+ aParam.LoopClear();
+ (*fnSelBox)( m_aLines[ n ], aParam, nDistStt, false );
+ }
- // Table fixed, proportional
- if( !rParam.nRemainWidth && TableChgMode::FixedWidthChangeProp == rParam.nMode )
- {
- // Find the right width to which the relative width adjustment
- // corresponds to
- SwTwips nTmpDist = nDist;
- for( auto pBox : rBoxes )
- {
- SwTwips nWidth = pBox->GetFrameFormat()->GetFrameSize().GetWidth();
- if( (nTmpDist + nWidth / 2 ) > rParam.nSide )
- {
- rParam.nRemainWidth = rParam.bLeft
- ? sal_uInt16(nTmpDist)
- : sal_uInt16(rParam.nTableWidth - nTmpDist);
- break;
+ // If the Table happens to contain relative values (USHORT_MAX),
+ // we need to convert them to absolute ones now.
+ // Bug 61494
+ if( LONG_MAX != nFrameWidth )
+ {
+ SwFormatFrameSize aAbsSz( aSz );
+ aAbsSz.SetWidth( nFrameWidth );
+ GetFrameFormat()->SetFormatAttr( aAbsSz );
+ }
}
- nTmpDist += nWidth;
}
- }
-
- for( SwTableBoxes::size_type n = 0; n < rBoxes.size(); ++n )
- {
- SwTableBox* pBox = rBoxes[ n ];
- SwFrameFormat* pFormat = pBox->GetFrameFormat();
- const SwFormatFrameSize& rSz = pFormat->GetFrameSize();
- SwTwips nWidth = rSz.GetWidth();
-
- if( bCheck )
+ else if( bLeft ? nDist != 0 : std::abs( rSz.GetWidth() - nDist ) > COLFUZZY )
{
- for( auto pLn : pBox->GetTabLines() )
- if( !::lcl_InsOtherBox( pLn, rParam, nDist, true ))
- return false;
+ bRet = true;
+ if( bLeft && TableChgMode::FixedWidthChangeAbs == m_eTableChgMode )
+ aParam.bBigger = !bBigger;
- if(
- rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide &&
- (TableChgMode::FixedWidthChangeAbs != rParam.nMode ||
- (n < rBoxes.size() &&
- (nDist + nWidth + rBoxes[ n+1 ]->
- GetFrameFormat()->GetFrameSize().GetWidth() / 2)
- > rParam.nSide) ))
- : (nDist + nWidth / 2 ) > rParam.nSide
- )
+ // First test if we have room at all
+ if( aParam.bBigger )
{
- rParam.bAnyBoxFnd = true;
- SwTwips nDiff;
- if( TableChgMode::FixedWidthChangeProp == rParam.nMode ) // Table fixed, proportional
- {
- // calculate relatively
- nDiff = nWidth;
- nDiff *= rParam.nDiff;
- nDiff /= rParam.nRemainWidth;
-
- if( nWidth < nDiff || nWidth - nDiff < MINLAY )
- return false;
- }
- else
- {
- nDiff = rParam.nDiff;
-
- // See if the left or right Box is big enough to give up space.
- // We're inserting a Box before or after.
- SwTwips nTmpWidth = nWidth;
- if( rParam.bLeft && pBox->GetUpper()->GetUpper() )
- {
- const SwTableBox* pTmpBox = pBox;
- sal_uInt16 nBoxPos = n;
- while( !nBoxPos && pTmpBox->GetUpper()->GetUpper() )
- {
- pTmpBox = pTmpBox->GetUpper()->GetUpper();
- nBoxPos = pTmpBox->GetUpper()->GetBoxPos( pTmpBox );
- }
- nTmpWidth = pTmpBox->GetFrameFormat()->GetFrameSize().GetWidth();
- }
-
- if( nTmpWidth < nDiff || nTmpWidth - nDiff < MINLAY )
- return false;
- break;
- }
- }
- }
- else
- {
- SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
- for( auto pLn : pBox->GetTabLines() )
- {
- rParam.nLowerDiff = 0;
- lcl_InsOtherBox( pLn, rParam, nDist, false );
-
- if( nLowerDiff < rParam.nLowerDiff )
- nLowerDiff = rParam.nLowerDiff;
- }
- rParam.nLowerDiff = nOldLower;
-
- if( nLowerDiff ||
- (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide &&
- (TableChgMode::FixedWidthChangeAbs != rParam.nMode ||
- (n < rBoxes.size() &&
- (nDist + nWidth + rBoxes[ n+1 ]->
- GetFrameFormat()->GetFrameSize().GetWidth() / 2)
- > rParam.nSide) ))
- : (nDist + nWidth / 2 ) > rParam.nSide ))
- {
- if( !nLowerDiff )
- {
- if( TableChgMode::FixedWidthChangeProp == rParam.nMode ) // Table fixed, proportional
- {
- // Calculate relatively
- nLowerDiff = nWidth;
- nLowerDiff *= rParam.nDiff;
- nLowerDiff /= rParam.nRemainWidth;
- }
- else
- nLowerDiff = rParam.nDiff;
- }
-
- SwFormatFrameSize aNew( rSz );
- rParam.nLowerDiff += nLowerDiff;
-
- if( rParam.bBigger )
- aNew.SetWidth( nWidth - nLowerDiff );
- else
- aNew.SetWidth( nWidth + nLowerDiff );
- rParam.aShareFormats.SetSize( *pBox, aNew );
-
- if( TableChgMode::FixedWidthChangeAbs == rParam.nMode )
- break;
- }
- }
-
- nDist += nWidth;
- }
- return true;
-}
-
-// The position comparison's result
-// SwComparePosition::Before, // Box comes before
-// SwComparePosition::Behind, // Box comes after
-// SwComparePosition::Inside, // Box is completely within start/end
-// SwComparePosition::Outside, // Box overlaps start/end completely
-// SwComparePosition::Equal, // Box and start/end are the same
-// SwComparePosition::OverlapBefore, // Box overlapps the start
-// SwComparePosition::OverlapBehind // Box overlapps the end
-static SwComparePosition CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd,
- sal_uInt16 nBoxStt, sal_uInt16 nBoxEnd )
-{
- // Still treat COLFUZZY!
- SwComparePosition nRet;
- if( nBoxStt + COLFUZZY < nStt )
- {
- if( nBoxEnd > nStt + COLFUZZY )
- {
- if( nBoxEnd >= nEnd + COLFUZZY )
- nRet = SwComparePosition::Outside;
- else
- nRet = SwComparePosition::OverlapBefore;
- }
- else
- nRet = SwComparePosition::Before;
- }
- else if( nEnd > nBoxStt + COLFUZZY )
- {
- if( nEnd + COLFUZZY >= nBoxEnd )
- {
- if( COLFUZZY > std::abs( long(nEnd) - long(nBoxEnd) ) &&
- COLFUZZY > std::abs( long(nStt) - long(nBoxStt) ) )
- nRet = SwComparePosition::Equal;
- else
- nRet = SwComparePosition::Inside;
- }
- else
- nRet = SwComparePosition::OverlapBehind;
- }
- else
- nRet = SwComparePosition::Behind;
-
- return nRet;
-}
-
-static void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam,
- SwTwips nWidth )
-{
- // 1. step: Calculate own width
- SwTableBoxes& rBoxes = rLine.GetTabBoxes();
- SwTwips nBoxWidth = 0;
-
- for( auto n = rBoxes.size(); n; )
- nBoxWidth += rBoxes[ --n ]->GetFrameFormat()->GetFrameSize().GetWidth();
-
- if( COLFUZZY < std::abs( nWidth - nBoxWidth ))
- {
- // Thus, they need to be adjusted
- for( auto n = rBoxes.size(); n; )
- {
- SwTableBox* pBox = rBoxes[ --n ];
- SwFormatFrameSize aNew( pBox->GetFrameFormat()->GetFrameSize() );
- long nDiff = aNew.GetWidth();
- nDiff *= nWidth;
- nDiff /= nBoxWidth;
- aNew.SetWidth( nDiff );
-
- rParam.aShareFormats.SetSize( *pBox, aNew );
-
- if( !pBox->GetSttNd() )
- {
- // Has Lower itself, so also adjust that
- for( auto i = pBox->GetTabLines().size(); i; )
- ::lcl_DelSelBox_CorrLowers( *pBox->GetTabLines()[ --i ],
- rParam, nDiff );
- }
- }
- }
-}
-
-static void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam,
- const SwFormatFrameSize& rOldSz,
- sal_uInt16& rDelWidth, SwTwips nDist )
-{
- long nDiff = 0;
- bool bSetSize = false;
-
- switch( rParam.nMode )
- {
- case TableChgMode::FixedWidthChangeAbs: // Fixed width table, change neighbor
- nDiff = rDelWidth + rParam.nLowerDiff;
- bSetSize = true;
- break;
-
- case TableChgMode::FixedWidthChangeProp: // Fixed width table, change all neighbors
- if( !rParam.nRemainWidth )
- {
- // Calculate
- if( rParam.bLeft )
- rParam.nRemainWidth = sal_uInt16(nDist);
- else
- rParam.nRemainWidth = sal_uInt16(rParam.nTableWidth - nDist);
- }
-
- // Calculate relatively
- nDiff = rOldSz.GetWidth();
- nDiff *= rDelWidth + rParam.nLowerDiff;
- nDiff /= rParam.nRemainWidth;
-
- bSetSize = true;
- break;
-
- case TableChgMode::VarWidthChangeAbs: // Variable table, change all neighbors
- if( COLFUZZY < std::abs( rParam.nBoxWidth -
- ( rDelWidth + rParam.nLowerDiff )))
- {
- nDiff = rDelWidth + rParam.nLowerDiff - rParam.nBoxWidth;
- if( 0 < nDiff )
- rDelWidth = rDelWidth - sal_uInt16(nDiff);
- else
- rDelWidth = rDelWidth + sal_uInt16(-nDiff);
- bSetSize = true;
- }
- break;
- }
-
- if( bSetSize )
- {
- SwFormatFrameSize aNew( rOldSz );
- aNew.SetWidth( aNew.GetWidth() + nDiff );
- rParam.aShareFormats.SetSize( rBox, aNew );
-
- // Change the Lower once again
- for( auto i = rBox.GetTabLines().size(); i; )
- ::lcl_DelSelBox_CorrLowers( *rBox.GetTabLines()[ --i ], rParam,
- aNew.GetWidth() );
- }
-}
-
-static bool lcl_DeleteBox_Recursive( CR_SetBoxWidth& rParam, SwTableBox& rBox,
- bool bCheck )
-{
- bool bRet = true;
- if( rBox.GetSttNd() )
- {
- if( bCheck )
- {
- rParam.bAnyBoxFnd = true;
- if( rBox.GetFrameFormat()->GetProtect().IsContentProtected() )
- bRet = false;
- else
- {
- SwTableBox* pBox = &rBox;
- rParam.m_Boxes.insert(pBox);
- }
- }
- else
- ::DeleteBox_( rParam.pTableNd->GetTable(), &rBox,
- rParam.pUndo, false, true, &rParam.aShareFormats );
- }
- else
- {
- // We need to delete these sequentially via the ContentBoxes
- for( auto i = rBox.GetTabLines().size(); i; )
- {
- SwTableLine& rLine = *rBox.GetTabLines()[ --i ];
- for( auto n = rLine.GetTabBoxes().size(); n; )
- {
- if (!::lcl_DeleteBox_Recursive( rParam,
- *rLine.GetTabBoxes()[ --n ], bCheck ))
- {
- return false;
- }
- }
- }
- }
- return bRet;
-}
-
-static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam,
- SwTwips nDist, bool bCheck )
-{
- SwTableBoxes& rBoxes = pTabLine->GetTabBoxes();
- SwTableBoxes::size_type n;
- SwTableBoxes::size_type nCntEnd;
-
- sal_uInt16 nBoxChkStt, nBoxChkEnd, nDelWidth = 0;
- if( rParam.bLeft )
- {
- n = rBoxes.size();
- nCntEnd = 0;
- nBoxChkStt = static_cast<sal_uInt16>(rParam.nSide);
- nBoxChkEnd = static_cast<sal_uInt16>(rParam.nSide + rParam.nBoxWidth);
- }
- else
- {
- n = 0;
- nCntEnd = rBoxes.size();
- nBoxChkStt = static_cast<sal_uInt16>(rParam.nSide - rParam.nBoxWidth);
- nBoxChkEnd = static_cast<sal_uInt16>(rParam.nSide);
- }
-
- while( n != nCntEnd )
- {
- SwTableBox* pBox;
- if( rParam.bLeft )
- pBox = rBoxes[ --n ];
- else
- pBox = rBoxes[ n++ ];
-
- SwFrameFormat* pFormat = pBox->GetFrameFormat();
- const SwFormatFrameSize& rSz = pFormat->GetFrameSize();
- long nWidth = rSz.GetWidth();
- bool bDelBox = false, bChgLowers = false;
-
- // Test the Box width and react accordingly
- SwComparePosition ePosType = ::CheckBoxInRange(
- nBoxChkStt, nBoxChkEnd,
- sal_uInt16(rParam.bLeft ? nDist - nWidth : nDist),
- sal_uInt16(rParam.bLeft ? nDist : nDist + nWidth));
-
- switch( ePosType )
- {
- case SwComparePosition::Before:
- if( bCheck )
- {
- if( rParam.bLeft )
- return true;
- }
- else if( rParam.bLeft )
- {
- ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
- if( TableChgMode::FixedWidthChangeAbs == rParam.nMode )
- n = nCntEnd;
- }
- break;
-
- case SwComparePosition::Behind:
- if( bCheck )
- {
- if( !rParam.bLeft )
- return true;
- }
- else if( !rParam.bLeft )
- {
- ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
- if( TableChgMode::FixedWidthChangeAbs == rParam.nMode )
- n = nCntEnd;
- }
- break;
-
- case SwComparePosition::Outside: // Box fully overlaps start/end
- case SwComparePosition::Inside: // Box is completely within start/end
- case SwComparePosition::Equal: // Box and start/end are the same
- bDelBox = true;
- break;
-
- case SwComparePosition::OverlapBefore: // Box overlaps the start
- if( nBoxChkStt <= ( nDist + (rParam.bLeft ? - nWidth / 2
- : nWidth / 2 )))
- {
- if( !pBox->GetSttNd() )
- bChgLowers = true;
- else
- bDelBox = true;
- }
- else if( !bCheck && rParam.bLeft )
- {
- if( !pBox->GetSttNd() )
- bChgLowers = true;
- else
- {
- ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
- if( TableChgMode::FixedWidthChangeAbs == rParam.nMode )
- n = nCntEnd;
- }
- }
- break;
-
- case SwComparePosition::OverlapBehind: // Box overlaps the end
- // JP 10.02.99:
- // Delete generally or (like in OVERLAP_BEFORE) only delete the one who reaches up to the half into the delete Box?
- if( !pBox->GetSttNd() )
- bChgLowers = true;
- else
- bDelBox = true;
- break;
- default: break;
- }
-
- if( bDelBox )
- {
- nDelWidth = nDelWidth + sal_uInt16(nWidth);
- if( bCheck )
- {
- // The last/first Box can only be deleted for the variable Table,
- // if it's as large as the change in the Table.
- if( (( TableChgMode::VarWidthChangeAbs != rParam.nMode ||
- nDelWidth != rParam.nBoxWidth ) &&
- COLFUZZY > std::abs( rParam.bLeft
- ? nWidth - nDist
- : (nDist + nWidth - rParam.nTableWidth )))
- || !::lcl_DeleteBox_Recursive(rParam, *pBox, bCheck))
- {
- return false;
- }
-
- if( pFormat->GetProtect().IsContentProtected() )
- return false;
- }
- else
- {
- ::lcl_DeleteBox_Recursive(rParam, *pBox, bCheck);
-
- if( !rParam.bLeft )
- {
- --n;
- --nCntEnd;
- }
- }
- }
- else if( bChgLowers )
- {
- bool bFirst = true, bCorrLowers = false;
- long nLowerDiff = 0;
- long nOldLower = rParam.nLowerDiff;
- sal_uInt16 nOldRemain = rParam.nRemainWidth;
-
- for( auto i = pBox->GetTabLines().size(); i; )
- {
- rParam.nLowerDiff = nDelWidth + nOldLower;
- rParam.nRemainWidth = nOldRemain;
- SwTableLine* pLine = pBox->GetTabLines()[ --i ];
- if( !::lcl_DelSelBox( pLine, rParam, nDist, bCheck ))
- return false;
-
- // Do the Box and its Lines still exist?
- if( n < rBoxes.size() &&
- pBox == rBoxes[ rParam.bLeft ? n : n-1 ] &&
- i < pBox->GetTabLines().size() &&
- pLine == pBox->GetTabLines()[ i ] )
- {
- if( !bFirst && !bCorrLowers &&
- COLFUZZY < std::abs( nLowerDiff - rParam.nLowerDiff ) )
- bCorrLowers = true;
-
- // The largest deletion width counts, but only if we don't
- // delete the whole Line
- if( nLowerDiff < rParam.nLowerDiff )
- nLowerDiff = rParam.nLowerDiff;
-
- bFirst = false;
- }
- }
- rParam.nLowerDiff = nOldLower;
- rParam.nRemainWidth = nOldRemain;
-
- // Did we delete all Boxes? Then the deletion width = the Box width, of course
- if( !nLowerDiff )
- nLowerDiff = nWidth;
-
- // Adjust deletion width!
- nDelWidth = nDelWidth + sal_uInt16(nLowerDiff);
-
- if( !bCheck )
- {
- // Has the Box already been removed?
- if( n > rBoxes.size() ||
- pBox != rBoxes[ ( rParam.bLeft ? n : n-1 ) ] )
- {
- // Then change the loop variable when deleting to the right
- if( !rParam.bLeft )
- {
- --n;
- --nCntEnd;
- }
- }
- else
- {
- // Or else we need to adapt the Box's size
- SwFormatFrameSize aNew( rSz );
- bool bCorrRel = false;
-
- if( TableChgMode::VarWidthChangeAbs != rParam.nMode )
- {
- switch( ePosType )
- {
- case SwComparePosition::OverlapBefore: // Box overlaps the start
- if( TableChgMode::FixedWidthChangeProp == rParam.nMode )
- bCorrRel = rParam.bLeft;
- else if( rParam.bLeft ) // TableChgMode::FixedWidthChangeAbs
- {
- nLowerDiff = nLowerDiff - nDelWidth;
- bCorrLowers = true;
- n = nCntEnd;
- }
- break;
-
- case SwComparePosition::OverlapBehind: // Box overlaps the end
- if( TableChgMode::FixedWidthChangeProp == rParam.nMode )
- bCorrRel = !rParam.bLeft;
- else if( !rParam.bLeft ) // TableChgMode::FixedWidthChangeAbs
- {
- nLowerDiff = nLowerDiff - nDelWidth;
- bCorrLowers = true;
- n = nCntEnd;
- }
- break;
-
- default:
- OSL_ENSURE( !pBox, "we should never reach this!" );
- break;
- }
- }
-
- if( bCorrRel )
- {
- if( !rParam.nRemainWidth )
- {
- // Calculate
- if( rParam.bLeft )
- rParam.nRemainWidth = sal_uInt16(nDist - nLowerDiff);
- else
- rParam.nRemainWidth = sal_uInt16(rParam.nTableWidth - nDist
- - nLowerDiff );
- }
-
- long nDiff = aNew.GetWidth() - nLowerDiff;
- nDiff *= nDelWidth + rParam.nLowerDiff;
- nDiff /= rParam.nRemainWidth;
-
- aNew.SetWidth( aNew.GetWidth() - nLowerDiff + nDiff );
- }
- else
- aNew.SetWidth( aNew.GetWidth() - nLowerDiff );
- rParam.aShareFormats.SetSize( *pBox, aNew );
-
- if( bCorrLowers )
- {
- // Adapt the Lower once again
- for( auto i = pBox->GetTabLines().size(); i; )
- ::lcl_DelSelBox_CorrLowers( *pBox->
- GetTabLines()[ --i ], rParam, aNew.GetWidth() );
- }
- }
- }
- }
-
- if( rParam.bLeft )
- nDist -= nWidth;
- else
- nDist += nWidth;
- }
- rParam.nLowerDiff = nDelWidth;
- return true;
-}
-
-// Dummy function for the method SetColWidth
-static bool lcl_DelOtherBox( SwTableLine* , CR_SetBoxWidth& , SwTwips , bool )
-{
- return true;
-}
-
-static void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam )
-{
- SwTableBoxes& rBoxes = pLine->GetTabBoxes();
- for( auto pBox : rBoxes )
- {
- SwFormatFrameSize aSz( pBox->GetFrameFormat()->GetFrameSize() );
- SwTwips nWidth = aSz.GetWidth();
- nWidth *= rParam.nDiff;
- nWidth /= rParam.nMaxSize;
- aSz.SetWidth( nWidth );
- rParam.aShareFormats.SetSize( *pBox, aSz );
-
- for( auto pLn : pBox->GetTabLines() )
- ::lcl_AjustLines( pLn, rParam );
- }
-}
-
-#ifdef DBG_UTIL
-void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize )
-{
- const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
-
- SwTwips nCurrentSize = 0;
- // See if the tables have a correct width
- for (const SwTableBox* pBox : rBoxes)
- {
- const SwTwips nBoxW = pBox->GetFrameFormat()->GetFrameSize().GetWidth();
- nCurrentSize += nBoxW;
-
- for( auto pLn : pBox->GetTabLines() )
- CheckBoxWidth( *pLn, nBoxW );
- }
-
- if (sal::static_int_cast< unsigned long >(std::abs(nCurrentSize - nSize)) >
- (COLFUZZY * rBoxes.size()))
- {
- OSL_FAIL( "Line's Boxes are too small or too large" );
- }
-}
-#endif
-
-static FndBox_* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, std::unique_ptr<SwUndo>* ppUndo,
- SwTableSortBoxes& rTmpLst, SwTwips nDistStt )
-{
- // Find all Boxes/Lines
- SwTable& rTable = rParam.pTableNd->GetTable();
-
- if (rParam.m_Boxes.empty())
- {
- // Get the Boxes
- if( rParam.bBigger )
- for( auto pLn : rTable.GetTabLines() )
- ::lcl_DelSelBox( pLn, rParam, nDistStt, true );
- else
- for( auto pLn : rTable.GetTabLines() )
- ::lcl_InsSelBox( pLn, rParam, nDistStt, true );
- }
-
- // Prevent deleting the whole Table
- if (rParam.bBigger
- && rParam.m_Boxes.size() == rTable.GetTabSortBoxes().size())
- {
- return nullptr;
- }
-
- FndBox_* pFndBox = new FndBox_( nullptr, nullptr );
- if( rParam.bBigger )
- pFndBox->SetTableLines( rParam.m_Boxes, rTable );
- else
- {
- FndPara aPara(rParam.m_Boxes, pFndBox);
- ForEach_FndLineCopyCol( rTable.GetTabLines(), &aPara );
- OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes" );
- pFndBox->SetTableLines( rTable );
-
- if( ppUndo )
- rTmpLst.insert( rTable.GetTabSortBoxes() );
- }
-
- // Find Lines for the Layout update
- pFndBox->DelFrames( rTable );
-
- // TL_CHART2: this function get called from SetColWidth exclusively,
- // thus it is currently speculated that nothing needs to be done here.
- // Note: that SetColWidth is currently not completely understood though :-(
-
- return pFndBox;
-}
-
-bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
- SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo )
-{
- SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout
-
- const SwFormatFrameSize& rSz = GetFrameFormat()->GetFrameSize();
- const SvxLRSpaceItem& rLR = GetFrameFormat()->GetLRSpace();
-
- std::unique_ptr<FndBox_> xFndBox; // for insertion/deletion
- SwTableSortBoxes aTmpLst; // for Undo
- bool bBigger,
- bRet = false,
- bLeft = TableChgWidthHeightType::ColLeft == extractPosition( eType ) ||
- TableChgWidthHeightType::CellLeft == extractPosition( eType ),
- bInsDel = bool(eType & TableChgWidthHeightType::InsertDeleteMode );
- sal_uLong nBoxIdx = rCurrentBox.GetSttIdx();
-
- // Get the current Box's edge
- // Only needed for manipulating the width
- const SwTwips nDist = ::lcl_GetDistance( &rCurrentBox, bLeft );
- SwTwips nDistStt = 0;
- CR_SetBoxWidth aParam( eType, nRelDiff, nDist, rSz.GetWidth(),
- bLeft ? nDist : rSz.GetWidth() - nDist,
- const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode()) );
- bBigger = aParam.bBigger;
-
- FN_lcl_SetBoxWidth fnSelBox, fnOtherBox;
- if( bInsDel )
- {
- if( bBigger )
- {
- fnSelBox = lcl_DelSelBox;
- fnOtherBox = lcl_DelOtherBox;
- aParam.nBoxWidth = static_cast<sal_uInt16>(rCurrentBox.GetFrameFormat()->GetFrameSize().GetWidth());
- if( bLeft )
- nDistStt = rSz.GetWidth();
- }
- else
- {
- fnSelBox = lcl_InsSelBox;
- fnOtherBox = lcl_InsOtherBox;
- }
- }
- else
- {
- fnSelBox = lcl_SetSelBoxWidth;
- fnOtherBox = lcl_SetOtherBoxWidth;
- }
-
- switch( extractPosition(eType) )
- {
- case TableChgWidthHeightType::ColRight:
- case TableChgWidthHeightType::ColLeft:
- if( TableChgMode::VarWidthChangeAbs == m_eTableChgMode )
- {
- if( bInsDel )
- bBigger = !bBigger;
-
- // First test if we have room at all
- bool bChgLRSpace = true;
- if( bBigger )
- {
- if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) &&
- !rSz.GetWidthPercent() )
- {
- // silence -Wsign-compare on Android with the static cast
- bRet = rSz.GetWidth() < static_cast<unsigned short>(USHRT_MAX) - nRelDiff;
- bChgLRSpace = bLeft ? rLR.GetLeft() >= nAbsDiff
- : rLR.GetRight() >= nAbsDiff;
- }
- else
- bRet = bLeft ? rLR.GetLeft() >= nAbsDiff
- : rLR.GetRight() >= nAbsDiff;
-
- if( !bRet && bInsDel &&
- // Is the room on the other side?
- ( bLeft ? rLR.GetRight() >= nAbsDiff
- : rLR.GetLeft() >= nAbsDiff ))
- {
- bRet = true; bLeft = !bLeft;
- }
-
- if( !bRet )
- {
- // Then call itself recursively; only with another mode (proportional)
- TableChgMode eOld = m_eTableChgMode;
- m_eTableChgMode = TableChgMode::FixedWidthChangeProp;
-
- bRet = SetColWidth( rCurrentBox, eType, nAbsDiff, nRelDiff,
- ppUndo );
- m_eTableChgMode = eOld;
- return bRet;
- }
- }
- else
- {
- bRet = true;
- for( auto const & n: m_aLines )
- {
- aParam.LoopClear();
- if( !(*fnSelBox)( n, aParam, nDistStt, true ))
- {
- bRet = false;
- break;
- }
- }
- }
-
- if( bRet )
- {
- if( bInsDel )
- {
- xFndBox.reset(::lcl_SaveInsDelData( aParam, ppUndo,
- aTmpLst, nDistStt));
- if (aParam.bBigger &&
- aParam.m_Boxes.size() == m_TabSortContentBoxes.size())
- {
- // This whole Table is to be deleted!
- GetFrameFormat()->GetDoc()->DeleteRowCol(aParam.m_Boxes);
- return false;
- }
-
- if( ppUndo )
- *ppUndo = aParam.CreateUndo(
- aParam.bBigger ? SwUndoId::COL_DELETE
- : SwUndoId::TABLE_INSCOL );
- }
- else if( ppUndo )
- ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
-
- long nFrameWidth = LONG_MAX;
- LockModify();
- SwFormatFrameSize aSz( rSz );
- SvxLRSpaceItem aLR( rLR );
- if( bBigger )
- {
- // If the Table does not have any room to grow, we need to create some!
- // silence -Wsign-compare on Android with the static cast
- if( aSz.GetWidth() + nRelDiff > static_cast<unsigned short>(USHRT_MAX) )
- {
- // Break down to USHRT_MAX / 2
- CR_SetBoxWidth aTmpPara( TableChgWidthHeightType::ColLeft, aSz.GetWidth() / 2,
- 0, aSz.GetWidth(), aSz.GetWidth(), aParam.pTableNd );
- for( size_t nLn = 0; nLn < m_aLines.size(); ++nLn )
- ::lcl_AjustLines( m_aLines[ nLn ], aTmpPara );
- aSz.SetWidth( aSz.GetWidth() / 2 );
- aParam.nDiff = nRelDiff /= 2;
- aParam.nSide /= 2;
- aParam.nMaxSize /= 2;
- }
-
- if( bLeft )
- aLR.SetLeft( sal_uInt16( aLR.GetLeft() - nAbsDiff ) );
- else
- aLR.SetRight( sal_uInt16( aLR.GetRight() - nAbsDiff ) );
- }
- else if( bLeft )
- aLR.SetLeft( sal_uInt16( aLR.GetLeft() + nAbsDiff ) );
- else
- aLR.SetRight( sal_uInt16( aLR.GetRight() + nAbsDiff ) );
-
- if( bChgLRSpace )
- GetFrameFormat()->SetFormatAttr( aLR );
- const SwFormatHoriOrient& rHOri = GetFrameFormat()->GetHoriOrient();
- if( text::HoriOrientation::FULL == rHOri.GetHoriOrient() ||
- (text::HoriOrientation::LEFT == rHOri.GetHoriOrient() && aLR.GetLeft()) ||
- (text::HoriOrientation::RIGHT == rHOri.GetHoriOrient() && aLR.GetRight()))
- {
- SwFormatHoriOrient aHOri( rHOri );
- aHOri.SetHoriOrient( text::HoriOrientation::NONE );
- GetFrameFormat()->SetFormatAttr( aHOri );
-
- // If the Table happens to contain relative values (USHORT_MAX),
- // we need to convert them to absolute ones now.
- // Bug 61494
- if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) &&
- !rSz.GetWidthPercent() )
- {
- SwTabFrame* pTabFrame = SwIterator<SwTabFrame,SwFormat>( *GetFrameFormat() ).First();
- if( pTabFrame &&
- pTabFrame->getFramePrintArea().Width() != rSz.GetWidth() )
- {
- nFrameWidth = pTabFrame->getFramePrintArea().Width();
- if( bBigger )
- nFrameWidth += nAbsDiff;
- else
- nFrameWidth -= nAbsDiff;
- }
- }
- }
-
- if( bBigger )
- aSz.SetWidth( aSz.GetWidth() + nRelDiff );
- else
- aSz.SetWidth( aSz.GetWidth() - nRelDiff );
-
- if( rSz.GetWidthPercent() )
- aSz.SetWidthPercent( static_cast<sal_uInt8>(( aSz.GetWidth() * 100 ) /
- ( aSz.GetWidth() + aLR.GetRight() + aLR.GetLeft())));
-
- GetFrameFormat()->SetFormatAttr( aSz );
- aParam.nTableWidth = sal_uInt16( aSz.GetWidth() );
-
- UnlockModify();
-
- for( sal_uInt16 n = m_aLines.size(); n; )
- {
- --n;
- aParam.LoopClear();
- (*fnSelBox)( m_aLines[ n ], aParam, nDistStt, false );
- }
-
- // If the Table happens to contain relative values (USHORT_MAX),
- // we need to convert them to absolute ones now.
- // Bug 61494
- if( LONG_MAX != nFrameWidth )
- {
- SwFormatFrameSize aAbsSz( aSz );
- aAbsSz.SetWidth( nFrameWidth );
- GetFrameFormat()->SetFormatAttr( aAbsSz );
- }
- }
- }
- else if( bInsDel ||
- ( bLeft ? nDist != 0 : std::abs( rSz.GetWidth() - nDist ) > COLFUZZY ) )
- {
- bRet = true;
- if( bLeft && TableChgMode::FixedWidthChangeAbs == m_eTableChgMode && !bInsDel )
- aParam.bBigger = !bBigger;
-
- // First test if we have room at all
- if( bInsDel )
- {
- if( aParam.bBigger )
- {
- for( auto const & n: m_aLines )
- {
- aParam.LoopClear();
- if( !(*fnSelBox)( n, aParam, nDistStt, true ))
- {
- bRet = false;
- break;
- }
- }
- }
- else
- {
- bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY;
- if( bRet )
- {
- for( auto const & n: m_aLines )
- {
- aParam.LoopClear();
- if( !(*fnOtherBox)( n, aParam, 0, true ))
- {
- bRet = false;
- break;
- }
- }
- if( bRet && !aParam.bAnyBoxFnd )
- bRet = false;
- }
-
- if( !bRet && rCurrentBox.GetFrameFormat()->GetFrameSize().GetWidth()
- - nRelDiff > COLFUZZY +
- ( 567 / 2 /*leave room for at least 0.5 cm*/) )
- {
- // Consume the space from the current Cell
- aParam.bSplittBox = true;
- // We also need to test this!
- bRet = true;
-
- for( auto const & n: m_aLines )
- {
- aParam.LoopClear();
- if( !(*fnSelBox)( n, aParam, nDistStt, true ))
- {
- bRet = false;
- break;
- }
- }
- }
- }
- }
- else if( aParam.bBigger )
- {
- for( auto const & n: m_aLines )
+ for( auto const & n: m_aLines )
{
aParam.LoopClear();
if( !(*fnOtherBox)( n, aParam, 0, true ))
@@ -3678,21 +2767,10 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
if( bRet )
{
CR_SetBoxWidth aParam1( aParam );
- if( bInsDel )
- {
- aParam1.bBigger = !aParam.bBigger;
- xFndBox.reset(::lcl_SaveInsDelData(aParam, ppUndo, aTmpLst, nDistStt));
- if( ppUndo )
- *ppUndo = aParam.CreateUndo(
- aParam.bBigger ? SwUndoId::TABLE_DELBOX
- : SwUndoId::TABLE_INSCOL );
- }
- else if( ppUndo )
+ if( ppUndo )
ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
- if( bInsDel
- ? ( TableChgMode::FixedWidthChangeAbs == m_eTableChgMode ? (bBigger && bLeft) : bLeft )
- : ( TableChgMode::FixedWidthChangeAbs != m_eTableChgMode && bLeft ) )
+ if( TableChgMode::FixedWidthChangeAbs != m_eTableChgMode && bLeft )
{
for( sal_uInt16 n = m_aLines.size(); n; )
{
@@ -3731,10 +2809,9 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
m_eTableChgMode = eOld;
return bRet;
}
- else if( bInsDel || ( bLeft ? nDist != 0
- : (rSz.GetWidth() - nDist) > COLFUZZY ))
+ else if( bLeft ? nDist != 0 : (rSz.GetWidth() - nDist) > COLFUZZY )
{
- if( bLeft && TableChgMode::FixedWidthChangeAbs == m_eTableChgMode && !bInsDel )
+ if( bLeft && TableChgMode::FixedWidthChangeAbs == m_eTableChgMode )
aParam.bBigger = !bBigger;
// First, see if there is enough room at all
@@ -3763,50 +2840,17 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
}
// First, see if there is enough room at all
- if( bInsDel )
- {
- bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY;
- if( bRet && !aParam.bBigger )
- {
- bRet = (*fnOtherBox)( pLine, aParam, 0, true );
- if( bRet && !aParam.bAnyBoxFnd )
- bRet = false;
- }
-
- if( !bRet && !aParam.bBigger && rCurrentBox.GetFrameFormat()->
- GetFrameSize().GetWidth() - nRelDiff > COLFUZZY +
- ( 567 / 2 /*leave room for at least 0.5 cm*/) )
- {
- // Consume the room from the current Cell
- aParam.bSplittBox = true;
- bRet = true;
- }
- }
- else
- {
- FN_lcl_SetBoxWidth fnTmp = aParam.bBigger ? fnOtherBox : fnSelBox;
- bRet = (*fnTmp)( pLine, aParam, nDistStt, true );
- }
+ FN_lcl_SetBoxWidth fnTmp = aParam.bBigger ? fnOtherBox : fnSelBox;
+ bRet = (*fnTmp)( pLine, aParam, nDistStt, true );
// If true, set it
if( bRet )
{
CR_SetBoxWidth aParam1( aParam );
- if( bInsDel )
- {
- aParam1.bBigger = !aParam.bBigger;
- xFndBox.reset(::lcl_SaveInsDelData(aParam, ppUndo, aTmpLst, nDistStt));
- if( ppUndo )
- *ppUndo = aParam.CreateUndo(
- aParam.bBigger ? SwUndoId::TABLE_DELBOX
- : SwUndoId::TABLE_INSCOL );
- }
- else if( ppUndo )
+ if( ppUndo )
ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
- if( bInsDel
- ? ( TableChgMode::FixedWidthChangeAbs == m_eTableChgMode ? (bBigger && bLeft) : bLeft )
- : ( TableChgMode::FixedWidthChangeAbs != m_eTableChgMode && bLeft ) )
+ if( TableChgMode::FixedWidthChangeAbs != m_eTableChgMode && bLeft )
{
(*fnSelBox)( pLine, aParam, nDistStt, false );
(*fnOtherBox)( pLine, aParam1, nDistStt, false );
@@ -3857,43 +2901,6 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp
return bRet;
}
-static FndBox_* lcl_SaveInsDelData( CR_SetLineHeight& rParam, std::unique_ptr<SwUndo>* ppUndo,
- SwTableSortBoxes& rTmpLst )
-{
- // Find all Boxes/Lines
- SwTable& rTable = rParam.pTableNd->GetTable();
-
- OSL_ENSURE( !rParam.m_Boxes.empty(), "We can't go on without Boxes!" );
-
- // Prevent deleting the whole Table
- if (!rParam.bBigger
- && rParam.m_Boxes.size() == rTable.GetTabSortBoxes().size())
- {
- return nullptr;
- }
-
- FndBox_* pFndBox = new FndBox_( nullptr, nullptr );
- if( !rParam.bBigger )
- pFndBox->SetTableLines( rParam.m_Boxes, rTable );
- else
- {
- FndPara aPara(rParam.m_Boxes, pFndBox);
- ForEach_FndLineCopyCol( rTable.GetTabLines(), &aPara );
- OSL_ENSURE( pFndBox->GetLines().size(), "Where are the Boxes?" );
- pFndBox->SetTableLines( rTable );
-
- if( ppUndo )
- rTmpLst.insert( rTable.GetTabSortBoxes() );
- }
-
- // Find Lines for the Layout update
- pFndBox->DelFrames( rTable );
-
- // TL_CHART2: it is currently unclear if sth has to be done here.
-
- return pFndBox;
-}
-
static void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight,
bool bMinSize )
{
@@ -4001,105 +3008,6 @@ static bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam
return bRet;
}
-static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
- SwTwips nDist, bool bCheck )
-{
- if( !bCheck )
- {
- SwTableBoxes& rBoxes = pLine->GetTabBoxes();
- SwDoc* pDoc = pLine->GetFrameFormat()->GetDoc();
- if( !rParam.bBigger )
- {
- for (size_t n = rBoxes.size(); n; )
- {
- ::lcl_SaveUpperLowerBorder( rParam.pTableNd->GetTable(),
- *rBoxes[ --n ],
- rParam.aShareFormats );
- }
- for (size_t n = rBoxes.size(); n; )
- {
- ::DeleteBox_( rParam.pTableNd->GetTable(),
- rBoxes[ --n ], rParam.pUndo, false,
- false, &rParam.aShareFormats );
- }
- }
- else
- {
- // Insert Line
- SwTableLine* pNewLine = new SwTableLine( static_cast<SwTableLineFormat*>(pLine->GetFrameFormat()),
- rBoxes.size(), pLine->GetUpper() );
- SwTableLines* pLines;
- if( pLine->GetUpper() )
- pLines = &pLine->GetUpper()->GetTabLines();
- else
- pLines = &rParam.pTableNd->GetTable().GetTabLines();
- sal_uInt16 nPos = pLines->GetPos( pLine );
- if( !rParam.bTop )
- ++nPos;
- pLines->insert( pLines->begin() + nPos, pNewLine );
-
- SwFrameFormat* pNewFormat = pNewLine->ClaimFrameFormat();
- pNewFormat->SetFormatAttr( SwFormatFrameSize( ATT_MIN_SIZE, 0, nDist ) );
-
- // And once again calculate the Box count
- SwTableBoxes& rNewBoxes = pNewLine->GetTabBoxes();
- for( SwTableBoxes::size_type n = 0; n < rBoxes.size(); ++n )
- {
- SwTwips nWidth = 0;
- SwTableBox* pOld = rBoxes[ n ];
- if( !pOld->GetSttNd() )
- {
- // Not a normal content Box, so fall back to the 1st next Box
- nWidth = pOld->GetFrameFormat()->GetFrameSize().GetWidth();
- while( !pOld->GetSttNd() )
- pOld = pOld->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ];
- }
- ::InsTableBox( pDoc, rParam.pTableNd, pNewLine,
- static_cast<SwTableBoxFormat*>(pOld->GetFrameFormat()), pOld, n );
-
- // Special treatment for the border:
- // The top one needs to be removed
- const SvxBoxItem& rBoxItem = pOld->GetFrameFormat()->GetBox();
- if( rBoxItem.GetTop() )
- {
- SvxBoxItem aTmp( rBoxItem );
- aTmp.SetLine( nullptr, SvxBoxItemLine::TOP );
- rParam.aShareFormats.SetAttr( rParam.bTop
- ? *pOld
- : *rNewBoxes[ n ], aTmp );
- }
-
- if( nWidth )
- rParam.aShareFormats.SetAttr( *rNewBoxes[ n ],
- SwFormatFrameSize( ATT_FIX_SIZE, nWidth, 0 ) );
- }
- }
- }
- else
- {
- // Collect Boxes!
- SwTableBoxes& rBoxes = pLine->GetTabBoxes();
- for( auto n = rBoxes.size(); n; )
- {
- SwTableBox* pBox = rBoxes[ --n ];
- if( pBox->GetFrameFormat()->GetProtect().IsContentProtected() )
- return false;
-
- if( pBox->GetSttNd() )
- {
- rParam.m_Boxes.insert(pBox);
- }
- else
- {
- for( auto i = pBox->GetTabLines().size(); i; )
- lcl_InsDelSelLine( pBox->GetTabLines()[ --i ],
- rParam, 0, true );
- }
- }
- }
- return true;
-}
-
bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo )
{
@@ -4113,8 +3021,7 @@ bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eTy
SwTableSortBoxes aTmpLst; // for Undo
bool bBigger,
bRet = false,
- bTop = TableChgWidthHeightType::CellTop == extractPosition( eType ),
- bInsDel = bool(eType & TableChgWidthHeightType::InsertDeleteMode );
+ bTop = TableChgWidthHeightType::CellTop == extractPosition( eType );
sal_uInt16 nBaseLinePos = GetTabLines().GetPos( pBaseLine );
sal_uLong nBoxIdx = rCurrentBox.GetSttIdx();
@@ -4122,11 +3029,8 @@ bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eTy
const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode()) );
bBigger = aParam.bBigger;
- FN_lcl_SetLineHeight fnSelLine, fnOtherLine = lcl_SetOtherLineHeight;
- if( bInsDel )
- fnSelLine = lcl_InsDelSelLine;
- else
- fnSelLine = lcl_SetSelLineHeight;
+ FN_lcl_SetLineHeight fnSelLine = lcl_SetSelLineHeight;
+ FN_lcl_SetLineHeight fnOtherLine = lcl_SetOtherLineHeight;
SwTableLines* pLines = &m_aLines;
@@ -4146,11 +3050,6 @@ bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eTy
case TableChgWidthHeightType::RowBottom:
{
- if( bInsDel && !bBigger ) // By how much does it get higher?
- {
- nAbsDiff = GetRowFrame( *pBaseLine )->getFrameArea().Height();
- }
-
if( TableChgMode::VarWidthChangeAbs == m_eTableChgMode )
{
// First test if we have room at all
@@ -4162,30 +3061,7 @@ bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eTy
if( bRet )
{
- if( bInsDel )
- {
- if (aParam.m_Boxes.empty())
- {
- ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
- aParam, 0, true );
- }
-
- xFndBox.reset(::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst ));
-
- // delete complete table when last row is deleted
- if( !bBigger &&
- aParam.m_Boxes.size() == m_TabSortContentBoxes.size())
- {
- GetFrameFormat()->GetDoc()->DeleteRowCol(aParam.m_Boxes);
- return false;
- }
-
- if( ppUndo )
- *ppUndo = aParam.CreateUndo(
- bBigger ? SwUndoId::TABLE_INSROW
- : SwUndoId::ROW_DELETE );
- }
- else if( ppUndo )
+ if( ppUndo )
ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
(*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
@@ -4256,20 +3132,7 @@ bool SwTable::SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eTy
if( bRet )
{
// Adjust
- if( bInsDel )
- {
- if (aParam.m_Boxes.empty())
- {
- ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
- aParam, 0, true );
- }
- xFndBox.reset(::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst ));
- if( ppUndo )
- *ppUndo = aParam.CreateUndo(
- bBigger ? SwUndoId::TABLE_INSROW
- : SwUndoId::ROW_DELETE );
- }
- else if( ppUndo )
+ if( ppUndo )
ppUndo->reset(new SwUndoAttrTable( *aParam.pTableNd, true ));
CR_SetLineHeight aParam1( aParam );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 6f3438443463..e2fbc874aab3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3934,9 +3934,6 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightTy
SwTableNode* pTableNd = const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode());
std::unique_ptr<SwUndo> pUndo;
- if( (TableChgWidthHeightType::InsertDeleteMode & eType) && dynamic_cast<const SwDDETable*>( &pTableNd->GetTable()) != nullptr)
- return false;
-
SwTableFormulaUpdate aMsgHint( &pTableNd->GetTable() );
aMsgHint.m_eFlags = TBL_BOXPTR;
getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
@@ -3974,8 +3971,6 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightTy
if( bRet )
{
getIDocumentState().SetModified();
- if( TableChgWidthHeightType::InsertDeleteMode & eType )
- getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
}
return bRet;
}
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 0b50d6d938f4..31ecad6276e3 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -2141,32 +2141,6 @@ void SwFEShell::SetTableAttr( const SfxItemSet &rNew )
}
}
-/** move cursor within a table into previous/next row (same column)
- * @param pShell cursor shell whose cursor is to be moved
- * @param bUp true: move up, false: move down
- * @returns true if successful
- */
-static bool lcl_GoTableRow( SwCursorShell* pShell, bool bUp )
-{
- OSL_ENSURE( pShell != nullptr, "need shell" );
-
- SwPaM* pPam = pShell->GetCursor();
- const SwStartNode* pTableBox = pPam->GetNode().FindTableBoxStartNode();
- OSL_ENSURE( pTableBox != nullptr, "I'm living in a box... NOT!" );
-
- // move cursor to start node of table box
- pPam->GetPoint()->nNode = pTableBox->GetIndex();
- pPam->GetPoint()->nContent.Assign( nullptr, 0 );
- GoInContent( *pPam, fnMoveForward );
-
- // go to beginning end of table box
- SwMoveFnCollection const & fnPosSect = bUp ? fnSectionStart : fnSectionEnd;
- pShell->MoveSection( GoCurrSection, fnPosSect );
-
- // and go up/down into next content
- return bUp ? pShell->Up() : pShell->Down();
-}
-
// change a cell width/cell height/column width/row height
void SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16 nDiff )
{
@@ -2174,15 +2148,6 @@ void SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16
if( !pFrame || !pFrame->IsInTab() )
return;
- if( (TableChgWidthHeightType::InsertDeleteMode & eType) &&
- dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
- {
- vcl::Window* pWin = GetWin();
- ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, pWin ? pWin->GetFrameWeld() : nullptr,
- DialogMask::MessageInfo | DialogMask::ButtonsOk );
- return;
- }
-
SET_CURR_SHELL( this );
StartAllAction();
@@ -2208,66 +2173,17 @@ void SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16
pTab->GetFormat()->SetFormatAttr( aSz );
}
- if( (eType & TableChgWidthHeightType::BiggerMode) &&
- (eType & TableChgWidthHeightType::InsertDeleteMode) )
- {
- nDiff = sal_uInt16(aRectFnSet.GetWidth(pFrame->getFrameArea()));
-
- // we must move the cursor outside the current cell before
- // deleting the cells.
- switch( eTypePos )
- {
- case TableChgWidthHeightType::RowBottom:
- lcl_GoTableRow( this, false );
- break;
- case TableChgWidthHeightType::ColLeft:
- GoPrevCell();
- break;
- case TableChgWidthHeightType::ColRight:
- GoNextCell();
- break;
- default:
- break;
- }
- }
-
SwTwips nLogDiff = nDiff;
nLogDiff *= pTab->GetFormat()->GetFrameSize().GetWidth();
nLogDiff /= nPrtWidth;
/** The cells are destroyed in here */
- bool bRet = GetDoc()->SetColRowWidthHeight(
+ GetDoc()->SetColRowWidthHeight(
*const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()),
eType, nDiff, nLogDiff );
ClearFEShellTabCols(*GetDoc(), nullptr);
EndAllActionAndCall();
-
- if( bRet && (eType & (TableChgWidthHeightType::BiggerMode | TableChgWidthHeightType::InsertDeleteMode)) == TableChgWidthHeightType::InsertDeleteMode )
- {
- switch(extractPosition(eType))
- {
- case TableChgWidthHeightType::CellLeft:
- case TableChgWidthHeightType::ColLeft:
- GoPrevCell();
- break;
-
- case TableChgWidthHeightType::CellRight:
- case TableChgWidthHeightType::ColRight:
- GoNextCell();
- break;
-
- case TableChgWidthHeightType::CellTop:
- lcl_GoTableRow( this, true );
- break;
-
- case TableChgWidthHeightType::CellBottom:
- case TableChgWidthHeightType::RowBottom:
- lcl_GoTableRow( this, false );
- break;
- default: break;
- }
- }
}
static bool lcl_IsFormulaSelBoxes( const SwTable& rTable, const SwTableBoxFormula& rFormula,
commit 32e3238a3734049df5397aa34e569dc15c8a8178
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Nov 22 13:07:43 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Nov 24 12:38:21 2018 +0100
remove unused PROT values
Change-Id: I2a0962c68e23722370ce36ce35e8cb86a3b7a7fb
Reviewed-on: https://gerrit.libreoffice.org/63922
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results b/compilerplugins/clang/unusedenumconstants.readonly.results
index 74a84edad117..8bd1747a6358 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1448,10 +1448,6 @@ sw/inc/undobj.hxx:134
enum DelContentType Fly
sw/inc/undobj.hxx:135
enum DelContentType Bkm
-sw/source/core/inc/dbg_lay.hxx:38
- enum PROT Pos
-sw/source/core/inc/dbg_lay.hxx:46
- enum PROT Snapshot
sw/source/core/inc/SwXMLBlockImport.hxx:81
enum SwXMLTextBlockToken OFFICE_BODY
sw/source/core/inc/SwXMLBlockImport.hxx:82
diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx
index 5c46809f88ae..e9c04d81eaa9 100644
--- a/sw/source/core/inc/dbg_lay.hxx
+++ b/sw/source/core/inc/dbg_lay.hxx
@@ -35,7 +35,6 @@ enum class PROT {
ShrinkTest = 0x00000080,
Size = 0x00000100,
PrintArea = 0x00000200,
- Pos = 0x00000400,
AdjustN = 0x00000800,
Section = 0x00001000,
Cut = 0x00002000,
@@ -43,10 +42,9 @@ enum class PROT {
Leaf = 0x00008000,
TestFormat = 0x00010000,
FrmChanges = 0x00020000,
- Snapshot = 0x00040000
};
namespace o3tl {
- template<> struct typed_flags<PROT> : is_typed_flags<PROT, 0x0007ffff> {};
+ template<> struct typed_flags<PROT> : is_typed_flags<PROT, 0x0003fbff> {};
}
enum class DbgAction {
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index b3c346e81a6d..3ca7d588a161 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -632,8 +632,6 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
lcl_FrameType( aOut, pFrame ); // then the frame type
switch ( nFunction ) // and the function
{
- case PROT::Snapshot: lcl_Flags( aOut, pFrame );
- break;
case PROT::MakeAll: aOut.append("SwFrame::MakeAll");
lcl_Start( aOut, aLayer, nAct );
if( nAct == DbgAction::Start )
@@ -681,7 +679,6 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
aOut.append(static_cast<sal_Int64>(*static_cast<long*>(pParam)));
}
break;
- case PROT::Pos: break;
case PROT::PrintArea: aOut.append("PROT::PrintArea");
lcl_Start( aOut, aLayer, nAct );
break;
More information about the Libreoffice-commits
mailing list