Kaydet (Commit) 7472081c authored tarafından Philipp Weissenbacher's avatar Philipp Weissenbacher Kaydeden (comit) Tor Lillqvist

Translate German comments, fix some whitespace

Change-Id: Icceb0221dc8fd5e211a75d4fc25e6a3e871461b8
Reviewed-on: https://gerrit.libreoffice.org/2796Reviewed-by: 's avatarTor Lillqvist <tml@iki.fi>
Tested-by: 's avatarTor Lillqvist <tml@iki.fi>
üst f339e01a
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "hintids.hxx" #include "hintids.hxx"
#include <editeng/lrspitem.hxx> #include <editeng/lrspitem.hxx>
#include <editeng/boxitem.hxx> #include <editeng/boxitem.hxx>
...@@ -56,7 +55,7 @@ using namespace ::com::sun::star; ...@@ -56,7 +55,7 @@ using namespace ::com::sun::star;
extern void ClearFEShellTabCols(); extern void ClearFEShellTabCols();
//siehe auch swtable.cxx // See swtable.cxx too
#define COLFUZZY 20L #define COLFUZZY 20L
inline bool IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; } inline bool IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; }
...@@ -101,7 +100,7 @@ static void lcl_GetStartEndCell( const SwCursor& rCrsr, ...@@ -101,7 +100,7 @@ static void lcl_GetStartEndCell( const SwCursor& rCrsr,
SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd ) SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd )
{ {
OSL_ENSURE( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( sal_False ), OSL_ENSURE( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( sal_False ),
"Tabselection nicht auf Cnt." ); "Tab selection not at ContentNode" );
Point aPtPos, aMkPos; Point aPtPos, aMkPos;
const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr); const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
...@@ -111,7 +110,7 @@ static void lcl_GetStartEndCell( const SwCursor& rCrsr, ...@@ -111,7 +110,7 @@ static void lcl_GetStartEndCell( const SwCursor& rCrsr,
aMkPos = pShCrsr->GetMkPos(); aMkPos = pShCrsr->GetMkPos();
} }
// robust: // Robust:
SwCntntNode* pPointNd = rCrsr.GetCntntNode(); SwCntntNode* pPointNd = rCrsr.GetCntntNode();
SwCntntNode* pMarkNd = rCrsr.GetCntntNode(sal_False); SwCntntNode* pMarkNd = rCrsr.GetCntntNode(sal_False);
...@@ -146,26 +145,27 @@ static bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, ...@@ -146,26 +145,27 @@ static bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
return !rBoxes.empty(); return !rBoxes.empty();
} }
/*********************************************************************** /**
#* Class : SwDoc * Class: SwDoc
#* Methoden : SetRowHeight(), GetRowHeight() * Methods: SetRowHeight(), GetRowHeight()
#***********************************************************************/ *
//Die Zeilenhoehe wird ausgehend von der Selektion ermittelt/gesetzt. * The line height is calculated from the Selection.
//Ausgehend von jeder Zelle innerhalb der Selektion werden nach oben alle * Starting with every Cell within the Selection, all Cells are iterated
//Zeilen abgeklappert, die oberste Zeile erhaelt den gewuenschten Wert alle * through in an upwards fashion.
//tieferliegenden Zeilen einen entsprechenden Wert der sich aus der *
//Relation der alten und neuen Groesse der obersten Zeile und ihrer * The topmost Line gets the requested value, all Lines below it get
//eigenen Groesse ergiebt. * a respective value that is calculated from the relation of the old and
//Alle veraenderten Zeilen erhalten ggf. ein eigenes FrmFmt. * new size of the topmost Line in the lower line's own size.
//Natuerlich darf jede Zeile nur einmal angefasst werden. *
* All changed Lines may get an own FrmFmt.
* Of course we can only touch every Line once.
*/
inline void InsertLine( std::vector<SwTableLine*>& rLineArr, SwTableLine* pLine ) inline void InsertLine( std::vector<SwTableLine*>& rLineArr, SwTableLine* pLine )
{ {
if( rLineArr.end() == std::find( rLineArr.begin(), rLineArr.end(), pLine ) ) if( rLineArr.end() == std::find( rLineArr.begin(), rLineArr.end(), pLine ) )
rLineArr.push_back( pLine ); rLineArr.push_back( pLine );
} }
//-----------------------------------------------------------------------------
static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed ) static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed )
{ {
...@@ -179,7 +179,6 @@ static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed ...@@ -179,7 +179,6 @@ static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed
} }
return false; return false;
} }
//-----------------------------------------------------------------------------
struct LinesAndTable struct LinesAndTable
{ {
...@@ -236,12 +235,12 @@ bool _FindLine( _FndLine& rLine, LinesAndTable* pPara ) ...@@ -236,12 +235,12 @@ bool _FindLine( _FndLine& rLine, LinesAndTable* pPara )
static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& rCursor, bool bRemoveLines ) static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& rCursor, bool bRemoveLines )
{ {
//Zuerst die selektierten Boxen einsammeln. // Collect the selected Boxes first
SwSelBoxes aBoxes; SwSelBoxes aBoxes;
if( !::lcl_GetBoxSel( rCursor, aBoxes )) if( !::lcl_GetBoxSel( rCursor, aBoxes ))
return ; return ;
//Die selektierte Struktur kopieren. // Copy the selected structure
const SwTable &rTable = aBoxes[0]->GetSttNd()->FindTableNode()->GetTable(); const SwTable &rTable = aBoxes[0]->GetSttNd()->FindTableNode()->GetTable();
LinesAndTable aPara( rArr, rTable ); LinesAndTable aPara( rArr, rTable );
_FndBox aFndBox( 0, 0 ); _FndBox aFndBox( 0, 0 );
...@@ -250,7 +249,7 @@ static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& r ...@@ -250,7 +249,7 @@ static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& r
ForEach_FndLineCopyCol( (SwTableLines&)rTable.GetTabLines(), &aTmpPara ); ForEach_FndLineCopyCol( (SwTableLines&)rTable.GetTabLines(), &aTmpPara );
} }
//Diejenigen Lines einsammeln, die nur selektierte Boxen enthalten. // Collect the Lines which only contain selected Boxes
::_FindBox(aFndBox, &aPara); ::_FindBox(aFndBox, &aPara);
// Remove lines, that have a common superordinate row. // Remove lines, that have a common superordinate row.
...@@ -274,7 +273,6 @@ static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& r ...@@ -274,7 +273,6 @@ static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& r
} }
} }
//-----------------------------------------------------------------------------
static void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew ) static void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew )
{ {
...@@ -290,7 +288,6 @@ static void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine* ...@@ -290,7 +288,6 @@ static void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine*
} }
} }
//-----------------------------------------------------------------------------
static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew ); static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew );
...@@ -302,7 +299,6 @@ static void lcl_ProcessRowSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableLine ...@@ -302,7 +299,6 @@ static void lcl_ProcessRowSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableLine
::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew ); ::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew );
} }
//-----------------------------------------------------------------------------
static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew ) static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew )
{ {
...@@ -316,17 +312,13 @@ static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox * ...@@ -316,17 +312,13 @@ static void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *
} }
} }
//-----------------------------------------------------------------------------
/******************************************************************************
* void SwDoc::SetRowSplit()
******************************************************************************/
void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew ) void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
{ {
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, false ); ::lcl_CollectLines( aRowArr, rCursor, false );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -348,10 +340,6 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew ) ...@@ -348,10 +340,6 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
} }
} }
/******************************************************************************
* SwTwips SwDoc::GetRowSplit() const
******************************************************************************/
void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
{ {
rpSz = 0; rpSz = 0;
...@@ -359,7 +347,7 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const ...@@ -359,7 +347,7 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, false ); ::lcl_CollectLines( aRowArr, rCursor, false );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -377,16 +365,12 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const ...@@ -377,16 +365,12 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
} }
} }
/******************************************************************************
* void SwDoc::SetRowHeight( SwTwips nNew )
******************************************************************************/
void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew ) void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
{ {
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, true ); ::lcl_CollectLines( aRowArr, rCursor, true );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -407,10 +391,6 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew ) ...@@ -407,10 +391,6 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
} }
} }
/******************************************************************************
* SwTwips SwDoc::GetRowHeight() const
******************************************************************************/
void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const
{ {
rpSz = 0; rpSz = 0;
...@@ -418,7 +398,7 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const ...@@ -418,7 +398,7 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, true ); ::lcl_CollectLines( aRowArr, rCursor, true );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -442,7 +422,7 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly ) ...@@ -442,7 +422,7 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, true ); ::lcl_CollectLines( aRowArr, rCursor, true );
if( 1 < aRowArr.size() ) if( 1 < aRowArr.size() )
...@@ -484,15 +464,12 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly ) ...@@ -484,15 +464,12 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
return bRet; return bRet;
} }
/******************************************************************************
* void SwDoc::SetRowBackground()
******************************************************************************/
void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew ) void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew )
{ {
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, true ); ::lcl_CollectLines( aRowArr, rCursor, true );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -514,16 +491,13 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew ...@@ -514,16 +491,13 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
} }
} }
/******************************************************************************
* SwTwips SwDoc::GetRowBackground() const
******************************************************************************/
sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd ) if( pTblNd )
{ {
std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines. std::vector<SwTableLine*> aRowArr; // For Lines collecting
::lcl_CollectLines( aRowArr, rCursor, true ); ::lcl_CollectLines( aRowArr, rCursor, true );
if( !aRowArr.empty() ) if( !aRowArr.empty() )
...@@ -542,31 +516,31 @@ sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ...@@ -542,31 +516,31 @@ sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill
return bRet; return bRet;
} }
/*********************************************************************** /**
#* Class : SwDoc * Class: SwDoc
#* Methoden : SetTabBorders(), GetTabBorders() * Methods: SetTabBorders(), GetTabBorders()
#***********************************************************************/ */
inline void InsertCell( std::vector<SwCellFrm*>& rCellArr, SwCellFrm* pCellFrm ) inline void InsertCell( std::vector<SwCellFrm*>& rCellArr, SwCellFrm* pCellFrm )
{ {
if( rCellArr.end() == std::find( rCellArr.begin(), rCellArr.end(), pCellFrm ) ) if( rCellArr.end() == std::find( rCellArr.begin(), rCellArr.end(), pCellFrm ) )
rCellArr.push_back( pCellFrm ); rCellArr.push_back( pCellFrm );
} }
//-----------------------------------------------------------------------------
static void lcl_CollectCells( std::vector<SwCellFrm*> &rArr, const SwRect &rUnion, static void lcl_CollectCells( std::vector<SwCellFrm*> &rArr, const SwRect &rUnion,
SwTabFrm *pTab ) SwTabFrm *pTab )
{ {
SwLayoutFrm *pCell = pTab->FirstCell(); SwLayoutFrm *pCell = pTab->FirstCell();
do do
{ {
// Wenn in der Zelle ein spaltiger Bereich sitzt, muessen wir // If the Cell contains a CellFrame, we need to use it
// uns erst wieder zur Zelle hochhangeln // in order to get to the Cell
while ( !pCell->IsCellFrm() ) while ( !pCell->IsCellFrm() )
pCell = pCell->GetUpper(); pCell = pCell->GetUpper();
OSL_ENSURE( pCell, "Frame ist keine Zelle." ); OSL_ENSURE( pCell, "Frame is not a Cell" );
if ( rUnion.IsOver( pCell->Frm() ) ) if ( rUnion.IsOver( pCell->Frm() ) )
::InsertCell( rArr, (SwCellFrm*)pCell ); ::InsertCell( rArr, (SwCellFrm*)pCell );
//Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche)
// Make sure the Cell is left (Areas)
SwLayoutFrm *pTmp = pCell; SwLayoutFrm *pTmp = pCell;
do do
{ pTmp = pTmp->GetNextLayoutLeaf(); { pTmp = pTmp->GetNextLayoutLeaf();
...@@ -611,8 +585,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -611,8 +585,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
bTopValid = sal_True, bBottomValid = sal_True, bTopValid = sal_True, bBottomValid = sal_True,
bLeftValid = sal_True, bRightValid = sal_True; bLeftValid = sal_True, bRightValid = sal_True;
// JP 21.07.95: die Flags im BoxInfo-Item entscheiden, wann eine // The Flags in the BoxInfo Item decide whether a BorderLine is valid!
// BorderLine gueltig ist!!
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, sal_False, if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, sal_False,
(const SfxPoolItem**)&pSetBoxInfo) ) (const SfxPoolItem**)&pSetBoxInfo) )
{ {
...@@ -622,7 +595,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -622,7 +595,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
bHoriValid = pSetBoxInfo->IsValid(VALID_HORI); bHoriValid = pSetBoxInfo->IsValid(VALID_HORI);
bVertValid = pSetBoxInfo->IsValid(VALID_VERT); bVertValid = pSetBoxInfo->IsValid(VALID_VERT);
// wollen wir die auswerten ?? // Do we want to evaluate these?
bTopValid = pSetBoxInfo->IsValid(VALID_TOP); bTopValid = pSetBoxInfo->IsValid(VALID_TOP);
bBottomValid = pSetBoxInfo->IsValid(VALID_BOTTOM); bBottomValid = pSetBoxInfo->IsValid(VALID_BOTTOM);
bLeftValid = pSetBoxInfo->IsValid(VALID_LEFT); bLeftValid = pSetBoxInfo->IsValid(VALID_LEFT);
...@@ -639,7 +612,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -639,7 +612,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
} }
else else
{ {
// nicht gesetzt, also keine gueltigen Werte // Not set, thus not valid values
bTopValid = bBottomValid = bLeftValid = bRightValid = sal_False; bTopValid = bBottomValid = bLeftValid = bRightValid = sal_False;
pSetBox = 0; pSetBox = 0;
} }
...@@ -656,14 +629,14 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -656,14 +629,14 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
aCellArr.reserve( 255 ); aCellArr.reserve( 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
//Alle Zellenkanten, die mit dem UnionRect uebereinstimmen oder // All Cell Borders that match the UnionRect or extend it are
//darueber hinausragen sind Aussenkanten. Alle anderen sind // Outer Borders. All others are Inner Borders.
//Innenkanten. //
//neu: Die Aussenkanten koennen abhaengig davon, ob es sich um eine // New: The Outer Borders can, depending on whether it's a
//Start/Mittlere/Folge -Tabelle (bei Selektionen ueber FollowTabs) // Start/Middle/Follow Table (for Selection via FollowTabs),
//handelt doch keine Aussenkanten sein. // also not be Outer Borders.
//Aussenkanten werden links, rechts, oben und unten gesetzt. // Outer Borders are set on the left, right, at the top and at the bottom.
//Innenkanten werden nur oben und links gesetzt. // Inner Borders are only set at the top and on the left.
for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j ) for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j )
{ {
SwCellFrm *pCell = aCellArr[j]; SwCellFrm *pCell = aCellArr[j];
...@@ -692,10 +665,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -692,10 +665,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
bLeftOver = bTmp; bLeftOver = bTmp;
} }
//Grundsaetzlich nichts setzen in HeadlineRepeats. // Do not set anything by default in HeadlineRepeats
if ( pTab->IsFollow() && if ( pTab->IsFollow() &&
( pTab->IsInHeadline( *pCell ) || ( pTab->IsInHeadline( *pCell ) ||
// Same holds for follow flow rows. // Same holds for follow flow rows
pCell->IsInFollowFlowRow() ) ) pCell->IsInFollowFlowRow() ) )
continue; continue;
...@@ -703,7 +676,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -703,7 +676,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
sal_Int16 nType = 0; sal_Int16 nType = 0;
//Obere Kante // Top Border
if( bTopValid ) if( bTopValid )
{ {
if ( bFirst && bTopOver ) if ( bFirst && bTopOver )
...@@ -718,7 +691,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -718,7 +691,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
} }
} }
//Linke Kante // Left Border
if ( bLeftOver ) if ( bLeftOver )
{ {
if( bLeftValid ) if( bLeftValid )
...@@ -733,7 +706,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -733,7 +706,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
nType |= 0x0008; nType |= 0x0008;
} }
//Rechte Kante // Right Border
if( bRightValid ) if( bRightValid )
{ {
if ( bRightOver ) if ( bRightOver )
...@@ -748,7 +721,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) ...@@ -748,7 +721,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
} }
} }
//Untere Kante // Bottom Border
if ( bLast && bBottomOver ) if ( bLast && bBottomOver )
{ {
if( bBottomValid ) if( bBottomValid )
...@@ -857,7 +830,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, ...@@ -857,7 +830,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
{ {
SwCellFrm *pCell = aCellArr[j]; SwCellFrm *pCell = aCellArr[j];
//Grundsaetzlich nichts setzen in HeadlineRepeats. // Do not set anything by default in HeadlineRepeats
if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) ) if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) )
continue; continue;
...@@ -971,7 +944,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -971,7 +944,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
const SwFrmFmt *pFmt = pCell->GetFmt(); const SwFrmFmt *pFmt = pCell->GetFmt();
const SvxBoxItem &rBox = pFmt->GetBox(); const SvxBoxItem &rBox = pFmt->GetBox();
//Obere Kante // Top Border
if ( bFirst && bTopOver ) if ( bFirst && bTopOver )
{ {
if (aSetBoxInfo.IsValid(VALID_TOP)) if (aSetBoxInfo.IsValid(VALID_TOP))
...@@ -982,7 +955,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -982,7 +955,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
else if ((aSetBox.GetTop() && rBox.GetTop() && else if ((aSetBox.GetTop() && rBox.GetTop() &&
!(*aSetBox.GetTop() == *rBox.GetTop())) || !(*aSetBox.GetTop() == *rBox.GetTop())) ||
((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist sal_True, wenn genau einer der beiden Pointer 0 ist ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR expression is sal_True, if one of the two pointers is 0
{ {
aSetBoxInfo.SetValid(VALID_TOP, sal_False ); aSetBoxInfo.SetValid(VALID_TOP, sal_False );
aSetBox.SetLine( 0, BOX_LINE_TOP ); aSetBox.SetLine( 0, BOX_LINE_TOP );
...@@ -990,7 +963,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -990,7 +963,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
//Linke Kante // Left Border
if ( bLeftOver ) if ( bLeftOver )
{ {
if (aSetBoxInfo.IsValid(VALID_LEFT)) if (aSetBoxInfo.IsValid(VALID_LEFT))
...@@ -1025,7 +998,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1025,7 +998,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
//Rechte Kante // Right Border
if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver ) if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver )
{ {
if ( !bRightSet ) if ( !bRightSet )
...@@ -1040,7 +1013,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1040,7 +1013,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
//Untere Kante // Bottom Border
if ( bLast && bBottomOver ) if ( bLast && bBottomOver )
{ {
if ( aSetBoxInfo.IsValid(VALID_BOTTOM) ) if ( aSetBoxInfo.IsValid(VALID_BOTTOM) )
...@@ -1057,8 +1030,8 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1057,8 +1030,8 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
} }
//in allen Zeilen ausser der letzten werden die // In all Lines, except for the last one, the horizontal Line
// horiz. Linien aus der Bottom-Linie entnommen // is taken from the Bottom Line.
else else
{ {
if (aSetBoxInfo.IsValid(VALID_HORI)) if (aSetBoxInfo.IsValid(VALID_HORI))
...@@ -1077,7 +1050,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1077,7 +1050,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
// Abstand zum Text // Distance to text
if (aSetBoxInfo.IsValid(VALID_DISTANCE)) if (aSetBoxInfo.IsValid(VALID_DISTANCE))
{ {
static sal_uInt16 const aBorders[] = { static sal_uInt16 const aBorders[] = {
...@@ -1085,12 +1058,11 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1085,12 +1058,11 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
BOX_LINE_RIGHT, BOX_LINE_LEFT }; BOX_LINE_RIGHT, BOX_LINE_LEFT };
const sal_uInt16* pBrd = aBorders; const sal_uInt16* pBrd = aBorders;
if( !bDistanceSet ) // bei 1. Durchlauf erstmal setzen if( !bDistanceSet ) // Set on first iteration
{ {
bDistanceSet = sal_True; bDistanceSet = sal_True;
for( int k = 0; k < 4; ++k, ++pBrd ) for( int k = 0; k < 4; ++k, ++pBrd )
aSetBox.SetDistance( rBox.GetDistance( *pBrd ), aSetBox.SetDistance( rBox.GetDistance( *pBrd ), *pBrd );
*pBrd );
} }
else else
{ {
...@@ -1111,10 +1083,6 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const ...@@ -1111,10 +1083,6 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
} }
} }
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetBoxAttr
#***********************************************************************/
void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
{ {
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
...@@ -1159,11 +1127,6 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) ...@@ -1159,11 +1127,6 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
} }
} }
/***********************************************************************
#* Class : SwDoc
#* Methoden : GetBoxAttr()
#***********************************************************************/
sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
...@@ -1213,15 +1176,11 @@ sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) cons ...@@ -1213,15 +1176,11 @@ sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) cons
return bRet; return bRet;
} }
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetBoxAlign, SetBoxAlign
#***********************************************************************/
void SwDoc::SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign ) void SwDoc::SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign )
{ {
OSL_ENSURE( nAlign == text::VertOrientation::NONE || OSL_ENSURE( nAlign == text::VertOrientation::NONE ||
nAlign == text::VertOrientation::CENTER || nAlign == text::VertOrientation::CENTER ||
nAlign == text::VertOrientation::BOTTOM, "wrong alignment" ); nAlign == text::VertOrientation::BOTTOM, "Wrong alignment" );
SwFmtVertOrient aVertOri( 0, nAlign ); SwFmtVertOrient aVertOri( 0, nAlign );
SetBoxAttr( rCursor, aVertOri ); SetBoxAttr( rCursor, aVertOri );
} }
...@@ -1250,14 +1209,14 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const ...@@ -1250,14 +1209,14 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
} }
/*********************************************************************** /**
#* Class : SwDoc * Class: SwDoc
#* Methoden : AdjustCellWidth() * Methods: AdjustCellWidth()
#***********************************************************************/ */
static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell ) static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell )
{ {
SwTwips nRet = 0; SwTwips nRet = 0;
const SwFrm *pFrm = pCell->Lower(); //Die ganze Zelle. const SwFrm *pFrm = pCell->Lower(); // The whole Line
SWRECTFN( pCell ) SWRECTFN( pCell )
while ( pFrm ) while ( pFrm )
{ {
...@@ -1272,28 +1231,30 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell ) ...@@ -1272,28 +1231,30 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell )
nRet = Max( nRet, nCalcFitToContent + nAdd ); nRet = Max( nRet, nCalcFitToContent + nAdd );
pFrm = pFrm->GetNext(); pFrm = pFrm->GetNext();
} }
//Umrandung und linker/rechter Rand wollen mit kalkuliert werden. // Surrounding border as well as left and Right Border also need to be respected
nRet += (pCell->Frm().*fnRect->fnGetWidth)() - nRet += (pCell->Frm().*fnRect->fnGetWidth)() -
(pCell->Prt().*fnRect->fnGetWidth)(); (pCell->Prt().*fnRect->fnGetWidth)();
//Um Rechenungenauikeiten, die spaeter bei SwTable::SetTabCols enstehen, // To compensate for the accuracy of calculation later on in SwTable::SetTabCols
//auszugleichen, addieren wir noch ein bischen. // we keep adding up a little.
nRet += COLFUZZY; nRet += COLFUZZY;
return (sal_uInt16)Max( long(MINLAY), nRet ); return (sal_uInt16)Max( long(MINLAY), nRet );
} }
/*Die Zelle ist in der Selektion, wird aber nicht von den TabCols beschrieben. /**
*Das bedeutet, dass die Zelle aufgrund der zweidimensionalen Darstellung von * The Line is within the Selection but not outlined by the TabCols.
*anderen Zellen "geteilt" wurde. Wir muessen also den Wunsch- bzw. Minimalwert *
*der Zelle auf die Spalten, durch die sie geteilt wurde verteilen. * That means that the Line has been "split" by other Cells due to the
* two-dimensional representation used. Thus, we have to distribute the cell's
* default or minium value amongst the Cell it has been split by.
* *
*Dazu sammeln wir zuerst die Spalten - nicht die Spaltentrenner! - ein, die * First, we collect the Columns (not the Column separators) which overlap
*sich mit der Zelle ueberschneiden. Den Wunschwert der Zelle verteilen wir * with the Cell. We then distribute the desired value according to the
*dann anhand des Betrages der Ueberschneidung auf die Zellen. * amount of overlapping amongst the Cells.
*Wenn eine Zelle bereits einen groesseren Wunschwert angemeldet hat, so bleibt *
*dieser erhalten, kleinere Wuensche werden ueberschrieben. * A Cell's default value stays the same if it already has a larger value than
* the desired one. It's overwritten if it's smaller.
*/ */
static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols, static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols,
const SwLayoutFrm *pCell, const SwLayoutFrm *pTab, const SwLayoutFrm *pCell, const SwLayoutFrm *pTab,
sal_Bool bWishValues ) sal_Bool bWishValues )
...@@ -1311,7 +1272,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC ...@@ -1311,7 +1272,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC
nColLeft += rCols.GetLeftMin(); nColLeft += rCols.GetLeftMin();
nColRight += rCols.GetLeftMin(); nColRight += rCols.GetLeftMin();
//Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen. // Adapt values to the proportions of the Table (Follows)
if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) ) if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) )
{ {
const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin(); const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
...@@ -1321,7 +1282,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC ...@@ -1321,7 +1282,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC
const long nCellLeft = (pCell->Frm().*fnRect->fnGetLeft)(); const long nCellLeft = (pCell->Frm().*fnRect->fnGetLeft)();
const long nCellRight = (pCell->Frm().*fnRect->fnGetRight)(); const long nCellRight = (pCell->Frm().*fnRect->fnGetRight)();
//Ueberschneidungsbetrag ermitteln. // Calculate overlapping value
long nWidth = 0; long nWidth = 0;
if ( nColLeft <= nCellLeft && nColRight >= (nCellLeft+COLFUZZY) ) if ( nColLeft <= nCellLeft && nColRight >= (nCellLeft+COLFUZZY) )
nWidth = nColRight - nCellLeft; nWidth = nColRight - nCellLeft;
...@@ -1338,22 +1299,23 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC ...@@ -1338,22 +1299,23 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC
} }
} }
/*Besorgt neue Werte zu Einstellung der TabCols. /**
*Es wird nicht ueber die Eintrage in den TabCols itereriert, sondern * Retrievs new values to set the TabCols.
*quasi ueber die Zwischenraeume, die ja die Zellen beschreiben.
* *
*bWishValues == sal_True: Es werden zur aktuellen Selektion bzw. zur aktuellen * We do not iterate over the TabCols' entries, but over the gaps that describe Cells.
* Zelle die Wunschwerte aller betroffen Zellen ermittelt.
* Sind mehrere Zellen in einer Spalte, so wird der
* groesste Wunschwert als Ergebnis geliefert.
* Fuer die TabCol-Eintraege, zu denen keine Zellen
* ermittelt wurden, werden 0-en eingetragen.
* *
*bWishValues == sal_False: Die Selektion wird senkrecht ausgedehnt. Zu jeder * @param bWishValues == sal_True: We calculate the desired value of all affected
* Spalte in den TabCols, die sich mit der Selektion * Cells for the current Selection/current Cell.
* schneidet wird der Minimalwert ermittelt. * If more Cells are within a Column, the highest
* desired value is returned.
* We set TabCol entries for which we did not calculate
* Cells to 0.
*
* @param bWishValues == sal_False: The Selection is expanded vertically.
* We calculate the minimum value for every
* Column in the TabCols that intersects with the
* Selection.
*/ */
static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols, static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols &rCols,
const SwLayoutFrm *pStart, const SwLayoutFrm *pEnd, const SwLayoutFrm *pStart, const SwLayoutFrm *pEnd,
sal_Bool bWishValues ) sal_Bool bWishValues )
...@@ -1397,7 +1359,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols ...@@ -1397,7 +1359,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols
nColLeft += rCols.GetLeftMin(); nColLeft += rCols.GetLeftMin();
nColRight += rCols.GetLeftMin(); nColRight += rCols.GetLeftMin();
//Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen. // Adapt values to the proportions of the Table (Follows)
long nLeftA = nColLeft; long nLeftA = nColLeft;
long nRightA = nColRight; long nRightA = nColRight;
if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) ) if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) )
...@@ -1407,7 +1369,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols ...@@ -1407,7 +1369,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols
nRightA += nDiff; nRightA += nDiff;
} }
//Wir wollen nicht allzu genau hinsehen. // We don't want to take a too close look
if ( ::IsSame(nCLeft, nLeftA) && ::IsSame(nCRight, nRightA)) if ( ::IsSame(nCLeft, nLeftA) && ::IsSame(nCRight, nRightA))
{ {
bNotInCols = false; bNotInCols = false;
...@@ -1432,7 +1394,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols ...@@ -1432,7 +1394,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols
} }
do { do {
pCell = pCell->GetNextLayoutLeaf(); pCell = pCell->GetNextLayoutLeaf();
}while( pCell && pCell->Frm().Width() == 0 ); } while( pCell && pCell->Frm().Width() == 0 );
} while ( pCell && pTab->IsAnLower( pCell ) ); } while ( pCell && pTab->IsAnLower( pCell ) );
} }
} }
...@@ -1440,7 +1402,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols ...@@ -1440,7 +1402,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols
void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
{ {
// pruefe ob vom aktuellen Crsr der Point/Mark in einer Tabelle stehen // Check whether the current Crsr has it's Point/Mark in a Table
SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode(); SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0; SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
if( !pTblNd ) if( !pTblNd )
...@@ -1449,13 +1411,13 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1449,13 +1411,13 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
SwLayoutFrm *pStart, *pEnd; SwLayoutFrm *pStart, *pEnd;
::lcl_GetStartEndCell( rCursor, pStart, pEnd ); ::lcl_GetStartEndCell( rCursor, pStart, pEnd );
//TabCols besorgen, den ueber diese stellen wir die Tabelle neu ein. // Collect TabCols; we reset the Table with them
SwFrm* pBoxFrm = pStart; SwFrm* pBoxFrm = pStart;
while( pBoxFrm && !pBoxFrm->IsCellFrm() ) while( pBoxFrm && !pBoxFrm->IsCellFrm() )
pBoxFrm = pBoxFrm->GetUpper(); pBoxFrm = pBoxFrm->GetUpper();
if ( !pBoxFrm ) if ( !pBoxFrm )
return; // robust return; // Robust
SwTabCols aTabCols; SwTabCols aTabCols;
GetTabCols( aTabCols, 0, (SwCellFrm*)pBoxFrm ); GetTabCols( aTabCols, 0, (SwCellFrm*)pBoxFrm );
...@@ -1470,7 +1432,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1470,7 +1432,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, sal_True ); ::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, sal_True );
//Es ist Robuster wenn wir die Min-Werte fuer die ganze Tabelle berechnen. // It's more robust if we calculate the minimum values for the whole Table
const SwTabFrm *pTab = pStart->ImplFindTabFrm(); const SwTabFrm *pTab = pStart->ImplFindTabFrm();
pStart = (SwLayoutFrm*)pTab->FirstCell(); pStart = (SwLayoutFrm*)pTab->FirstCell();
pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper(); pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper();
...@@ -1480,9 +1442,9 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1480,9 +1442,9 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
if( bBalance ) if( bBalance )
{ {
//Alle Spalten, die makiert sind haben jetzt einen Wunschwert // All Columns, which are now selected, have a desired value.
//eingtragen. Wir addieren die aktuellen Werte, teilen das Ergebnis // We add up the current values, divide the result by their
//durch die Anzahl und haben eine Wunschwert fuer den ausgleich. // count and get a desired value for balancing.
sal_uInt16 nWish = 0, nCnt = 0; sal_uInt16 nWish = 0, nCnt = 0;
for ( i = 0; i <= aTabCols.Count(); ++i ) for ( i = 0; i <= aTabCols.Count(); ++i )
{ {
...@@ -1506,12 +1468,14 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1506,12 +1468,14 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
const sal_uInt16 nOldRight = static_cast<sal_uInt16>(aTabCols.GetRight()); const sal_uInt16 nOldRight = static_cast<sal_uInt16>(aTabCols.GetRight());
//Um die Impl. einfach zu gestalten, aber trotzdem in den meissten Faellen // In order to make the implementation easier, but still use the available
//den Platz richtig auszunutzen laufen wir zweimal. // space properly, we do this twice.
//Problem: Erste Spalte wird breiter, die anderen aber erst danach //
//schmaler. Die Wunschbreite der ersten Spalte wuerde abgelehnt, weil // The problem: The first column is getting wider, the others get slimmer
//mit ihr die max. Breite der Tabelle ueberschritten wuerde. // only afterwards.
for ( sal_uInt16 k= 0; k < 2; ++k ) // The first column's desired width would be discarded as it would cause
// the Table's width to exceed the maximum width.
for ( sal_uInt16 k = 0; k < 2; ++k )
{ {
for ( i = 0; i <= aTabCols.Count(); ++i ) for ( i = 0; i <= aTabCols.Count(); ++i )
{ {
...@@ -1536,8 +1500,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1536,8 +1500,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
long nTabRight = aTabCols.GetRight() + nDiff; long nTabRight = aTabCols.GetRight() + nDiff;
//Wenn die Tabelle zu breit wuerde begrenzen wir die Anpassung // If the Table would become too wide, we restrict the
//auf das erlaubte Maximum. // adjusted amount to the allowed maximum.
if ( !bBalance && nTabRight > aTabCols.GetRightMax() ) if ( !bBalance && nTabRight > aTabCols.GetRightMax() )
{ {
const long nTmpD = nTabRight - aTabCols.GetRightMax(); const long nTmpD = nTabRight - aTabCols.GetRightMax();
...@@ -1556,11 +1520,10 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1556,11 +1520,10 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt(); SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt();
const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient(); const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient();
//So, die richtige Arbeit koennen wir jetzt der SwTable ueberlassen. // We can leave the "real" work to the SwTable now
SetTabCols( aTabCols, sal_False, 0, (SwCellFrm*)pBoxFrm ); SetTabCols( aTabCols, sal_False, 0, (SwCellFrm*)pBoxFrm );
// i54248: lijian/fme // Alignment might have been changed in SetTabCols; restore old value
// alignment might have been changed in SetTabCols, restore old value:
const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient(); const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
SwFmtHoriOrient aHori( rHori ); SwFmtHoriOrient aHori( rHori );
if ( aHori.GetHoriOrient() != nOriHori ) if ( aHori.GetHoriOrient() != nOriHori )
...@@ -1569,8 +1532,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) ...@@ -1569,8 +1532,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
pFmt->SetFmtAttr( aHori ); pFmt->SetFmtAttr( aHori );
} }
//Bei Automatischer Breite wird auf Linksbuendig umgeschaltet. // We switch to left-adjusted for automatic width
//Bei Randattributen wird der Rechte Rand angepasst. // We adjust the right border for Border attributes
if( !bBalance && nNewRight < nOldRight ) if( !bBalance && nNewRight < nOldRight )
{ {
if( aHori.GetHoriOrient() == text::HoriOrientation::FULL ) if( aHori.GetHoriOrient() == text::HoriOrientation::FULL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment