21#include <osl/diagnose.h>
62osl::Mutex& GetPasteMutex()
73 if(
dynamic_cast<const SwCursorShell*
>( &rCurrentShell) !=
nullptr )
79 rCurrentShell.EndAction();
91 const uno::Reference < embed::XEmbeddedObject >& xObj )
const
106 std::pair<Point, bool>
const tmp(*pPt,
true);
112 if( bOldCallbackActionEnabled )
115 if( bOldCallbackActionEnabled )
146 pFrame = pFlyFrame ? pFlyFrame
156 OSL_FAIL(
"Missing Table" );
164 OSL_FAIL(
"Missing section" );
173 if(
nullptr == pFrame )
206 else if ( nYPos > -1 )
210 nYPos < pPage->getFrameArea().
Top() ) )
216 if ( pPage &&
static_cast<const SwPageFrame*
>(pPage)->IsEmptyPage() )
228 return nullptr != pPage;
247 std::pair<Point, bool>
const tmp(*pPt,
true);
288 OSL_ENSURE(
static_cast<const SwFlyFrame*
>(pFrame)->IsFlyInContentFrame(),
302 pFrame =
static_cast<const SwFlyFrame*
>(pFrame)->GetAnchorFrame();
355 "SwFEShell _SetAPageOffset() without ContentFrame" );
422 const OUString& rNumberSeparator,
423 const bool bBefore,
const sal_uInt16 nId,
424 const OUString& rCharacterStyle,
437 bool bInnerCntIsFly =
false;
443 bInnerCntIsFly = pCnt->
IsInFly();
448 GetFormat()->GetContent().GetContentIdx()->GetIndex();
457 ->GetSttNd()->FindTableNode()->GetIndex();
468 std::vector<SdrObject*> aDrawObjs;
474 aDrawObjs.push_back( pDrawObj );
478 while ( !aDrawObjs.empty() )
482 dynamic_cast<const SwFlyDrawObj*
>( pDrawObj) ==
nullptr )
487 pFlyFormat = pFormat;
490 aDrawObjs.pop_back();
496 OSL_ENSURE(
false,
"Cursor neither in table nor in fly." );
502 rNumberSeparator, bBefore,
nId,
503 nIdx, rCharacterStyle, bCpyBrd);
530 OSL_ENSURE( pFrame->
FindTabFrame(),
"Cursor not in table." );
547 bRet =
mxDoc->SortTable(aBoxes, rOpt);
556 auto [pStart, pEnd] = pPam->
StartEnd();
559 SwNodeOffset nOffset = pEnd->GetNodeIndex() - pStart->GetNodeIndex();
560 const sal_Int32 nCntStt = pStart->GetContentIndex();
563 bRet =
mxDoc->SortText(*pPam, rOpt);
569 sal_Int32 nLen = pCNd->
Len();
608 const SwFrame *pCurFrame = pFrame;
650 OSL_ENSURE( pFrame,
"Cursor parked?" );
655 OSL_ENSURE( pFrame,
"No Tab, no Sect" );
664 , m_bCheckForOLEInCaption(false)
665 , m_aPasteListeners(GetPasteMutex())
666 , m_eTableInsertMode(
SwTable::SEARCH_NONE)
667 , m_bTableCopied(false)
673 , m_bCheckForOLEInCaption(false)
674 , m_aPasteListeners(GetPasteMutex())
675 , m_eTableInsertMode(
SwTable::SEARCH_NONE)
676 , m_bTableCopied(false)
692 const sal_Int16 _eHoriRelOrient,
693 const sal_Int16 _eVertRelOrient,
695 const bool _bFollowTextFlow,
707 if(
nullptr != pFly )
716 bool bWrapThrough =
false;
721 bWrapThrough = rSurround.
GetSurround() == css::text::WrapTextMode_THROUGH;
728 bool bVertic =
false;
730 bool bVerticalL2R =
false;
732 if ((RndStdIds::FLY_AT_PAGE == _nAnchorId) || (RndStdIds::FLY_AT_FLY == _nAnchorId))
736 if ((RndStdIds::FLY_AT_PAGE == _nAnchorId) ||
737 ((RndStdIds::FLY_AT_FLY == _nAnchorId) && !_bFollowTextFlow))
757 bVertic = aRectFnSet.
IsVert();
760 switch ( _eHoriRelOrient )
762 case text::RelOrientation::PAGE_RIGHT:
765 case text::RelOrientation::PRINT_AREA:
772 switch ( _eHoriRelOrient )
774 case text::RelOrientation::PRINT_AREA:
777 case text::RelOrientation::PAGE_RIGHT:
784 switch ( _eHoriRelOrient )
786 case text::RelOrientation::PRINT_AREA:
789 case text::RelOrientation::PAGE_LEFT:
797 switch ( _eHoriRelOrient )
799 case text::RelOrientation::PAGE_RIGHT:
802 case text::RelOrientation::PRINT_AREA:
810 switch ( _eVertRelOrient )
812 case text::RelOrientation::PRINT_AREA:
813 case text::RelOrientation::PAGE_PRINT_AREA:
822 switch ( _eVertRelOrient )
824 case text::RelOrientation::PRINT_AREA:
825 case text::RelOrientation::PAGE_PRINT_AREA:
834 switch ( _eVertRelOrient )
836 case text::RelOrientation::PRINT_AREA:
837 case text::RelOrientation::PAGE_PRINT_AREA:
842 static_cast<const SwPageFrame*
>(pFrame)->PrtWithoutHeaderAndFooter().
Top() );
882 if ((_nAnchorId == RndStdIds::FLY_AT_PARA) || (_nAnchorId == RndStdIds::FLY_AT_CHAR))
898 if ( _bFollowTextFlow )
905 if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
913 aPos.
setX( aVertEnvironRect.
Left() );
917 aPos.
setY( aVertEnvironRect.
Top() );
924 "<SwFEShell::CalcBoundRect(..)> - not following text flow, but vertical environment *not* page!" );
929 if (_eVertRelOrient == text::RelOrientation::PAGE_FRAME
930 || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA
931 || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
936 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
943 aPos.
setX( aVertEnvironRect.
Left() );
944 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
951 aPos.
setY( aVertEnvironRect.
Top() );
952 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
956 const SwFrame* pTmpFrame = rVertEnvironLayFrame.
Lower();
962 else if (_eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
966 auto& rPageFrame =
static_cast<const SwPageFrame&
>(rVertEnvironLayFrame);
967 aPos.
setY(rPageFrame.PrtWithoutHeaderAndFooter().Bottom());
986 (_nAnchorId == RndStdIds::FLY_AT_CHAR) &&
987 ( _eVertRelOrient == text::RelOrientation::CHAR ||
988 _eVertRelOrient == text::RelOrientation::TEXT_LINE ) )
991 if ( _eVertRelOrient == text::RelOrientation::CHAR )
994 if ( _pToCharContentPos )
1002 pTextFrame->
GetAutoPos( aChRect, aDefaultContentPos );
1008 if ( _pToCharContentPos )
1033 (_nAnchorId == RndStdIds::FLY_AT_CHAR) &&
1034 _eHoriRelOrient == text::RelOrientation::CHAR )
1038 if ( _pToCharContentPos )
1046 pTextFrame->
GetAutoPos( aChRect, aDefaultContentPos );
1048 nLeft = aRectFnSet.
GetLeft(aChRect);
1061 aHoriEnvironRect.
Top(),
1062 aVertEnvironRect.
Width(),
1063 aHoriEnvironRect.
Height() );
1068 aVertEnvironRect.
Top(),
1069 aHoriEnvironRect.
Width(),
1070 aVertEnvironRect.
Height() );
1087 aRectFnSet.
SetBottom( _orRect, nBottom );
1104 bVertic = aRectFnSet.
IsVert();
1108 switch ( _eHoriRelOrient )
1110 case text::RelOrientation::FRAME_RIGHT:
1116 case text::RelOrientation::PRINT_AREA:
1119 aPos.
setY(aPos.
getY() + nBaseOfstForFly);
1122 case text::RelOrientation::PAGE_RIGHT:
1127 case text::RelOrientation::PAGE_PRINT_AREA:
1132 case text::RelOrientation::PAGE_LEFT:
1133 case text::RelOrientation::PAGE_FRAME:
1138 case text::RelOrientation::FRAME:
1140 aPos.
setY(aPos.
getY() + nBaseOfstForFly);
1148 switch ( _eHoriRelOrient )
1151 case text::RelOrientation::FRAME:
1154 case text::RelOrientation::PAGE_LEFT:
1163 switch ( _eHoriRelOrient )
1165 case text::RelOrientation::FRAME_LEFT:
1170 case text::RelOrientation::PRINT_AREA:
1173 aPos.
setX(aPos.
getX() + nBaseOfstForFly);
1176 case text::RelOrientation::PAGE_LEFT:
1180 case text::RelOrientation::PAGE_PRINT_AREA:
1185 case text::RelOrientation::PAGE_RIGHT:
1186 case text::RelOrientation::PAGE_FRAME:
1190 case text::RelOrientation::FRAME:
1191 aPos.
setX(aPos.
getX() + nBaseOfstForFly);
1198 switch ( _eHoriRelOrient )
1200 case text::RelOrientation::FRAME_RIGHT:
1204 case text::RelOrientation::PRINT_AREA:
1206 aPos.
setX(aPos.
getX() + nBaseOfstForFly);
1208 case text::RelOrientation::PAGE_RIGHT:
1211 case text::RelOrientation::PAGE_PRINT_AREA:
1214 case text::RelOrientation::PAGE_LEFT:
1215 case text::RelOrientation::PAGE_FRAME:
1218 case text::RelOrientation::FRAME:
1219 aPos.
setX(aPos.
getX() + nBaseOfstForFly);
1229 if( bVertic && !bVerticalL2R )
1231 else if( bVerticalL2R )
1285 OSL_FAIL(
"<SwFEShell::IsFrameVertical(..)> - missing SdrObject instance in marked object list -> This is a serious situation" );
1292 OSL_FAIL(
"<SwFEShell::IsFrameVertical(..)> - missing SwContact instance at marked object -> This is a serious situation" );
1298 OSL_FAIL(
"<SwFEShell::IsFrameVertical(..)> - missing anchor frame at marked object -> This is a serious situation" );
1302 if ( !bEnvironment )
1304 pRef = pVirtFly->GetFlyFrame();
helper class to disable creation of an action by a callback event in particular, change event from a ...
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
OUString GetNumStr(sal_Int32 nNo) const
const SwFrame * GetAnchorFrame() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual sal_Int32 Len() const
Point & GetCursorDocPos() const
bool HasSelection() const
Does the current cursor create a selection?
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
void EndAction(const bool bIdleEnd=false)
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
SwFlyFrameFormat * InsertDrawLabel(const OUString &rText, const OUString &rSeparator, const OUString &rNumberSeparator, const sal_uInt16 nId, const OUString &rCharacterStyle, SdrObject &rObj)
SwFlyFrameFormat * InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberingSeparator, const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx, const OUString &rCharacterStyle, const bool bCpyBrd)
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
IDocumentContentOperations const & getIDocumentContentOperations() const
void StartAllAction()
For all views of this document.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
void SetNewPageOffset(sal_uInt16 nOffset)
SwFlyFrame * GetSelectedFlyFrame() const
sal_uInt16 GetCurColNum(SwGetCurColNumPara *pPara=nullptr) const
The ruler needs some information too.
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
bool IsColRightToLeft() const
virtual void MoveObjectIfActive(svt::EmbeddedObjectRef &xObj, const Point &rOffset)
The layout has been changed, so the active object has to be moved after that.
virtual ~SwFEShell() override
SwFEShell(SwDoc &rDoc, vcl::Window *pWin, const SwViewOption *pOpt)
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
SAL_DLLPRIVATE void EndAllActionAndCall()
Terminate actions for all shells and call ChangeLink.
void ToggleHeaderFooterEdit()
static SAL_DLLPRIVATE sal_uInt16 GetCurColNum_(const SwFrame *pFrame, SwGetCurColNumPara *pPara)
void ShellLoseFocus()
Hide or show layout-selection and pass call to CursorSh.
void InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberSeparator, const bool bBefore, const sal_uInt16 nId, const OUString &rCharacterStyle, const bool bCpyBrd)
void SetPageOffset(sal_uInt16 nOffset)
Changes last page offset.
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
sal_uInt16 GetVirtPageNum() const
Size GetGraphicDefaultSize() const
sal_uInt16 GetCurOutColNum() const
Current outer column.
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
SAL_DLLPRIVATE SwFlyFrame * FindFlyFrame(const css::uno::Reference< css::embed::XEmbeddedObject > &) const
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwFormatAnchor *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
Point GetContentPos(const Point &rPoint, bool bNext) const
Provide information about content situated closes to given Point.
sal_uInt16 GetPageOffset() const
const SwPageDesc & GetPageDesc(size_t i) const
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
bool IsDirectlyInSection() const
bool Sort(const SwSortOptions &)
void SelectFlyFrame(SwFlyFrame &rFrame)
general base class for all free-flowing frames
virtual const SwFlyFrameFormat * GetFormat() const override
bool IsFlyAtContentFrame() const
bool IsFlyInContentFrame() const
bool IsFlyLayFrame() const
Flys that are anchored as a character in the content.
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
const ::std::optional< sal_uInt16 > & GetNumOffset() const
const SwRect & getFrameArea() const
const SwRect & getFramePrintArea() const
Base class of the Writer layout elements.
tools::Long GetLeftMargin() const
SwTextFrame * DynCastTextFrame()
sal_uInt16 GetVirtPageNum() const
tools::Long GetRightMargin() const
SwFlyFrame * FindFlyFrame()
SwSectionFrame * FindSctFrame()
SwTabFrame * FindTabFrame()
bool IsColumnFrame() const
SwFrameType GetType() const
bool IsHeaderFrame() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool IsRightToLeft() const
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
SwPageFrame * FindPageFrame()
SwFrame * FindFooterOrHeader()
virtual const SwFormatPageDesc & GetPageDescItem() const
sal_uInt16 GetPhyPageNum() const
tools::Long GetTopMargin() const
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
virtual const SwFrameFormat * GetFormat() const
const SwFrame * Lower() const
Marks a node in the document model.
SwContentNode * GetContentNode()
PaM is Point and Mark: a selection of the document model.
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
SwContentNode * GetPointContentNode() const
const SwPosition * GetPoint() const
const SvxNumberType & GetNumType() const
A page of the document layout.
SwContentFrame * FindFirstBodyContent()
bool IsFootnotePage() const
Foot note interface.
SwPageDesc * GetPageDesc()
void SetBottom(SwRect &rRect, tools::Long nNew) const
Point GetPos(const SwRect &rRect) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetBottom(const SwRect &rRect) const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Bottom(const tools::Long nBottom)
void Pos(const Point &rNew)
void SSize(const Size &rNew)
bool Contains(const Point &rPOINT) const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
The root element of a Writer document layout.
void SetVirtPageNum(const bool bOf) const
Point GetNextPrevContentPos(const Point &rPoint, bool bNext) const
Search the nearest Content to the passed point.
const SwRect & GetPagesArea() const
bool IsCallbackActionEnabled() const
void SetCallbackActionEnabled(bool b)
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
const SwTable * GetTable() const
SwTable is one table in the document model, containing rows (which contain cells).
SwTableSortBoxes & GetTabSortBoxes()
Represents the visualization of a paragraph.
SwTwips GetBaseOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
bool GetAutoPos(SwRect &, const SwPosition &) const
A slimmer version of GetCharRect for autopositioning Frames.
bool GetTopOfLine(SwTwips &_onTopOfLine, const SwPosition &_rPos) const
Determine top of line for given position in the text frame.
SwTextNode * GetTextNodeFirst()
static SwRewriter CreateRewriter(const OUString &rStr)
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
bool HasDrawView() const
New Interface for StarView Drawing.
SwDrawView * GetDrawView()
vcl::RenderContext * GetOut() const
rtl::Reference< SwDoc > mxDoc
The document; never 0.
SwRootFrame * GetLayout() const
void ToggleHeaderFooterEdit()
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
const SwLayoutFrame & GetHoriEnvironmentLayoutFrame(const SwFrame &_rHoriOrientFrame) const
determine environment layout frame for possible horizontal object positions respectively for alignmen...
const SwLayoutFrame & GetVertEnvironmentLayoutFrame(const SwFrame &_rVertOrientFrame) const
determine environment layout frame for possible vertical object positions respectively for alignments...
ring_container GetRingContainer()
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
void FrameNotify(SwViewShell *pVwSh, FlyMode eMode)
@ FlyEmbeddedPrt
Rect of PrtArea of FlyFrame.
@ Page
Rect of current page.
@ SectionPrt
Rect of current PrtArea of section.
@ PageCalc
... page will be formatted if required.
@ FlyEmbedded
Rect of current FlyFrame.
@ HeaderFooter
Rect of current header/footer.
@ PagesArea
Rect covering the pages area.
@ PagePrt
Rect of current PrtArea of page.
@ Section
Rect of current section.
@ SectionOutsideTable
Rect of current section but outside of table.
FrameTypeFlags
values can be combined via logical or
SwFlyFrame * GetFlyFromMarked(const SdrMarkList *pLst, SwViewShell *pSh)
static void lcl_SetAPageOffset(sal_uInt16 nOffset, SwPageFrame *pPage, SwFEShell *pThis)
void SetShell(SwViewShell *pSh)
const SwFrameFormat * pFrameFormat
Marks a position in the document model.
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)