summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-08-16 13:01:37 +0200
committerZolnai Tamás <zolnaitamas2000@gmail.com>2013-08-18 09:49:51 +0200
commit835d9e0da9416c7e586766ad734f45d048886e0a (patch)
treeaee2941aef57ba5a81d259b20edb8d3ba107a8f3
parentcc978cda8cc1d25f5f11758ff42d7c2137daf638 (diff)
CharBrd 4.1: merge borders of text portions
Revert 0d9ddccd8810a81a6f4d737870969d0dcf367d23 and 66f3b17013c467b9e0a74497738c90173b7e7b4f Solve border merge on portions level. - Add new members to text portion called m_bJoinBorderWithPrev and m_bJoinBorderWithNext which indicate when to skip left or right border. - Use these members during formating, painting and cursor calculation. Change-Id: I24f1a848e266207b252a6cd157663edc47c51de6
-rw-r--r--sw/source/core/text/inftxt.cxx3
-rw-r--r--sw/source/core/text/itratr.cxx72
-rw-r--r--sw/source/core/text/itratr.hxx20
-rw-r--r--sw/source/core/text/itrcrsr.cxx14
-rw-r--r--sw/source/core/text/itrform2.cxx139
-rw-r--r--sw/source/core/text/itrform2.hxx19
-rw-r--r--sw/source/core/text/porexp.cxx8
-rw-r--r--sw/source/core/text/portxt.cxx29
-rw-r--r--sw/source/core/text/portxt.hxx11
-rw-r--r--sw/source/core/text/txtdrop.cxx2
10 files changed, 221 insertions, 96 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 59bc5246b3c2..aff0ec99833b 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -696,7 +696,8 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo
// Draw text next to the left border
Point aFontPos(aPos);
- if( m_pFnt->GetLeftBorder() )
+ if( m_pFnt->GetLeftBorder() && rPor.InTxtGrp() &&
+ !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
{
const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
switch( m_pFnt->GetOrientation(GetTxtFrm()->IsVertical()) )
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index e674f60472df..347c196c845a 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -122,12 +122,6 @@ SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPosition ) const
sal_Bool SwAttrIter::SeekAndChgAttrIter( const xub_StrLen nNewPos, OutputDevice* pOut )
{
- sal_Bool bRet = ImplSeekAndChgAttrIter(nNewPos, pOut);
- return MergeCharBorder(false) || bRet;
-}
-
-sal_Bool SwAttrIter::ImplSeekAndChgAttrIter( const xub_StrLen nNewPos, OutputDevice* pOut )
-{
sal_Bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos );
if ( pLastOut != pOut )
{
@@ -160,13 +154,8 @@ sal_Bool SwAttrIter::IsSymbol( const xub_StrLen nNewPos )
/*************************************************************************
* SwAttrIter::SeekStartAndChg()
*************************************************************************/
-sal_Bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont )
-{
- sal_Bool bRet = ImplSeekStartAndChgAttrIter( pOut, bParaFont );
- return bParaFont ? bRet : MergeCharBorder(true) || bRet;
-}
-sal_Bool SwAttrIter::ImplSeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont )
+sal_Bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont )
{
if ( pRedln && pRedln->ExtOn() )
pRedln->LeaveExtend( *pFnt, 0 );
@@ -277,7 +266,7 @@ sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
if( pHints )
{
- if( !nNewPos || nNewPos < nPos || m_bPrevSeekRemBorder )
+ if( !nNewPos || nNewPos < nPos )
{
if( pRedln )
pRedln->Clear( NULL );
@@ -366,63 +355,6 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const
return nNext;
}
-static bool lcl_HasMergeableBorder(const SwFont& rFirst, const SwFont& rSecond)
-{
- return
- rFirst.GetOrientation() == rSecond.GetOrientation() &&
- rFirst.GetTopBorder() == rSecond.GetTopBorder() &&
- rFirst.GetBottomBorder() == rSecond.GetBottomBorder() &&
- rFirst.GetLeftBorder() == rSecond.GetLeftBorder() &&
- rFirst.GetRightBorder() == rSecond.GetRightBorder();
-}
-
-bool SwAttrIter::MergeCharBorder( const bool bStart )
-{
- const xub_StrLen nActPos = nPos;
- bool bRemoveLeft = false;
- bool bRemoveRight = false;
- SwFont aTmpFont = *pFnt;
- const sal_Int32 nTmpStart = nStartIndex;
-
- // Check whether next neightbour has same border and height
- if( aTmpFont.GetRightBorder() && pHints && nEndIndex < pHints->GetEndCount() )
- {
- ImplSeekAndChgAttrIter(GetNextAttr(), pLastOut);
- if( aTmpFont.GetHeight(pShell, *pLastOut) == pFnt->GetHeight(pShell, *pLastOut) &&
- lcl_HasMergeableBorder(aTmpFont, *pFnt) )
- {
- bRemoveRight = true;
- }
- }
-
- // Check whether previous neightbour has same border and height
- if( aTmpFont.GetLeftBorder() && nTmpStart > 0)
- {
- ImplSeekAndChgAttrIter(nActPos-1, pLastOut);
- if( aTmpFont.GetHeight(pShell, *pLastOut) == pFnt->GetHeight(pShell, *pLastOut) &&
- lcl_HasMergeableBorder(aTmpFont, *pFnt) )
- {
- bRemoveLeft = true;
- }
- }
-
- // If the iterator changed its position, than we have to reset it.
- if( nPos != nActPos )
- {
- if( bStart )
- ImplSeekStartAndChgAttrIter(pLastOut, false);
- else
- ImplSeekAndChgAttrIter(nActPos, pLastOut);
- }
-
- if( bRemoveRight )
- pFnt->SetRightBorder(0);
- if( bRemoveLeft )
- pFnt->SetLeftBorder(0);
-
- return (m_bPrevSeekRemBorder = bRemoveLeft || bRemoveRight);
-}
-
class SwMinMaxArgs
{
public:
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index f3153030f7c1..6b48dc111af5 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -60,8 +60,6 @@ private:
const void* aMagicNo[ SW_SCRIPTS ];
MSHORT aFntIdx[ SW_SCRIPTS ];
const SwTxtNode* m_pTxtNode;
- /// previous seek remove left/right border of the current font during merge character border
- bool m_bPrevSeekRemBorder;
void SeekFwd( const xub_StrLen nPos );
inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
@@ -71,17 +69,15 @@ protected:
void Rst( SwTxtAttr *pHt );
void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
inline SwAttrIter(SwTxtNode* pTxtNode)
- : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode), m_bPrevSeekRemBorder(false) {
+ : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode)
+ {
aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
}
- /// Implementation of the considering public methods (to avoid recursion)
- sal_Bool ImplSeekAndChgAttrIter( const xub_StrLen nNewPos, OutputDevice* pOut );
- sal_Bool ImplSeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont );
public:
// Constructor, destructor
inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
- : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode),m_bPrevSeekRemBorder(false)
+ : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode)
{ CtorInitAttrIter( rTxtNode, rScrInf ); }
virtual ~SwAttrIter();
@@ -102,16 +98,6 @@ public:
sal_Bool SeekAndChgAttrIter( const xub_StrLen nPos, OutputDevice* pOut );
sal_Bool SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont = sal_False );
- /** Merge character border with removing left/right border of the font if the
- * the neighbours of the current position (nPos) has the same height
- * and same kind of border.
- * @param bStart true if it is called from SeekStartAndChgAttrIter
- * false, otherwise
- * @return true, if font change (removing some of its borders)
- * false, otherwise
- **/
- bool MergeCharBorder( const bool bStart );
-
// Do we have an attribute change at all?
inline sal_Bool HasHints() const { return 0 != pHints; }
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index d35e47bac462..0c3f62f8a14a 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -931,7 +931,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
if( aInf.GetIdx() < nOfst && nOfst < aInf.GetIdx() + pPor->GetLen() )
{
// Find the current drop portion part and use its right border
- if( pPor->IsDropPortion() )
+ if( pPor->IsDropPortion() && static_cast<SwDropPortion*>(pPor)->GetLines() > 1 )
{
SwDropPortion* pDrop = static_cast<SwDropPortion*>(pPor);
const SwDropPortionPart* pCurrPart = pDrop->GetPart();
@@ -945,7 +945,8 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nX -= pCurrPart->GetFont().GetRightBorderSpace();
}
}
- else if(GetInfo().GetFont()->GetRightBorder())
+ else if( GetInfo().GetFont()->GetRightBorder() && pPor->InTxtGrp() &&
+ !static_cast<const SwTxtPortion*>(pPor)->GetJoinBorderWithNext())
{
nX -= GetInfo().GetFont()->GetRightBorderSpace();
}
@@ -1110,7 +1111,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
if ( pCMS->pSpecialPos )
{
// apply attributes to font
- SeekAndChgAttrIter( nOfst, aInf.GetOut() );
+ Seek( nOfst );
lcl_GetCharRectInsideField( aInf, *pOrig, *pCMS, *pPor );
}
}
@@ -1640,7 +1641,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
pPor->GetLen() );
// Drop portion works like a multi portion, just its parts are not portions
- if( pPor->IsDropPortion() )
+ if( pPor->IsDropPortion() && static_cast<SwDropPortion*>(pPor)->GetLines() > 1 )
{
SwDropPortion* pDrop = static_cast<SwDropPortion*>(pPor);
const SwDropPortionPart* pCurrPart = pDrop->GetPart();
@@ -1663,8 +1664,11 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
nX = std::max(0, nX - nSumBorderWidth);
}
// Shift the offset with the left border width
- else if (GetInfo().GetFont()->GetLeftBorder() )
+ else if ( GetInfo().GetFont()->GetLeftBorder() &&
+ !static_cast<const SwTxtPortion*>(pPor)->GetJoinBorderWithPrev() )
+ {
nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
+ }
aDrawInf.SetOfst( nX );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index fec3fdd1bb49..c7442e6db793 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -43,6 +43,7 @@
#include <porfld.hxx> // SwNumberPortion for CalcAscent()
#include <porftn.hxx> // SwFtnPortion
#include <porhyph.hxx>
+#include <pordrop.hxx>
#include <guess.hxx>
#include <blink.hxx> // pBlink
#include <ftnfrm.hxx> // WhichFirstPortion() -> move it
@@ -74,6 +75,9 @@ namespace {
const std::vector<long> &rFlyStarts );
//! Determine if we need to build hidden portions
static bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos );
+
+ // Check whether the two font has the same border
+ static bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
}
inline void ClearFly( SwTxtFormatInfo &rInf )
@@ -102,6 +106,7 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p
nLeftScanIdx = STRING_LEN;
nRightScanIdx = 0;
m_nHintEndIndex = 0;
+ m_pFirstOfBorderMerge = 0;
if( nStart > GetInfo().GetTxt().getLength() )
{
@@ -546,6 +551,9 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
InsertPortion( rInf, pGridKernPortion );
}
+ if( pPor->IsDropPortion() )
+ MergeCharacterBorder(*static_cast<SwDropPortion*>(pPor));
+
// the multi-portion has it's own format function
if( pPor->IsMultiPortion() && ( !pMulti || pMulti->IsBidi() ) )
bFull = BuildMultiPortion( rInf, *((SwMultiPortion*)pPor) );
@@ -699,6 +707,9 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
rInf.SetFull( bFull );
+ if( pPor->InTxtGrp() && !pPor->IsDropPortion() )
+ MergeCharacterBorder(*static_cast<SwTxtPortion*>(pPor), rInf);
+
// Restportions from fields with multiple lines don't yet have the right ascent
if ( !pPor->GetLen() && !pPor->IsFlyPortion()
&& !pPor->IsGrfNumPortion() && ! pPor->InNumberGrp()
@@ -2588,6 +2599,120 @@ SwFlyCntPortion *SwTxtFormatter::NewFlyCntPortion( SwTxtFormatInfo &rInf,
return pRet;
}
+/* Drop portion is a special case, because it has parts which aren't portions
+ but we have handle them just like portions */
+void SwTxtFormatter::MergeCharacterBorder( SwDropPortion& rPortion )
+{
+ if( rPortion.GetLines() > 1 )
+ {
+ SwDropPortionPart* pCurrPart = rPortion.GetPart();
+ bool bJoinWithPrev = false;
+ while( pCurrPart )
+ {
+ const bool bJoinWithNext =
+ pCurrPart->GetFollow() &&
+ ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont());
+
+ if( bJoinWithPrev )
+ pCurrPart->GetFont().SetLeftBorder(0);
+
+ if( bJoinWithNext )
+ {
+ pCurrPart->GetFont().SetRightBorder(0);
+ bJoinWithPrev = true;
+ }
+ else
+ {
+ bJoinWithPrev = false;
+ }
+ pCurrPart = pCurrPart->GetFollow();
+ }
+ }
+}
+
+void SwTxtFormatter::MergeCharacterBorder( SwTxtPortion& rPortion, SwTxtFormatInfo& rInf )
+{
+
+ const SwFont aCurFont = *rInf.GetFont();
+ if( aCurFont.HasBorder() )
+ {
+ // The current portion isn't inserted into the portion chain yet, so the info's
+ // last portion will be the previous one
+ if( rInf.GetLast() && rInf.GetLast()->InTxtGrp() &&
+ rInf.GetLast() != &rPortion && // For para portion (special case)
+ static_cast<SwTxtPortion*>(rInf.GetLast())->GetJoinBorderWithNext())
+ {
+ rPortion.SetJoinBorderWithPrev(true);
+ rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
+ }
+ else
+ {
+ rPortion.SetJoinBorderWithPrev(false);
+ m_pFirstOfBorderMerge = &rPortion;
+ }
+
+ // Get next portion's font
+ bool bSeek = false;
+ if( !rInf.IsFull() // Last portion of the line (in case of line break)
+ && rInf.GetIdx() + rInf.GetLen() != rInf.GetTxt().getLength() ) // Last portion of the paragraph
+ bSeek = Seek(rInf.GetIdx() + rInf.GetLen());
+
+ // If next portion has the same font then merge
+ if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) )
+ {
+ rPortion.SetJoinBorderWithNext(true);
+ rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
+ }
+ // If this is the last portion of the merge group than make the real height merge
+ else
+ {
+ rPortion.SetJoinBorderWithNext(false);
+ if( m_pFirstOfBorderMerge != &rPortion )
+ {
+ // Calculate maximum height and ascent
+ SwLinePortion* pActPor = m_pFirstOfBorderMerge;
+ sal_uInt16 nMaxAscent = 0;
+ sal_uInt16 nMaxHeight = 0;
+ bool bReachCurrent = false;
+ while( pActPor )
+ {
+ if( nMaxHeight < pActPor->Height() )
+ nMaxHeight = pActPor->Height();
+ if( nMaxAscent < pActPor->GetAscent() )
+ nMaxAscent = pActPor->GetAscent();
+
+ pActPor = pActPor->GetPortion();
+ if( !pActPor && !bReachCurrent )
+ {
+ pActPor = &rPortion;
+ bReachCurrent = true;
+ }
+ }
+
+ // Change all portion's height and ascent
+ pActPor = m_pFirstOfBorderMerge;
+ bReachCurrent = false;
+ while( pActPor )
+ {
+ if( nMaxHeight > pActPor->Height() )
+ pActPor->Height(nMaxHeight);
+ if( nMaxAscent > pActPor->GetAscent() )
+ pActPor->SetAscent(nMaxAscent);
+
+ pActPor = pActPor->GetPortion();
+ if( !pActPor && !bReachCurrent )
+ {
+ pActPor = &rPortion;
+ bReachCurrent = true;
+ }
+ }
+ m_pFirstOfBorderMerge = 0;
+ }
+ }
+ Seek(rInf.GetIdx());
+ }
+}
+
namespace {
/*************************************************************************
* ::CalcOptRepaint()
@@ -2729,6 +2854,20 @@ namespace {
return false;
}
+ bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond)
+ {
+ return
+ rFirst.GetTopBorder() == rSecond.GetTopBorder() &&
+ rFirst.GetBottomBorder() == rSecond.GetBottomBorder() &&
+ rFirst.GetLeftBorder() == rSecond.GetLeftBorder() &&
+ rFirst.GetRightBorder() == rSecond.GetRightBorder() &&
+ rFirst.GetTopBorderDist() == rSecond.GetTopBorderDist() &&
+ rFirst.GetBottomBorderDist() == rSecond.GetBottomBorderDist() &&
+ rFirst.GetLeftBorderDist() == rSecond.GetLeftBorderDist() &&
+ rFirst.GetRightBorderDist() == rSecond.GetRightBorderDist() &&
+ rFirst.GetOrientation() == rSecond.GetOrientation();
+ }
+
} //end unnamed namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index 832c95c3f898..786276bc032b 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -46,6 +46,8 @@ class SwTxtFormatter : public SwTxtPainter
sal_Bool bTruncLines : 1; // Flag for extending the repaint rect, if needed
sal_Bool bUnclipped : 1; // Flag whether repaint is larger than the fixed line height
sal_uInt16 m_nHintEndIndex; // HACK for TryNewNoLengthPortion
+ SwTxtPortion* m_pFirstOfBorderMerge; // The first text portion of a joined border (during portion bulding)
+
SwLinePortion *NewPortion( SwTxtFormatInfo &rInf );
SwTxtPortion *NewTxtPortion( SwTxtFormatInfo &rInf );
SwLinePortion *NewExtraPortion( SwTxtFormatInfo &rInf );
@@ -220,6 +222,23 @@ public:
inline const sal_uInt8 &CntMidHyph() const { return nCntMidHyph; }
inline sal_uInt8 &CntEndHyph() { return nCntEndHyph; }
inline sal_uInt8 &CntMidHyph() { return nCntMidHyph; }
+
+ /**
+ * Merge border of the drop portion with modifying the font of
+ * the portions' part. Removing left or right border.
+ * @param rPortion drop portion for merge
+ **/
+ void MergeCharacterBorder( SwDropPortion& rPortion );
+
+ /**
+ * Merge border of the text portion with setting the text portions
+ * m_bJoinBorderWidthNext and m_bJoinBorderWidthPrev members and
+ * changing the size (width, height and ascent) of the text portion
+ * to get a merged border.
+ * @param rPortion text portion for merge
+ * @param rInf contain information
+ **/
+ void MergeCharacterBorder( SwTxtPortion& rPortion, SwTxtFormatInfo& rInf );
};
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 450d30852621..4108c72606f1 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -91,6 +91,11 @@ sal_Bool SwExpandPortion::Format( SwTxtFormatInfo &rInf )
void SwExpandPortion::Paint( const SwTxtPaintInfo &rInf ) const
{
SwTxtSlot aDiffTxt( &rInf, this, true, true );
+ const SwFont aOldFont = *rInf.GetFont();
+ if( GetJoinBorderWithPrev() )
+ const_cast<SwTxtPaintInfo&>(rInf).GetFont()->SetLeftBorder(0);
+ if( GetJoinBorderWithNext() )
+ const_cast<SwTxtPaintInfo&>(rInf).GetFont()->SetRightBorder(0);
rInf.DrawBackBrush( *this );
rInf.DrawBorder( *this );
@@ -111,6 +116,9 @@ void SwExpandPortion::Paint( const SwTxtPaintInfo &rInf ) const
0 != rInf.GetSmartTags(), 0 != rInf.GetGrammarCheckList() );
else
rInf.DrawText( *this, rInf.GetLen(), sal_False );
+
+ if( GetJoinBorderWithPrev() || GetJoinBorderWithNext() )
+ *const_cast<SwTxtPaintInfo&>(rInf).GetFont() = aOldFont;
}
/*************************************************************************
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 254f93f43159..c04c60bcebf1 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -34,6 +34,7 @@
#include <viewsh.hxx>
#include <IDocumentSettingAccess.hxx>
#include <viewopt.hxx> // SwViewOptions
+#include <editeng/borderline.hxx>
#include <IMark.hxx>
#include <pam.hxx>
@@ -218,6 +219,12 @@ SwTxtPortion::SwTxtPortion( const SwLinePortion &rPortion )
: SwLinePortion( rPortion )
{
SetWhichPor( POR_TXT );
+ if( rPortion.InTxtGrp() )
+ {
+ const SwTxtPortion& rPor = static_cast<const SwTxtPortion&>(rPortion);
+ m_bJoinBorderWithPrev = rPor.m_bJoinBorderWithPrev;
+ m_bJoinBorderWithNext = rPor.m_bJoinBorderWithNext;
+ }
}
/*************************************************************************
@@ -536,7 +543,18 @@ xub_StrLen SwTxtPortion::GetCrsrOfst( const KSHORT nOfst ) const
SwPosSize SwTxtPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
{
- return rInf.GetTxtSize();
+ const SwFont aOldFont = *rInf.GetFont();
+ if( m_bJoinBorderWithPrev )
+ const_cast<SwTxtSizeInfo&>(rInf).GetFont()->SetLeftBorder(0);
+ if( m_bJoinBorderWithNext )
+ const_cast<SwTxtSizeInfo&>(rInf).GetFont()->SetRightBorder(0);
+
+ const SwPosSize aSize = rInf.GetTxtSize();
+
+ if( m_bJoinBorderWithPrev || m_bJoinBorderWithNext )
+ *const_cast<SwTxtSizeInfo&>(rInf).GetFont() = aOldFont;
+
+ return aSize;
}
/*************************************************************************
@@ -544,6 +562,12 @@ SwPosSize SwTxtPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
*************************************************************************/
void SwTxtPortion::Paint( const SwTxtPaintInfo &rInf ) const
{
+ const SwFont aOldFont = *rInf.GetFont();
+ if( m_bJoinBorderWithPrev )
+ const_cast<SwTxtPaintInfo&>(rInf).GetFont()->SetLeftBorder(0);
+ if( m_bJoinBorderWithNext )
+ const_cast<SwTxtPaintInfo&>(rInf).GetFont()->SetRightBorder(0);
+
if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetTxt()[rInf.GetIdx()])
{
rInf.DrawBackBrush( *this );
@@ -579,6 +603,9 @@ void SwTxtPortion::Paint( const SwTxtPaintInfo &rInf ) const
else
rInf.DrawText( *this, rInf.GetLen(), sal_False );
}
+
+ if( m_bJoinBorderWithPrev || m_bJoinBorderWithNext )
+ *const_cast<SwTxtPaintInfo&>(rInf).GetFont() = aOldFont;
}
/*************************************************************************
diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx
index d201c747ccbb..4c029a3db8e8 100644
--- a/sw/source/core/text/portxt.hxx
+++ b/sw/source/core/text/portxt.hxx
@@ -36,8 +36,11 @@ class SwTxtPortion : public SwLinePortion
void BreakUnderflow( SwTxtFormatInfo &rInf );
sal_Bool _Format( SwTxtFormatInfo &rInf );
+ bool m_bJoinBorderWithPrev;
+ bool m_bJoinBorderWithNext;
+
public:
- inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
+ inline SwTxtPortion(): m_bJoinBorderWithPrev(false), m_bJoinBorderWithNext(false) { SetWhichPor( POR_TXT ); }
SwTxtPortion( const SwLinePortion &rPortion );
virtual void Paint( const SwTxtPaintInfo &rInf ) const;
virtual sal_Bool Format( SwTxtFormatInfo &rInf );
@@ -55,6 +58,12 @@ public:
// Accessibility: pass information about this portion to the PortionHandler
virtual void HandlePortion( SwPortionHandler& rPH ) const;
+ bool GetJoinBorderWithPrev() const { return m_bJoinBorderWithPrev; }
+ bool GetJoinBorderWithNext() const { return m_bJoinBorderWithNext; }
+
+ void SetJoinBorderWithPrev( const bool bJoinPrev ) { m_bJoinBorderWithPrev = bJoinPrev; }
+ void SetJoinBorderWithNext( const bool bJoinNext ) { m_bJoinBorderWithNext = bJoinNext; }
+
OUTPUT_OPERATOR
DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
};
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index cb956b37a683..49337ba2dab7 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -604,7 +604,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf )
while ( nNextChg < nPorLen )
{
// check for attribute changes and if the portion has to split:
- SeekAndChgAttrIter( nNextChg, rInf.GetOut() );
+ Seek( nNextChg );
// the font is deleted in the destructor of the drop portion part
SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );