55 #include <osl/diagnose.h>
58 bool lcl_GetModelPositionForViewPoint_Objects(
const SwPageFrame* pPageFrame,
bool bSearchBackground,
62 Point aPoint( rPoint );
72 bool bInBackground = ( rSurround.
GetSurround() == css::text::WrapTextMode_THROUGH ) && !rOpaque.GetValue();
74 bool bBackgroundMatches = bInBackground == bSearchBackground;
77 if ( pFly && bBackgroundMatches &&
93 double lcl_getDistance(
const SwRect& rRect,
const Point& rPoint )
112 class SwCursorOszControl
124 if (pFly != m_pStack1 && pFly != m_pStack2)
126 m_pStack1 = m_pStack2;
136 m_pEntry = m_pStack1 = pFly;
141 if (pFly == m_pEntry)
142 m_pEntry = m_pStack1 = m_pStack2 =
nullptr;
148 static SwCursorOszControl
g_OszCtrl = {
nullptr,
nullptr,
nullptr };
157 while ( !bRet && pFrame )
159 pFrame->
Calc(pRenderContext);
163 const SwRect aPaintRect( bContentCheck ?
167 if ( aPaintRect.Contains( rPoint ) &&
183 Point aPoint( rPoint );
200 bRet = lcl_GetModelPositionForViewPoint_Objects(
this,
false, pPos, rPoint, pCMS );
224 bool bTextRet =
false;
226 OSL_ENSURE( pCnt,
"Cursor is gone to a Black hole" );
249 bool bConsiderBackground =
true;
251 if (pContentNode && pContentNode->
IsTextNode())
259 bConsiderBackground =
false;
263 bool bBackRet =
false;
267 bBackRet = lcl_GetModelPositionForViewPoint_Objects(
this,
true, &aBackPos, rPoint, pCMS );
270 if (bConsiderBackground && bTestBackground && bBackRet)
284 double nTextDistance = 0;
285 bool bValidTextDistance =
false;
310 pTextFrame->
GetCharRect(nextTextRect, nextTextPos);
312 if (aRectFnSet.
GetTop(aTextRect) ==
313 aRectFnSet.
GetTop(nextTextRect))
316 if (aRectFnSet.
GetLeft(aTextRect) <
317 aRectFnSet.
GetLeft(nextTextRect))
320 aRectFnSet.
GetLeft(nextTextRect));
325 aRectFnSet.
GetLeft(nextTextRect));
330 nTextDistance = lcl_getDistance(aTextRect, rPoint);
331 bValidTextDistance =
true;
335 double nBackDistance = 0;
336 bool bValidBackDistance =
false;
338 if ( pBackNd && bConsiderBackground)
347 nBackDistance = lcl_getDistance( rBackRect, rPoint );
348 bValidBackDistance =
true;
352 if ( bValidTextDistance && bValidBackDistance &&
basegfx::fTools::more( nTextDistance, nBackDistance ) )
433 Point aOldPoint = rPoint;
445 while ( pPage && pPage->
GetNext() )
452 pPage->SwPageFrame::GetModelPositionForViewPoint( pPos, rPoint, pCMS, bTestBackground );
463 return aOldPoint == rPoint;
481 GetFormat()->GetProtect().IsContentProtected() )
500 Calc(pRenderContext);
504 while ( pFrame && !bRet )
506 pFrame->
Calc(pRenderContext);
517 const bool bFill = pCMS && pCMS->
m_pFill;
518 Point aPoint( rPoint );
544 g_OszCtrl.Entry(
this );
549 Calc(pRenderContext);
564 while ( aIter() && !bRet )
571 if (g_OszCtrl.ChkOsz(pFly))
583 while ( bInside && !bRet )
586 while ( pFrame && !bRet )
588 pFrame->
Calc(pRenderContext);
599 const bool bFill = pCMS && pCMS->
m_pFill;
600 Point aPoint( rPoint );
612 g_OszCtrl.Exit(
this );
664 bool bMissFollowFlowLine )
668 bool bProtect =
true;
669 while ( pCnt && bProtect )
681 pCnt = (*fnNxtPrv)( pCnt );
684 else if ( !bInReadOnly )
686 pCnt = (*fnNxtPrv)( pCnt );
695 "lcl_UpDown doesn't work for others." );
702 bool bTableSel =
false;
715 static_cast<const SwCellFrame*
>(pCell)->GetFollowCell() :
716 static_cast<const SwCellFrame*
>(pCell)->GetPreviousCell();
719 while ( pTmpCell &&
nullptr != ( pTmpStart = pTmpCell->
ContainsContent() ) )
723 static_cast<const SwCellFrame*
>(pCell)->GetFollowCell() :
724 static_cast<const SwCellFrame*
>(pCell)->GetPreviousCell();
731 pNxt = (*fnNxtPrv)( pNxt );
735 pCnt = (*fnNxtPrv)( pCnt ? pCnt : pStart );
740 const bool bTab = pStTab || (pCnt && pCnt->IsInTab());
743 const SwFrame* pVertRefFrame = pStart;
744 if ( bTableSel && pStTab )
745 pVertRefFrame = pStTab;
754 Point aCenter = aRect.Center();
755 nX = aRectFnSet.
IsVert() ? aCenter.Y() : aCenter.X();
768 OSL_ENSURE( pCell,
"could not find the cell" );
775 if ( pStTab != pTable )
790 if (bRTL != (aRectFnSet.
XDiff(nPrtLeft, nX) > 0))
797 if (bRTL != (aRectFnSet.
XDiff(nX, nPrtRight) > 0))
808 while ( pCnt && (!pCnt->IsInDocBody() ||
809 (pCnt->IsTextFrame() &&
static_cast<const SwTextFrame*
>(pCnt)->IsHiddenNow())))
811 pCnt = (*fnNxtPrv)( pCnt );
820 while ( pCnt && (!pCnt->IsInFootnote() ||
821 (pCnt->IsTextFrame() &&
static_cast<const SwTextFrame*
>(pCnt)->IsHiddenNow())))
823 pCnt = (*fnNxtPrv)( pCnt );
831 if ( pCnt && pCnt->IsTextFrame() &&
static_cast<const SwTextFrame*
>(pCnt)->IsHiddenNow() )
833 pCnt = (*fnNxtPrv)( pCnt );
846 while ( pCntUp && !bSame )
855 else if (pCnt->IsTextFrame() &&
static_cast<const SwTextFrame*
>(pCnt)->IsHiddenNow())
857 pCnt = (*fnNxtPrv)( pCnt );
873 if ( pTab != pTable )
893 if ( aRectFnSet.
IsVert() )
896 nTmpTop = aRectFnSet.
XInc(nTmpTop, -1);
898 aInsideCell =
Point( nTmpTop, nX );
901 aInsideCell =
Point( nX, nTmpTop );
905 if ( aRectFnSet.
IsVert() )
908 nTmpTop = aRectFnSet.
XInc(nTmpTop, -1);
910 aInsideCnt =
Point( nTmpTop, nX );
913 aInsideCnt =
Point( nX, nTmpTop );
919 if ( !pCnt->getFrameArea().Contains( aInsideCnt ) )
923 while ( pCell->
IsAnLower(pCnt->GetNextContentFrame()) )
927 else if ( pCnt->getFrameArea().Contains( aInsideCnt ) )
933 pCnt = (*fnNxtPrv)( pCnt );
939 (pCnt && pCnt->IsTextFrame() &&
static_cast<const SwTextFrame*
>(pCnt)->IsHiddenNow()));
945 if (pCnt->IsTextFrame())
947 SwTextFrame const*
const pFrame(static_cast<SwTextFrame const*>(pCnt));
950 ? pFrame->
GetText().getLength()
955 assert(pCnt->IsNoTextFrame());
983 OSL_ENSURE( pActualCursor,
"got no page cursor" );
1006 pPage = static_cast<SwPageFrame*>(pPage->
GetNext());
1011 while ( pContent && pPage->
IsAnLower( pContent ) )
1013 pContent->
Calc(pRenderContext);
1018 pPage = static_cast<SwPageFrame*>(pPage->
GetNext());
1036 SwTextFrame const*
const pFrame(static_cast<const SwTextFrame*>(pContent));
1037 *pToSet->
GetPoint() = pFrame->MapViewToModelPos(pFrame->GetOffset());
1065 const_cast<SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(pFrame->
GetNext())) :
nullptr;
1069 static_cast<SwLayoutFrame*>(pNext->
GetNext()) :
nullptr;
1082 const_cast<SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(pFrame->
GetPrev())) :
nullptr;
1086 static_cast<SwLayoutFrame*>(pPrev->
GetPrev()) :
nullptr;
1100 if ( !pLayoutFrame || (
nullptr == (pLayoutFrame = (*fnWhichPage)(pLayoutFrame))) )
1104 pCnt = (*fnPosPage)(pLayoutFrame);
1105 if(
nullptr == pCnt )
1133 SwTextFrame const*
const pFrame(static_cast<const SwTextFrame*>(pCnt));
1135 ? pFrame->GetOffset()
1136 : (pFrame->GetFollow())
1139 *pPam->
GetPoint() = pFrame->MapViewToModelPos(nIdx);
1144 static sal_uInt64
CalcDiff(
const Point &rPt1,
const Point &rPt2)
1148 sal_uInt64 dX = std::max( rPt1.X(), rPt2.X() ) -
1150 dY = std::max( rPt1.Y(), rPt2.Y() ) -
1152 return (dX * dX) + (dY * dY);
1187 const bool bDontLeave,
1188 const bool bBodyOnly,
1190 const bool bDefaultExpand )
const
1194 static_cast<const SwLayoutFrame*>(
GetPrev()) :
this;
1197 if ( !pContent && (
GetPrev() && !bDontLeave) )
1200 if ( bBodyOnly && pContent && !pContent->
IsInDocBody() )
1206 sal_uInt16 nMaxPage =
GetPhyPageNum() + (bDefaultExpand ? 1 : 0);
1207 Point aPoint = rPoint;
1213 ((!bDontLeave ||
IsAnLower( pContent )) &&
1224 if ( pComp != pContent )
1230 if ( aContentFrame.Contains( rPoint ) )
1238 Point aContentPoint( rPoint );
1241 if ( aContentFrame.Top() > aContentPoint.Y() )
1242 aContentPoint.setY( aContentFrame.Top() );
1243 else if ( aContentFrame.Bottom() < aContentPoint.Y() )
1244 aContentPoint.setY( aContentFrame.Bottom() );
1247 if ( aContentFrame.Left() > aContentPoint.X() )
1248 aContentPoint.setX( aContentFrame.Left() );
1249 else if ( aContentFrame.Right() < aContentPoint.X() )
1250 aContentPoint.setX( aContentFrame.Right() );
1255 if( !pInside || ( pInside->
IsAnLower( pContent ) &&
1258 const sal_uInt64 nDiff =
::CalcDiff(aContentPoint, rPoint);
1259 bool bBetter = nDiff < nDistance;
1268 aPoint = aContentPoint;
1287 while ( !pContent && pStart->
GetPrev() )
1325 OSL_ENSURE( pActual,
"no Content found." );
1326 OSL_ENSURE( !bBodyOnly || pActual->
IsInDocBody(),
"Content not in Body." );
1347 aRectFnSet.
IsVert() ? rPoint.X() : rPoint.Y() ) > 0 )
1355 else if ( !pActual->
GetNext() &&
1357 aRectFnSet.
IsVert() ? rPoint.X() : rPoint.Y() ) < 0 )
1369 if ( aPoint.Y() < aRect.Top() )
1370 aPoint.setY( aRect.Top() );
1371 else if ( aPoint.Y() > aRect.Bottom() )
1372 aPoint.setY( aRect.Bottom() );
1373 if ( aPoint.X() < aRect.Left() )
1374 aPoint.setX( aRect.Left() );
1375 else if ( aPoint.X() > aRect.Right() )
1376 aPoint.setX( aRect.Right() );
1405 if ( aContentFrame.Contains( rPt ) )
1413 Point aPoint( rPt );
1416 if ( aContentFrame.Top() > rPt.Y() )
1417 aPoint.setY( aContentFrame.Top() );
1418 else if ( aContentFrame.Bottom() < rPt.Y() )
1419 aPoint.setY( aContentFrame.Bottom() );
1422 if ( aContentFrame.Left() > rPt.X() )
1423 aPoint.setX( aContentFrame.Left() );
1424 else if ( aContentFrame.Right() < rPt.X() )
1425 aPoint.setX( aContentFrame.Right() );
1427 const sal_uInt64 nDiff =
::CalcDiff( aPoint, rPt );
1428 if ( nDiff < nDist )
1445 if ( aAct.Y() < aRect.Top() )
1446 aAct.setY( aRect.Top() );
1447 else if ( aAct.Y() > aRect.Bottom() )
1448 aAct.setY( aRect.Bottom() );
1449 if ( aAct.X() < aRect.Left() )
1450 aAct.setX( aRect.Left() );
1451 else if ( aAct.X() > aRect.Right() )
1452 aAct.setX( aRect.Right() );
1488 pPage = static_cast<const SwLayoutFrame*>(pPage->
GetNext());
1495 return Point( 0, 0 );
1497 pCnt->
Calc(pRenderContext);
1514 pCnt->
Calc(pRenderContext);
1543 aRet =
Point( aContentFrame.Right(), aContentFrame.Bottom() );
1550 pNxt->
Calc(pRenderContext);
1558 aRet =
Point( aContentFrame.Right(), aContentFrame.Bottom() );
1595 while ( pPageFrame && pPageFrame->
GetPhyPageNum() < _nPageNum )
1600 if ( pPageFrame && pPageFrame->
GetPhyPageNum() == _nPageNum )
1620 pPage = static_cast<const SwPageFrame*>(pPage->
GetNext());
1634 if (isFormProtected)
1646 if (static_cast<SwTextFrame const*>(pFrame)->GetTextNodeFirst()->IsInProtectSect())
1654 if (static_cast<const SwNoTextFrame*>(pFrame)->GetNode() &&
1662 if ( static_cast<const SwLayoutFrame*>(pFrame)->GetFormat() &&
1664 GetProtect().IsContentProtected() )
1673 if ( static_cast<const SwFlyFrame*>(pFrame)->GetPrevLink() )
1682 pFrame =
static_cast<const SwFlyFrame*
>(pFrame)->GetAnchorFrame();
1685 pFrame = static_cast<const SwFootnoteFrame*>(pFrame)->GetRef();
1717 if ( !pPage || !pPage->
GetUpper() )
1722 ::std::optional<sal_uInt16> oPgNum;
1739 pPrv = static_cast<SwPageFrame*>(pPrv->
GetPrev());
1748 OSL_ENSURE( pDesc,
"No pagedescriptor" );
1756 isRightPage = !isRightPage;
1761 isRightPage =
false;
1809 if ( !pPage || !pPage->
GetUpper() )
1813 if ( !static_cast<const SwRootFrame*>(pPage->
GetUpper())->IsVirtPageNum() )
1821 const SwFrame *pFrame =
nullptr;
1864 "Tabselection not on Cnt." );
1887 std::pair<Point, bool> tmp(aPtPt,
false);
1888 const SwFrame *
const pTmpStartFrame = pTmpStartNode ? pTmpStartNode->
getLayoutFrame(
this,
nullptr, &tmp) :
nullptr;
1890 const SwFrame *
const pTmpEndFrame = pTmpEndNode ? pTmpEndNode->
getLayoutFrame(
this,
nullptr, &tmp) :
nullptr;
1895 OSL_ENSURE( pStart && pEnd,
"MakeTableCursors: Good to have the code robust here!" );
1924 while ( pCell && pRow->
IsAnLower( pCell ) )
1926 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without cell" );
1928 (bReadOnlyAvailable ||
1932 static_cast<const SwCellFrame*
>(pCell)->GetTabBox());
1947 }
while ( pCell && pLastCell->
IsAnLower( pCell ) );
1949 if( pCell && pCell->
IsInTab() )
1954 OSL_ENSURE( pCell,
"Where's my cell?" );
2011 *pEndPos = rCursor.
End();
2015 bool bIgnoreVisArea =
true;
2025 ( pStartPos->
nNode != pEndPos->nNode &&
2026 ( !pEndPos->nNode.GetNode().IsContentNode() ||
2027 !pEndPos->nNode.GetNode().GetContentNode()->getLayoutFrame(
this) ) ) )
2036 std::pair<Point, bool> tmp(rCursor.
GetSttPos(),
true);
2044 assert(pStartFrame && pEndFrame &&
"No ContentFrames found.");
2050 if ( pStartFrame->IsInFly() )
2053 OSL_ENSURE( pObj,
"No Start Object." );
2054 if (pObj) aSortObjs.
Insert( *const_cast<SwAnchoredObject*>(pObj) );
2056 OSL_ENSURE( pObj2,
"SwRootFrame::CalcFrameRects(..) - FlyFrame missing - looks like an invalid selection" );
2057 if ( pObj2 !=
nullptr && pObj2 != pObj )
2059 aSortObjs.
Insert( *const_cast<SwAnchoredObject*>(pObj2) );
2068 while( pSttLFrame &&
2069 ! (cHdFtTableHd & pSttLFrame->
GetType() ))
2070 pSttLFrame = pSttLFrame->
GetUpper();
2074 while( pEndLFrame &&
2075 ! (cHdFtTableHd & pEndLFrame->
GetType() ))
2076 pEndLFrame = pEndLFrame->
GetUpper();
2081 "Selection over different content" );
2082 switch( pSttLFrame->
GetType() )
2090 if( pStartPos == rCursor.
GetPoint() )
2091 pEndFrame = pStartFrame;
2093 pStartFrame = pEndFrame;
2101 static_cast<const SwTabFrame*
>(pEndLFrame)->GetFollow() ) &&
2108 if( pStartPos == rCursor.
GetPoint() )
2109 pEndFrame = pStartFrame;
2111 pStartFrame = pEndFrame;
2125 SwRect aStRect, aEndRect;
2126 pStartFrame->GetCharRect( aStRect, *pStartPos, &aTmpState );
2127 std::unique_ptr<Sw2LinesPos> pSt2Pos = std::move(aTmpState.
m_p2Lines);
2130 pEndFrame->
GetCharRect( aEndRect, *pEndPos, &aTmpState );
2131 std::unique_ptr<Sw2LinesPos> pEnd2Pos = std::move(aTmpState.
m_p2Lines);
2133 SwRect aStFrame ( pStartFrame->UnionFrame(
true ) );
2135 SwRect aEndFrame( pStartFrame == pEndFrame ? aStFrame : pEndFrame->
UnionFrame(
true ) );
2136 if( pStartFrame != pEndFrame )
2141 const bool bR2L = pStartFrame->IsRightToLeft();
2143 const bool bB2T = pStartFrame->IsVertLRBT();
2148 if( pSt2Pos != pEnd2Pos && ( !pSt2Pos || !pEnd2Pos ||
2149 pSt2Pos->aPortion != pEnd2Pos->aPortion ) )
2165 aRectFnSet.
GetWidth(pSt2Pos->aPortion2) )
2169 nRightAbs -= aRectFnSet.
GetLeft(pSt2Pos->aPortion2);
2172 aRectFnSet.
SetRight( aTmp, nRightAbs );
2174 if ( ! pEnd2Pos || pEnd2Pos->aPortion != pSt2Pos->aPortion )
2176 SwRect aTmp2( pSt2Pos->aPortion );
2177 aRectFnSet.
SetRight( aTmp2, nLeftAbs );
2179 Sub( aRegion, aTmp2 );
2185 aRectFnSet.
SetLeft( aTmp, aRectFnSet.
GetLeft(pSt2Pos->aPortion) );
2191 aRectFnSet.
GetTop(pSt2Pos->aPortion) ==
2192 aRectFnSet.
GetTop(aTmp) )
2194 aRectFnSet.
SetTop( aTmp, aRectFnSet.
GetTop(pSt2Pos->aLine) );
2198 Sub( aRegion, aTmp );
2211 aRectFnSet.
SetLeft( aTmp, aRectFnSet.
GetLeft(pSt2Pos->aPortion) );
2214 Sub( aRegion, aTmp );
2217 aStRect = pSt2Pos->aLine;
2218 aRectFnSet.
SetLeft( aStRect, bR2L ?
2219 aRectFnSet.
GetLeft(pSt2Pos->aPortion) :
2220 aRectFnSet.
GetRight(pSt2Pos->aPortion) );
2235 fnRectX.
GetWidth(pEnd2Pos->aPortion2) )
2239 nRightAbs = nRightAbs - fnRectX.
GetLeft(pEnd2Pos->aPortion2);
2242 fnRectX.
SetLeft( aTmp, nLeftAbs );
2244 if ( ! pSt2Pos || pSt2Pos->aPortion != pEnd2Pos->aPortion )
2246 SwRect aTmp2( pEnd2Pos->aPortion );
2247 fnRectX.
SetLeft( aTmp2, nRightAbs );
2249 Sub( aRegion, aTmp2 );
2261 fnRectX.
GetBottom(pEnd2Pos->aPortion) ==
2268 Sub( aRegion, aTmp );
2274 if( fnRectX.
GetTop(aEndRect) != nTmp )
2277 fnRectX.
SetTop( aTmp, nTmp );
2278 if( fnRectX.
GetTop(aEndRect) !=
2279 fnRectX.
GetTop(pEnd2Pos->aPortion) )
2287 Sub( aRegion, aTmp );
2291 aEndRect = pEnd2Pos->aLine;
2292 fnRectX.
SetLeft( aEndRect, bEndR2L ?
2293 fnRectX.
GetRight(pEnd2Pos->aPortion) :
2294 fnRectX.
GetLeft(pEnd2Pos->aPortion) );
2298 else if( pSt2Pos && pEnd2Pos &&
2301 pSt2Pos->aPortion == pEnd2Pos->aPortion &&
2302 pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 )
2308 if ( aRectFnSet.
GetWidth(pSt2Pos->aPortion2) )
2312 nRightAbs -= aRectFnSet.
GetLeft(pSt2Pos->aPortion2);
2315 aRectFnSet.
SetRight( aTmp, nRightAbs );
2317 Sub( aRegion, aTmp );
2319 aStRect = pSt2Pos->aLine;
2320 aRectFnSet.
SetLeft( aStRect, bR2L ? nRightAbs : nLeftAbs );
2325 if ( fnRectX.
GetWidth(pEnd2Pos->aPortion2) )
2329 nRightAbs -= fnRectX.
GetLeft(pEnd2Pos->aPortion2);
2332 fnRectX.
SetLeft( aTmp, nLeftAbs );
2334 Sub( aRegion, aTmp );
2336 aEndRect = pEnd2Pos->aLine;
2337 fnRectX.
SetLeft( aEndRect, bEndR2L ? nLeftAbs : nRightAbs );
2344 if( aStRect.
Left() < aStFrame.Left() )
2345 aStRect.
Left( aStFrame.Left() );
2346 else if( aStRect.
Left() > aStFrame.Right() )
2347 aStRect.
Left( aStFrame.Right() );
2349 if( nTmp < aStFrame.Left() )
2350 aStRect.
Right( aStFrame.Left() );
2351 else if( nTmp > aStFrame.Right() )
2352 aStRect.
Right( aStFrame.Right() );
2353 if( aEndRect.
Left() < aEndFrame.Left() )
2354 aEndRect.
Left( aEndFrame.Left() );
2355 else if( aEndRect.
Left() > aEndFrame.Right() )
2356 aEndRect.
Left( aEndFrame.Right() );
2357 nTmp = aEndRect.
Right();
2358 if( nTmp < aEndFrame.Left() )
2359 aEndRect.
Right( aEndFrame.Left() );
2360 else if( nTmp > aEndFrame.Right() )
2361 aEndRect.
Right( aEndFrame.Right() );
2363 if( pStartFrame == pEndFrame )
2365 bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos &&
2369 pSt2Pos->aPortion == pEnd2Pos->aPortion;
2371 if( bSameRotatedOrBidi ||
2372 aRectFnSet.
GetTop(aStRect) == aRectFnSet.
GetTop(aEndRect) )
2376 if (bSameRotatedOrBidi || bR2L || bB2T)
2378 if( aTmpSt.Y() > aTmpEnd.Y() )
2381 aTmpEnd.setY( aTmpSt.Y() );
2382 aTmpSt.setY( nTmpY );
2384 if( aTmpSt.X() > aTmpEnd.X() )
2387 aTmpEnd.setX( aTmpSt.X() );
2388 aTmpSt.setX( nTmpX );
2392 SwRect aTmp( aTmpSt, aTmpEnd );
2396 if( 1 == aRectFnSet.
GetWidth(aTmp) &&
2398 pEndPos->nContent.GetIndex() )
2404 Size( nCursorWidth, 0 ) ).Width() );
2407 Sub( aRegion, aTmp );
2413 if( pSt2Pos && pEnd2Pos && pSt2Pos->aPortion == pEnd2Pos->aPortion )
2415 lLeft = aRectFnSet.
GetLeft(pSt2Pos->aPortion);
2416 lRight = aRectFnSet.
GetRight(pSt2Pos->aPortion);
2420 lLeft = aRectFnSet.
GetLeft(pStartFrame->getFrameArea()) +
2421 aRectFnSet.
GetLeft(pStartFrame->getFramePrintArea());
2422 lRight = aRectFnSet.
GetRight(aEndFrame);
2424 if( lLeft < aRectFnSet.
GetLeft(aStFrame) )
2425 lLeft = aRectFnSet.
GetLeft(aStFrame);
2426 if( lRight > aRectFnSet.
GetRight(aStFrame) )
2427 lRight = aRectFnSet.
GetRight(aStFrame);
2428 SwRect aSubRect( aStRect );
2431 aRectFnSet.
SetLeft( aSubRect, lLeft );
2433 aRectFnSet.
SetRight( aSubRect, lRight );
2434 Sub( aRegion, aSubRect );
2440 if( aTmpBottom != aTmpTop )
2442 aRectFnSet.
SetLeft( aSubRect, lLeft );
2443 aRectFnSet.
SetRight( aSubRect, lRight );
2444 aRectFnSet.
SetTop( aSubRect, aTmpBottom );
2445 aRectFnSet.
SetBottom( aSubRect, aTmpTop );
2446 Sub( aRegion, aSubRect );
2449 aSubRect = aEndRect;
2451 aRectFnSet.
SetRight( aSubRect, lRight );
2453 aRectFnSet.
SetLeft( aSubRect, lLeft );
2454 Sub( aRegion, aSubRect );
2461 SwRect aSubRect( aStRect );
2466 Sub( aRegion, aSubRect );
2468 if( aRectFnSet.
GetBottom(aStFrame) != nTmpTwips )
2470 aSubRect = aStFrame;
2471 aRectFnSet.
SetTop( aSubRect, nTmpTwips );
2472 Sub( aRegion, aSubRect );
2476 bool const bBody = pStartFrame->IsInDocBody();
2478 static_cast<const SwCellFrame*
>(pStartFrame->GetUpper())->GetTabBox() :
nullptr;
2485 OSL_ENSURE( pContent,
2486 "<SwRootFrame::CalcFrameRects(..)> - no content frame. This is a serious defect" );
2487 while ( pContent && pContent != pEndFrame )
2494 aSortObjs.
Insert( *const_cast<SwAnchoredObject*>(pObj) );
2504 pTmpCellBox =
nullptr;
2506 ( !pCellBox || pCellBox == pTmpCellBox ) )
2510 if( aCRect.Overlaps( aRegion.GetOrigin() ))
2513 aTmp.
Union( aCRect );
2515 aCRect.Height() * aCRect.Width()) ==
2518 aPrvRect.
Union( aCRect );
2523 Sub( aRegion, aPrvRect );
2529 OSL_ENSURE( pContent,
2530 "<SwRootFrame::CalcFrameRects(..)> - no content frame. This is a serious defect!" );
2533 Sub( aRegion, aPrvRect );
2536 aRectFnSet.
Refresh(pEndFrame);
2537 nTmpTwips = aRectFnSet.
GetTop(aEndRect);
2538 if( aRectFnSet.
GetTop(aEndFrame) != nTmpTwips )
2540 aSubRect = aEndFrame;
2541 aRectFnSet.
SetBottom( aSubRect, nTmpTwips );
2542 Sub( aRegion, aSubRect );
2544 aSubRect = aEndRect;
2549 Sub( aRegion, aSubRect );
2578 const SwPosition* anchoredAt = rAnchor.GetContentAnchor();
2579 bool inSelection = (
2580 anchoredAt !=
nullptr
2581 && ( (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
2583 || (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
2587 else if ( !pFly->
IsAnLower( pStartFrame ) &&
2588 (rSur.
GetSurround() != css::text::WrapTextMode_THROUGH &&
2591 if ( aSortObjs.
Contains( *pAnchoredObj ) )
2596 for (
size_t k = 0; bSub && k < aSortObjs.
size(); ++k )
2598 assert( dynamic_cast< const SwFlyFrame *>( aSortObjs[k] ) &&
2599 "<SwRootFrame::CalcFrameRects(..)> - object in <aSortObjs> of unexpected type" );
2603 if ( nPos < pTmp->GetVirtDrawObj()->GetOrdNumDirect() )
2611 }
while ( bSub && pTmp );
2618 if ( pPage == pEndPage )
2626 if ( pStartFrame->IsTextFrame() )
2628 if ( static_cast<const SwTextFrame*>(pStartFrame)->GetDropRect( aDropRect ) )
2629 Sub( aRegion, aDropRect );
2631 if ( pEndFrame != pStartFrame && pEndFrame->
IsTextFrame() )
2633 if ( static_cast<const SwTextFrame*>(pEndFrame)->GetDropRect( aDropRect ) )
2634 Sub( aRegion, aDropRect );
2637 rCursor.assign( aRegion.begin(), aRegion.end() );
bool IsAnLower(const SwFrame *) const
vcl::RenderContext * GetOut() const
void SetTop(SwRect &rRect, tools::Long nNew) const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
const sw::BroadcastingModify * GetDefinedIn() const
Query / set where attribute is anchored.
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Base class of the Writer layout elements.
Base class that provides the general functionalities for frames that are allowed at page breaks (flow...
Represents the visualization of a paragraph.
virtual sal_Int32 Len() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the page containing the searched point.
const ::std::optional< sal_uInt16 > & GetNumOffset() const
tools::Long GetRight(const SwRect &rRect) const
SwNode & GetNode(bool bPoint=true) const
void Right(const tools::Long nRight)
virtual bool RightMargin(SwPaM *, bool bAPI=false) const override
virtual const SwFlyFrameFormat * GetFormat() const override
void SetCallbackActionEnabled(bool b)
void GetContentPosition(const Point &rPt, SwPosition &rPos) const
Same as SwLayoutFrame::GetContentPos().
Marks a position in the document model.
const SwRect & GetOrigin() const
SwContentFrame * GetNextContentFrame() const
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
tools::Long GetPrtRight(const SwFrame &rFrame) const
static bool lcl_IsInRepeatedHeadline(const SwFrame *pFrame, const SwTabFrame **ppTFrame=nullptr)
Frame in repeated headline?
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
SwRect & Union(const SwRect &rRect)
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
tools::Long BottomDist(const SwRect &rRect, tools::Long nPos) const
SwPageDesc * GetPageDesc()
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
sal_uInt16 GetCurrPage(const SwPaM *) const
Query/set the current Page and the collective Page count We'll format as much as necessary.
const SwTable * GetTable() const
void Left(const tools::Long nLeft)
void Refresh(const SwFrame *pFrame)
bool IsInFootnote() const
SwFrameType GetType() const
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
SwLayoutFrame * GetPrevFrame(const SwLayoutFrame *pFrame)
const SwRect & getFramePrintArea() const
const StyleSettings & GetStyleSettings() const
Base class of all fields.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
tools::Long XInc(tools::Long n1, tools::Long n2) const
sal_uInt8 m_nCursorBidiLevel
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
helper class to disable creation of an action by a callback event in particular, change event from a ...
bool m_bSetInReadOnly
ReadOnly areas may be entered.
const Point & GetSttPos() const
bool m_bExactOnly
let GetModelPositionForViewPoint look for exact matches only, i.e.
bool IsSelectFrameAnchoredAtPara(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
is a fly anchored at paragraph at rAnchorPos selected?
This class is used as parameter for creation of a block cursor selection.
sal_uInt16 GetRowsToRepeat() const
void Pos(const Point &rNew)
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool IsFootnotePage() const
Foot note interface.
Of course Writer needs its own rectangles.
SwContentFrame * FindFirstBodyContent()
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
virtual const SwFormatPageDesc & GetPageDescItem() const
tools::Long GetWidth(const SwRect &rRect) const
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
static SwFlowFrame * CastFlowFrame(SwFrame *pFrame)
SwLayoutFrame * GetThisFrame(const SwLayoutFrame *pFrame)
The root element of a Writer document layout.
virtual bool GetInfo(SfxPoolItem &) const override
bool IsFootnoteFrame() const
bool isFrameAreaDefinitionValid() const
static void Sub(SwRegionRects &rRegion, const SwRect &rRect)
SwLayoutFrame * GetNextFrame(const SwLayoutFrame *pFrame)
bool m_bFillRet
only used temporary in FillMode
static SwCursorOszControl g_OszCtrl
not in repeated headlines
void PrepareMake(vcl::RenderContext *pRenderContext)
Prepares the Frame for "formatting" (MakeAll()).
sal_uInt16 GetPhyPageNum() const
SwContentNode * GetContentNode(bool bPoint=true) const
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
tools::Long GetTop(const SwRect &rRect) const
SwRect GetPaintArea() const
|* The paintarea is the area, in which the content of a frame is allowed |* to be displayed...
bool WannaRightPage() const
Decides if the page want to be a right page or not.
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
void SetBottom(SwRect &rRect, tools::Long nNew) const
wrapper class for the positioning of Writer fly frames and drawing objects
const SwPageFrame * GetPage() const
const SwRect & getFrameArea() const
SwFlyFrame * GetPrevLink() const
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
SwRect & Intersection(const SwRect &rRect)
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
void CalcFrameRects(SwShellCursor &)
virtual bool UnitUp(SwPaM *, const SwTwips nOffset, bool bSetInReadOnly) const
const SwContentFrame *(* GetNxtPrvCnt)(const SwContentFrame *)
tools::Long GetPrtLeft(const SwFrame &rFrame) const
void Width(tools::Long nNew)
static const SwContentFrame * lcl_GetNxtCnt(const SwContentFrame *pCnt)
bool IsPageBodyFrame() const
const SwFormatField & GetFormatField() const
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const
SwContentFrame * GetPrevContentFrame() const
SwFlyFrame * FindFlyFrame()
tools::Long GetLeft(const SwRect &rRect) const
virtual bool UnitDown(SwPaM *, const SwTwips nOffset, bool bSetInReadOnly) const
virtual bool LeftMargin(SwPaM *) const override
Layout dependent cursor travelling.
SwPageFrame * GetPageByPageNum(sal_uInt16 _nPageNum) const
Get page frame by physical page number looping through the lowers, which are page frame...
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
sal_uInt16 GetVirtPageNum() const
tools::Long XDiff(tools::Long n1, tools::Long n2) const
bool IsContentNode() const
PaM is Point and Mark: a selection of the document model.
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
bool IsContentFrame() const
const SwSortedObjs * GetSortedObjs() const
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
tools::Long GetPrtBottom(const SwFrame &rFrame) const
const SwRect & VisArea() const
SwContentFrame * GetLastSub(const SwLayoutFrame *pLayout)
const SwStartNode * StartOfSectionNode() const
const SwPosition * GetPoint() const
bool Insert(SwAnchoredObject &_rAnchoredObj)
virtual bool IsCoveredCell() const
const SwPageDesc & GetPageDesc(const size_t i) const
static bool lcl_UpDown(SwPaM *pPam, const SwContentFrame *pStart, GetNxtPrvCnt fnNxtPrv, bool bInReadOnly)
SwPageFrame * FindPageFrame()
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
bool IsDummyPage(sal_uInt16 nPageNum) const
bool isEmpty() const
Reports if the list does not contain any text portion.
const SwFrame * Lower() const
SwPageDesc * GetPageDesc()
SwContentNode * GetContentNode()
SwNodeOffset GetIndex() const
void SetRight(SwRect &rRect, tools::Long nNew) const
virtual const SwFlyFrame * DynCastFlyFrame() const
SwLayoutFrame * GetUpper()
static const SwContentFrame * lcl_MissProtectedFrames(const SwContentFrame *pCnt, GetNxtPrvCnt fnNxtPrv, bool bMissHeadline, bool bInReadOnly, bool bMissFollowFlowLine)
Skip protected table cells. Optionally also skip repeated headlines.
bool isFramePrintAreaValid() const
Marks a character position inside a document model node.
sal_uInt32 GetOrdNum() const
static const SwLayoutFrame * lcl_Inside(const SwContentFrame *pCnt, Point const &rPt)
Check if the point lies inside the page part in which also the ContentFrame lies. ...
tools::Long GetPrtTop(const SwFrame &rFrame) const
const Point & GetMkPos() const
bool IsContentProtected() const
const SwRowFrame * IsInFollowFlowRow() const
void MakeSelUnions(SwSelUnions &rUnions, const SwLayoutFrame *pStart, const SwLayoutFrame *pEnd, const SwTableSearchType eSearchType)
const AllSettings & GetSettings() const
bool isFrameAreaPositionValid() const
tools::Long YDiff(tools::Long n1, tools::Long n2) const
static sal_uInt64 CalcDiff(const Point &rPt1, const Point &rPt2)
void SSize(const Size &rNew)
SwRect UnionFrame(bool bBorder=false) const
|* The unionframe is the framearea (getFrameArea()) of a frame expanded by the |* printarea...
bool isFrameAreaSizeValid() const
A page of the document layout.
bool m_bNoScroll
No scrolling of undersized textframes.
bool m_b2Lines
Check 2line portions and fill p2Lines.
stay with the cursor inside text
bool MakeTableCursors(SwTableCursor &)
Calculates the cells included from the current selection.
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
SwContentFrame * GetFirstSub(const SwLayoutFrame *pLayout)
const SwPosition * Start() const
std::unique_ptr< Sw2LinesPos > m_p2Lines
for selections inside/around 2line portions
bool Contains(const Point &rPOINT) const
bool IsInProtectSect() const
Is node in a protected area?
const SwPageDesc * GetFollow() const
const SwFrame * GetFrame() const
const SwCellFrame * FirstCell() const
Calls ContainsAny first to reach the innermost cell.
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SwFillCursorPos * m_pFill
for automatic filling with tabs etc
virtual bool IsReadOnlyAvailable() const
bool IsLayoutFrame() const
static void Add(SwRegionRects &rRegion, const SwRect &rRect)
void Bottom(const tools::Long nBottom)
SwTextNode is a paragraph in the document model.
const SwContentNode * GetNode() const
SwFlyFrame * GetFlyFrame()
void SetWidth(SwRect &rRect, tools::Long nNew) const
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
SwRowFrame * GetFirstNonHeadlineRow() const
SwContentFrame *(* SwPosPage)(const SwLayoutFrame *)
general base class for all free-flowing frames
bool IsFrameInTableSel(const SwRect &rUnion, const SwFrame *pCell)
bool IsRightPageByNumber(SwRootFrame const &rLayout, sal_uInt16 nPageNum)
sal_uInt16 SetCurrPage(SwCursor *, sal_uInt16 nPageNum)
Returns a PaM which sits at the beginning of the requested page.
virtual SwFrameFormat & GetFrameFormat()=0
bool GetFrameInPage(const SwContentFrame *pCnt, SwWhichPage fnWhichPage, SwPosPage fnPosPage, SwPaM *pPam)
Returns the first/last Contentframe (controlled using the parameter fnPosPage) of the current/previou...
sal_uInt16 GetPhyPageNum() const
const SwViewOption * GetViewOptions() const
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
std::vector< SwSelUnion > SwSelUnions
sal_Int32 GetIndex() const
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page...
bool IsNoTextFrame() const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SwPosition * End() const
bool IsRightToLeft() const
::sw::DocumentSettingManager & GetDocumentSettingManager()
void Top(const tools::Long nTop)
SwTableBox is one table cell in the document model.
const Point & GetPtPos() const
bool m_bPosMatchesBounds
GetModelPositionForViewPoint should not return the next position if screen position is inside second ...
const SwTabFrame * GetFollow() const
void setHeight(tools::Long nHeight)
bool Contains(const SwAnchoredObject &_rAnchoredObj) const
const Point & GetEndPos() const
tools::Long GetBottom(const SwRect &rRect) const
virtual void Calc(vcl::RenderContext *pRenderContext) const override
void ActualizeSelection(const SwSelBoxes &rBoxes)
void SetLeft(SwRect &rRect, tools::Long nNew) const
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
const SwLayoutFrame * GetNextLayoutLeaf() const
Point GetPagePos(sal_uInt16 nPageNum) const
Returns the absolute document position of the desired page.
std::pair< const_iterator, bool > insert(Value &&x)
bool IsFootnoteContFrame() const
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Point GetNextPrevContentPos(const Point &rPoint, bool bNext) const
Search the nearest Content to the passed point.
SwViewShell * GetCurrShell() const
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
const SwContentFrame * GetContentPos(Point &rPoint, const bool bDontLeave, const bool bBodyOnly=false, SwCursorMoveState *pCMS=nullptr, const bool bDefaultExpand=true) const
Finds the closest Content for the SPoint Is used for Pages, Flys and Cells if GetModelPositionForView...
void Height(tools::Long nNew)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
bool IsClickable() const
Is this field clickable?
bool Overlaps(const SwRect &rRect) const
sal_uInt16 GetPageNum() const
bool IsFooterFrame() const
static const SwContentFrame * lcl_GetPrvCnt(const SwContentFrame *pCnt)
SwRootFrame * getRootFrame()
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
If this is about a Content-carrying cell the Cursor will be force inserted into one of the ContentFra...
SwCellFrame is one table cell in the document layout.
bool IsCallbackActionEnabled() const
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
bool IsHeaderFrame() const
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
bool IsInHeadline(const SwFrame &rFrame) const
virtual const SwFrameFormat * GetFormat() const
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
SwTabFrame * FindTabFrame()