summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/txtfrm.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/inc/txtfrm.hxx')
-rw-r--r--sw/source/core/inc/txtfrm.hxx107
1 files changed, 66 insertions, 41 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index abef52f448aa..373b46bb8af2 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -22,8 +22,12 @@
#include <com/sun/star/uno/Sequence.hxx>
#include "cntfrm.hxx"
#include "TextFrameIndex.hxx"
+#include <nodeoffset.hxx>
#include <set>
+#include <utility>
+
+#include <view.hxx>
namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
@@ -47,6 +51,8 @@ class SwScriptInfo;
enum class ExpandMode;
class SwTextAttr;
class SwWrtShell;
+class SwNode;
+class SwFlyAtContentFrame;
#define NON_PRINTING_CHARACTER_COLOR Color(0x26, 0x8b, 0xd2)
@@ -95,6 +101,7 @@ struct Extent
};
struct MergedPara;
+class InsertText;
std::pair<SwTextNode*, sal_Int32> MapViewToModel(MergedPara const&, TextFrameIndex nIndex);
TextFrameIndex MapModelToView(MergedPara const&, SwTextNode const* pNode, sal_Int32 nIndex);
@@ -104,12 +111,12 @@ enum class FrameMode { New, Existing };
std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode);
SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, sw::FrameMode eMode);
-bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
+bool FrameContainsNode(SwContentFrame const& rFrame, SwNodeOffset nNodeIndex);
bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
-SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode);
+SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNode const& rNode);
SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
std::pair<SwTextNode *, SwTextNode *>
-GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos);
+GetFirstAndLastNode(SwRootFrame const& rLayout, SwNode const& rPos);
SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
SwTextNode const& rNode, SwRootFrame const* pLayout);
@@ -133,7 +140,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam);
void AddRemoveFlysAnchoredToFrameStartingAtNode(
SwTextFrame & rFrame, SwTextNode & rTextNode,
- std::set<sal_uLong> *pSkipped);
+ std::set<SwNodeOffset> *pSkipped);
OUString GetExpandTextMerged(SwRootFrame const* pLayout,
SwTextNode const& rNode, bool bWithNumber,
@@ -145,6 +152,8 @@ bool IsMarkHintHidden(SwRootFrame const& rLayout,
void RecreateStartTextFrames(SwTextNode & rNode);
+sw::InsertText MakeInsertText(SwTextNode& rNode, const sal_Int32 nPos, const sal_Int32 nLen);
+
/**
* Decides if rTextNode has a numbering which has layout-level values (e.g. Arabic, but not
* none or bullets).
@@ -155,7 +164,7 @@ bool HasNumberingWhichNeedsLayoutUpdate(const SwTextNode& rTextNode);
/// Represents the visualization of a paragraph. Typical upper is an
/// SwBodyFrame. The first text portion of the first line is az SwParaPortion.
-class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
+class SAL_DLLPUBLIC_RTTI SwTextFrame final : public SwContentFrame
{
friend class SwTextIter;
friend class SwTestFormat;
@@ -172,8 +181,8 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
static constexpr tools::Long nMinPrtLine = 0; // This Line must not be underrun when printing
// Hack for table cells stretching multiple pages
- sal_uInt32 mnAllLines :24; // Line count for the Paint (including nThisLines)
- sal_uInt32 mnThisLines :8; // Count of Lines of the Frame
+ sal_Int32 mnAllLines :24; // Line count for the Paint (including nThisLines)
+ sal_Int32 mnThisLines :8; // Count of Lines of the Frame
// The x position for flys anchored at this paragraph.
// These values are calculated in SwTextFrame::CalcBaseOfstForFly()
@@ -259,7 +268,8 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
// In order to safe stack space, we split this method:
// Format_ calls Format_ with parameters
- void Format_( vcl::RenderContext* pRenderContext, SwParaPortion *pPara );
+ void FormatImpl( vcl::RenderContext* pRenderContext, SwParaPortion *pPara,
+ ::std::vector<SwAnchoredObject *> & rIntersectingObjs);
void Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
const bool bAdjust = false );
void FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
@@ -270,7 +280,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
virtual void MakePos() override;
// Corrects the position from which we need to format
- static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart,
+ static TextFrameIndex FindBrk(std::u16string_view aText, TextFrameIndex nStart,
TextFrameIndex nEnd);
// inline branch
@@ -323,9 +333,13 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
void UpdateOutlineContentVisibilityButton(SwWrtShell* pWrtSh) const;
void PaintOutlineContentVisibilityButton() const;
-protected:
+ void PaintParagraphStylesHighlighting() const;
+
virtual void SwClientNotify(SwModify const& rModify, SfxHint const& rHint) override;
+ /// Like GetDrawObjs(), but limit to fly frames which are allowed to split.
+ std::vector<SwFlyAtContentFrame*> GetSplitFlyDrawObjs() const;
+
public:
virtual const SvxFormatBreakItem& GetBreakItem() const override;
@@ -339,7 +353,7 @@ public:
*/
void Init();
- /// Is called by DoIdleJob_() and ExecSpellPopup()
+ /// Is called by DoIdleJob_(), ExecSpellPopup() and UpDown()
SwRect AutoSpell_(SwTextNode &, sal_Int32);
/// Is called by DoIdleJob_()
@@ -349,7 +363,7 @@ public:
void CollectAutoCmplWrds(SwTextNode &, sal_Int32);
/**
- * Returns the screen position of rPos. The values are relative to the upper
+ * Returns the view rectangle for the rPos model position. The values are relative to the upper
* left position of the page frame.
* Additional information can be obtained by passing an SwCursorMoveState object.
* Returns false if rPos > number of character is string
@@ -393,7 +407,7 @@ public:
* @returns false if the SPoint is outside of the SSize else
* returns true
*/
- virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
+ SW_DLLPUBLIC virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
/**
@@ -404,10 +418,8 @@ public:
{ return GetModelPositionForViewPoint_( pPos, rPoint, false ); }
void PaintExtraData( const SwRect & rRect ) const; /// Page number etc.
- SwRect GetPaintSwRect();
- virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
- SwPrintData const*const pPrintData = nullptr ) const override;
- virtual bool GetInfo( SfxPoolItem & ) const override;
+ SW_DLLPUBLIC SwRect GetPaintSwRect();
+ virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const& ) const override;
/**
* Layout oriented cursor travelling:
@@ -452,12 +464,12 @@ public:
sw::MergedPara const* GetMergedPara() const { return m_pMergedPara.get(); }
/// Returns the text portion we want to edit (for inline see underneath)
- const OUString& GetText() const;
+ SW_DLLPUBLIC const OUString& GetText() const;
SwTextNode const* GetTextNodeForParaProps() const;
- SwTextNode const* GetTextNodeForFirstText() const;
+ SW_DLLPUBLIC SwTextNode const* GetTextNodeForFirstText() const;
SwTextNode * GetTextNodeFirst()
{ return const_cast<SwTextNode*>(const_cast<SwTextFrame const*>(this)->GetTextNodeFirst()); };
- SwTextNode const* GetTextNodeFirst() const;
+ SW_DLLPUBLIC SwTextNode const* GetTextNodeFirst() const;
SwDoc & GetDoc()
{ return const_cast<SwDoc &>(const_cast<SwTextFrame const*>(this)->GetDoc()); }
SwDoc const& GetDoc() const;
@@ -480,7 +492,7 @@ public:
* bSplit indicates, that the paragraph has to be split
* bTst indicates, that we are currently doing a test formatting
*/
- virtual bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst ) override;
+ virtual bool WouldFit(SwTwips &nMaxHeight, bool &bSplit, bool bTst, bool bMoveBwd) override;
/**
* The WouldFit equivalent for temporarily rewired TextFrames
@@ -499,10 +511,10 @@ public:
/// Test grow
inline SwTwips GrowTst( const SwTwips nGrow );
- SwParaPortion *GetPara();
+ SW_DLLPUBLIC SwParaPortion *GetPara();
inline const SwParaPortion *GetPara() const;
inline bool HasPara() const;
- bool HasPara_() const;
+ SW_DLLPUBLIC bool HasPara_() const;
/// map position in potentially merged text frame to SwPosition
std::pair<SwTextNode*, sal_Int32> MapViewToModel(TextFrameIndex nIndex) const;
@@ -514,6 +526,9 @@ public:
// the offset will be returned.
SwTwips HangingMargin() const;
+ /// Get the amount of lower margin of this frame we need to consider for fly portion purposes.
+ SwTwips GetLowerMarginForFlyIntersect() const;
+
// Locking
bool IsLocked() const { return mbLocked; }
@@ -543,7 +558,7 @@ public:
#endif
/// Hidden
- bool IsHiddenNow() const; // bHidden && pOut == pPrt
+ virtual bool IsHiddenNow() const override; // bHidden && pOut == pPrt
void HideHidden(); // Remove appendage if Hidden
void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd);
@@ -572,13 +587,13 @@ public:
TextFrameIndex GetDropLen(TextFrameIndex nWishLen) const;
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript,
- bool bNoChar = false) const;
+ bool bNoChar = false, bool bNoneIfNoHyphenation = false ) const;
virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
virtual void CheckDirection( bool bVert ) override;
/// Returns the sum of line height in pLine
- sal_uInt16 GetParHeight() const;
+ SwTwips GetParHeight() const;
inline SwTextFrame *GetFollow();
inline const SwTextFrame *GetFollow() const;
@@ -662,24 +677,24 @@ public:
bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff );
/// Determines the line count
- sal_uInt16 GetLineCount(TextFrameIndex nPos);
+ sal_Int32 GetLineCount(TextFrameIndex nPos);
/// For displaying the line numbers
- sal_uLong GetAllLines() const { return mnAllLines; }
- sal_uLong GetThisLines() const { return mnThisLines;}
+ sal_Int32 GetAllLines() const { return mnAllLines; }
+ sal_Int32 GetThisLines() const { return mnThisLines;}
void RecalcAllLines();
/// Stops the animations within numberings
void StopAnimation( const OutputDevice *pOut );
/// Visit all portions for Accessibility
- void VisitPortions( SwPortionHandler& rPH ) const;
+ SW_DLLPUBLIC void VisitPortions( SwPortionHandler& rPH ) const;
/// Returns the script info stored at the paraportion
const SwScriptInfo* GetScriptInfo() const;
/// Swaps width and height of the text frame
- void SwapWidthAndHeight();
+ SW_DLLPUBLIC void SwapWidthAndHeight();
/**
* Calculates the coordinates of a rectangle when switching from
@@ -703,7 +718,7 @@ public:
* Calculates the coordinates of a rectangle when switching from
* vertical to horizontal layout
*/
- void SwitchVerticalToHorizontal( SwRect& rRect ) const;
+ SW_DLLPUBLIC void SwitchVerticalToHorizontal( SwRect& rRect ) const;
/**
* Calculates the coordinates of a point when switching from
@@ -778,7 +793,22 @@ public:
OUString GetCurWord(SwPosition const&) const;
sal_uInt16 GetScalingOfSelectedText(TextFrameIndex nStt, TextFrameIndex nEnd);
- virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
+ /// This text frame may have a split fly frames anchored to it. Is any of them a frame that has
+ /// a follow, i.e. not the last in a master -> follow 1 -> ... -> last follow chain?
+ SwFlyAtContentFrame* HasNonLastSplitFlyDrawObj() const;
+
+ /// This text frame has a follow and the text frame don't contain text. Additionally one split
+ /// fly is anchored to the text frame.
+ bool IsEmptyMasterWithSplitFly() const;
+
+ /// This text frame is not split, doesn't fit the upper, has a single split fly anchored to it
+ /// with a negative vertical offset. Such frames may need explicit splitting.
+ bool IsEmptyWithSplitFly() const;
+
+ static SwView* GetView();
+
+ void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
+ void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
};
//use this to protect a SwTextFrame for a given scope from getting merged with
@@ -931,7 +961,7 @@ public:
class SwLayoutModeModifier
{
const OutputDevice& m_rOut;
- ComplexTextLayoutFlags m_nOldLayoutMode;
+ vcl::text::ComplexTextLayoutFlags m_nOldLayoutMode;
public:
SwLayoutModeModifier( const OutputDevice& rOutp );
~SwLayoutModeModifier();
@@ -968,10 +998,10 @@ struct MergedPara
/// mainly for sanity checks
SwTextNode const* pLastNode;
MergedPara(SwTextFrame & rFrame, std::vector<Extent>&& rExtents,
- OUString const& rText,
+ OUString aText,
SwTextNode *const pProps, SwTextNode *const pFirst,
SwTextNode const*const pLast)
- : listener(rFrame), extents(std::move(rExtents)), mergedText(rText)
+ : listener(rFrame), extents(std::move(rExtents)), mergedText(std::move(aText))
, pParaPropsNode(pProps), pFirstNode(pFirst), pLastNode(pLast)
{
assert(pParaPropsNode);
@@ -984,13 +1014,8 @@ struct MergedPara
class MergedAttrIterBase
{
protected:
-#if BOOST_VERSION < 105600
- sw::MergedPara const* m_pMerged;
- SwTextNode const* m_pNode;
-#else
sw::MergedPara const*const m_pMerged;
SwTextNode const*const m_pNode;
-#endif
size_t m_CurrentExtent;
size_t m_CurrentHint;
MergedAttrIterBase(SwTextFrame const& rFrame);