Kaydet (Commit) 574a1fb3 authored tarafından Andreas Martens's avatar Andreas Martens

Fix: Selektion and rotated parts of line

üst bb1d7ba8
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: trvlfrm.cxx,v $ * $RCSfile: trvlfrm.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: ama $ $Date: 2000-12-12 10:49:12 $ * last change: $Author: ama $ $Date: 2001-01-29 12:33:53 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -1912,11 +1912,13 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) ...@@ -1912,11 +1912,13 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode )
{ {
SwRect aTmp( aStRect.Pos(), SwRect aTmp( aStRect.Pos(),
Point( pSt2Pos->aPortion.Right(), aStRect.Bottom() ) ); Point( pSt2Pos->aPortion.Right(), aStRect.Bottom() ) );
if( pSt2Pos->aPortion.Top() == aStRect.Top() ) if( !pSt2Pos->nMultiType ||
pSt2Pos->aPortion.Top() == aTmp.Top() )
aTmp.Top( pSt2Pos->aLine.Top() ); aTmp.Top( pSt2Pos->aLine.Top() );
aTmp.Intersection( aStFrm ); aTmp.Intersection( aStFrm );
Sub( aRegion, aTmp ); Sub( aRegion, aTmp );
if( aStRect.Bottom() < pSt2Pos->aLine.Bottom() ) if( pSt2Pos->nMultiType &&
aStRect.Bottom() < pSt2Pos->aLine.Bottom() )
{ {
aTmp.Top( aTmp.Bottom() ); aTmp.Top( aTmp.Bottom() );
aTmp.Bottom( pSt2Pos->aLine.Bottom() ); aTmp.Bottom( pSt2Pos->aLine.Bottom() );
...@@ -1933,11 +1935,13 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) ...@@ -1933,11 +1935,13 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode )
SwRect aTmp( Point( pEnd2Pos->aPortion.Left(), aEndRect.Top() ), SwRect aTmp( Point( pEnd2Pos->aPortion.Left(), aEndRect.Top() ),
Point( aEndRect.Left() + aEndRect.Width(), Point( aEndRect.Left() + aEndRect.Width(),
aEndRect.Top() + aEndRect.Height() ) ); aEndRect.Top() + aEndRect.Height() ) );
if( pEnd2Pos->aPortion.Bottom() == aEndRect.Bottom() ) if( !pEnd2Pos->nMultiType ||
pEnd2Pos->aPortion.Bottom() == aEndRect.Bottom() )
aTmp.Bottom( pEnd2Pos->aLine.Bottom() ); aTmp.Bottom( pEnd2Pos->aLine.Bottom() );
aTmp.Intersection( aEndFrm ); aTmp.Intersection( aEndFrm );
Sub( aRegion, aTmp ); Sub( aRegion, aTmp );
if( aEndRect.Top() > pEnd2Pos->aLine.Top() ) if( pEnd2Pos->nMultiType &&
aEndRect.Top() > pEnd2Pos->aLine.Top() )
{ {
aTmp.Bottom( aTmp.Top() ); aTmp.Bottom( aTmp.Top() );
aTmp.Top( pEnd2Pos->aLine.Top() ); aTmp.Top( pEnd2Pos->aLine.Top() );
...@@ -1972,56 +1976,70 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) ...@@ -1972,56 +1976,70 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode )
else if( nTmp > aEndFrm.Right() ) else if( nTmp > aEndFrm.Right() )
aEndRect.Right( aEndFrm.Right() ); aEndRect.Right( aEndFrm.Right() );
//Fall 1: (Gleicher Frame und gleiche Zeile) if( pStartFrm == pEndFrm )
if( pStartFrm == pEndFrm && aStRect.Top() == aEndRect.Top() )
{ {
SwRect aTmp( aStRect.Pos(), sal_Bool bSameRotatedLine =
Point( aEndRect.Left(), aEndRect.Bottom() )); pSt2Pos && pEnd2Pos && 2 != pSt2Pos->nMultiType &&
// Bug 34888: falls Inhalt selektiert ist, der keinen Platz pSt2Pos->aPortion == pEnd2Pos->aPortion;
// einnimmt (z.B. PostIts,RefMarks, TOXMarks), //Fall 1: (Gleicher Frame und gleiche Zeile)
// dann mindestens die Breite des Crsr setzen. if( aStRect.Top() == aEndRect.Top() || bSameRotatedLine )
if( 1 == aTmp.Width() && pStartPos->nContent.GetIndex() !=
pEndPos->nContent.GetIndex() )
{ {
OutputDevice* pOut = pSh->GetOut(); Point aTmpSt( aStRect.Pos() );
long nCrsrWidth = pOut->GetSettings().GetStyleSettings(). Point aTmpEnd( aEndRect.Right(), aEndRect.Bottom() );
GetCursorSize(); if( bSameRotatedLine && aTmpSt.Y() > aTmpEnd.Y() )
aTmp.Width( pOut->PixelToLogic( Size( nCrsrWidth, 0 ) ).Width() ); {
} long nTmpY = aTmpEnd.Y();
aTmp.Intersection( aStFrm ); aTmpEnd.Y() = aTmpSt.Y();
Sub( aRegion, aTmp ); aTmpSt.Y() = nTmpY;
} }
//Fall 2: (Gleicher Frame ueber mehr als eine Zeile)
else if( pStartFrm == pEndFrm ) SwRect aTmp = SwRect( aTmpSt, aTmpEnd );
{ // Bug 34888: falls Inhalt selektiert ist, der keinen Platz
SwTwips lLeft, lRight; // einnimmt (z.B. PostIts,RefMarks, TOXMarks),
if( pSt2Pos && pEnd2Pos && pSt2Pos->aPortion == pEnd2Pos->aPortion ) // dann mindestens die Breite des Crsr setzen.
{ if( 1 == aTmp.Width() && pStartPos->nContent.GetIndex() !=
lLeft = pSt2Pos->aPortion.Left(); pEndPos->nContent.GetIndex() )
lRight = pSt2Pos->aPortion.Right(); {
OutputDevice* pOut = pSh->GetOut();
long nCrsrWidth = pOut->GetSettings().GetStyleSettings().
GetCursorSize();
aTmp.Width( pOut->PixelToLogic( Size( nCrsrWidth, 0 ) ).Width() );
}
aTmp.Intersection( aStFrm );
Sub( aRegion, aTmp );
} }
//Fall 2: (Gleicher Frame ueber mehr als eine Zeile)
else else
{ {
lLeft = pStartFrm->Frm().Left() + pStartFrm->Prt().Left(); SwTwips lLeft, lRight;
lRight = pStartFrm->Frm().Left() + pStartFrm->Prt().Right(); if( pSt2Pos && pEnd2Pos && pSt2Pos->aPortion == pEnd2Pos->aPortion )
{
lLeft = pSt2Pos->aPortion.Left();
lRight = pSt2Pos->aPortion.Right();
}
else
{
lLeft = pStartFrm->Frm().Left() + pStartFrm->Prt().Left();
lRight = pStartFrm->Frm().Left() + pStartFrm->Prt().Right();
}
if( lLeft < aStFrm.Left() )
lLeft = aStFrm.Left();
if( lRight > aStFrm.Right() )
lRight = aStFrm.Right();
//Erste Zeile
Sub( aRegion, SwRect( aStRect.Pos(),Point( lRight, aStRect.Bottom())));
//Wenn mindestens ein Twips zwischen Start- und Endzeile liegt,
//so wird halt alles dazwischenliegende mit aufgenommen.
if( (aStRect.Pos().Y()+aStRect.SSize().Height()) != aEndRect.Top() )
Sub( aRegion, SwRect( Point( lLeft,
(aStRect.Pos().Y()+aStRect.SSize().Height()) ),
Point( lRight, aEndRect.Top()-1 )));
//und die letzte Zeile
Sub( aRegion, SwRect( Point( lLeft, aEndRect.Top() ),
Point( aEndRect.Left(), aEndRect.Bottom() )));
} }
if( lLeft < aStFrm.Left() )
lLeft = aStFrm.Left();
if( lRight > aStFrm.Right() )
lRight = aStFrm.Right();
//Erste Zeile
Sub( aRegion, SwRect( aStRect.Pos(),Point( lRight, aStRect.Bottom())));
//Wenn mindestens ein Twips zwischen Start- und Endzeile liegt,
//so wird halt alles dazwischenliegende mit aufgenommen.
if( (aStRect.Pos().Y()+aStRect.SSize().Height()) != aEndRect.Top() )
Sub( aRegion, SwRect( Point( lLeft,
(aStRect.Pos().Y()+aStRect.SSize().Height()) ),
Point( lRight, aEndRect.Top()-1 )));
//und die letzte Zeile
Sub( aRegion, SwRect( Point( lLeft, aEndRect.Top() ),
Point( aEndRect.Left(), aEndRect.Bottom() )));
} }
//Fall 3: (Unterschiedliche Frm's, moeglicherweise auch welche //Fall 3: (Unterschiedliche Frm's, moeglicherweise auch welche
// dazwischen) // dazwischen)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: itrcrsr.cxx,v $ * $RCSfile: itrcrsr.cxx,v $
* *
* $Revision: 1.15 $ * $Revision: 1.16 $
* *
* last change: $Author: ama $ $Date: 2001-01-19 15:23:12 $ * last change: $Author: ama $ $Date: 2001-01-29 12:34:40 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -441,7 +441,8 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, ...@@ -441,7 +441,8 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
nPorHeight = pPor->Height(); nPorHeight = pPor->Height();
nPorAscent = pPor->GetAscent(); nPorAscent = pPor->GetAscent();
} }
while( pPor && aInf.GetIdx() < nOfst && !pPor->IsBreakPortion() ) while( pPor && !pPor->IsBreakPortion() && ( aInf.GetIdx() < nOfst ||
( bWidth && pPor->IsMultiPortion() ) ) )
{ {
if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() && if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() &&
(!pPor->InFldGrp() || pPor->GetAscent() ) ) (!pPor->InFldGrp() || pPor->GetAscent() ) )
...@@ -487,11 +488,21 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, ...@@ -487,11 +488,21 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
if( pPor->IsMultiPortion() ) if( pPor->IsMultiPortion() )
{ {
nY += nTmpAscent - nPorAscent; nY += nTmpAscent - nPorAscent;
if( ((SwMultiPortion*)pPor)->IsDouble() && if( ( ((SwMultiPortion*)pPor)->IsDouble() ||
pCMS && pCMS->b2Lines ) ((SwMultiPortion*)pPor)->HasRotation() )
&& pCMS && pCMS->b2Lines )
{ {
pCMS->p2Lines = new Sw2LinesPos(); pCMS->p2Lines = new Sw2LinesPos();
pCMS->p2Lines->aLine = SwRect(aCharPos, aCharSize); pCMS->p2Lines->aLine = SwRect(aCharPos, aCharSize);
if( ((SwMultiPortion*)pPor)->HasRotation() )
{
if( ((SwMultiPortion*)pPor)->IsRevers() )
pCMS->p2Lines->nMultiType = 1;
else
pCMS->p2Lines->nMultiType = 0;
}
else
pCMS->p2Lines->nMultiType = 2;
SwTwips nTmpWidth = pPor->Width(); SwTwips nTmpWidth = pPor->Width();
if( nSpaceAdd ) if( nSpaceAdd )
nTmpWidth += pPor->CalcSpacing(nSpaceAdd, aInf); nTmpWidth += pPor->CalcSpacing(nSpaceAdd, aInf);
......
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