110 #include <rtl/strbuf.hxx>
119 #if OSL_DEBUG_LEVEL > 1
120 static bool bFrameId =
false;
132 std::unique_ptr<std::set<sal_uInt16>>
145 static void SectFunc( OStringBuffer& rOut,
DbgAction nAct,
void const * pParam );
153 Record_(pFrame, nFunction, nAct, pParam);
185 , m_nFunction(nFunct)
191 virtual void Enter();
192 virtual void Leave();
204 , m_nFrameHeight(pF->getFrameArea().
Height())
208 virtual void Leave()
override;
213 sal_uInt16 m_nFrameId;
222 virtual void Enter()
override;
223 virtual void Leave()
override;
233 , m_aFrame(pF->getFrameArea())
237 virtual void Enter()
override;
238 virtual void Leave()
override;
297 , m_nMaxLines(USHRT_MAX)
328 rLine = rLine.toAsciiLowerCase();
329 rLine = rLine.replace(
'\t',
' ' );
330 if(
'#' == rLine[0] )
332 if(
'[' == rLine[0] )
335 if (aTmp ==
"[frmid")
340 else if (aTmp ==
"[frmtype")
345 else if (aTmp ==
"[record")
350 else if (aTmp ==
"[test")
355 else if (aTmp ==
"[max")
360 else if (aTmp ==
"[var")
366 rLine = rLine.copy(aTmp.size() + 1);
375 if( !aTok.empty() &&
'!' == aTok[0] )
378 aTok = aTok.substr(1);
400 nOld |=
PROT(nVal & o3tl::typed_flags<PROT>::mask);
421 while ( nIndex >= 0 );
427 SvFileStream aStream(
"dbg_lay.ini", StreamMode::READ );
432 while( aStream.
good() )
436 if(
'\n' == c ||
'\r' == c )
438 aLine = aLine.trim();
439 if( !aLine.isEmpty() )
444 aLine += OStringChar(c);
446 if( !aLine.isEmpty() )
462 if( rLay.getLength() > 1 )
464 rLay.remove(rLay.getLength() - 2, rLay.getLength());
475 rOut.append(
" ValidSize");
477 rOut.append(
" ValidPos");
479 rOut.append(
" ValidPrtArea");
483 static void lcl_Padded(OStringBuffer& rOut,
const OString& s,
size_t length)
485 if (sal_Int32(length) < s.getLength())
486 length = s.getLength();
488 for (
size_t i = 0;
i < length - s.getLength();
i++)
496 char sz[RTL_STR_MAX_VALUEOFINT64];
497 rtl_str_valueOfInt64(sz, n, 10);
511 rOut.append(
", Width:");
513 rOut.append(
", Height:");
529 if (pFrame ==
nullptr)
532 if (pTabLine ==
nullptr)
559 result +=
"Para:" + OUString::number(10) +
" " +
564 return OUString::number(n) +
" para(s):" + result;
577 rOut.append(
"SwTextFrame ");
581 rOut.append(
"SwPageFrame ");
583 rOut.append(
"SwColumnFrame ");
587 rOut.append(
"(Col)");
588 rOut.append(
"SwBodyFrame ");
591 rOut.append(
"SwRootFrame ");
593 rOut.append(
"SwCellFrame ");
595 rOut.append(
"SwTabFrame ");
597 rOut.append(
"SwRowFrame ");
599 rOut.append(
"SwSectionFrame ");
601 rOut.append(
"SwHeaderFrame ");
603 rOut.append(
"SwFooterFrame ");
605 rOut.append(
"SwFootnoteFrame ");
607 rOut.append(
"SwFootnoteContFrame ");
609 rOut.append(
"SwFlyFrame ");
611 rOut.append(
"SwLayoutFrame ");
614 rOut.append(
"SwNoTextFrame");
616 rOut.append(
"Not impl. ");
627 sal_uInt16 nSpecial = 0;
671 aOut.append(
"SwFlowFrame::MoveFwd");
673 aOut.append(
"SwFlowFrame::MoveBwd");
678 aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam)));
682 aOut.append(
"SwFrame::Grow (test)");
686 aOut.append(
"SwFrame::Shrink (test)");
694 aOut.append(
"SwFrame::Grow");
698 aOut.append(
"SwFrame::Shrink");
700 aOut.append(
"SwFrame::AdjustNeighbourhood");
706 aOut.append(static_cast<sal_Int64>(*static_cast<tools::Long*>(pParam)));
717 case PROT::Leaf: aOut.append(
"SwFrame::GetPrev/NextSctLeaf");
723 aOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
727 aOut.append(
"Initialize");
735 aOut.append(
"PROT::Cut from ");
737 aOut.append(
"PROT::Paste to ");
738 aOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
741 aOut.append(
"SwTextFrame::TestFormat");
753 aOut.append(
"PosChg: (");
754 aOut.append(static_cast<sal_Int64>(rFrame.
Left()));
756 aOut.append(static_cast<sal_Int64>(rFrame.
Top()));
757 aOut.append(
") -> (");
765 aOut.append(
"Height: ");
766 aOut.append(static_cast<sal_Int64>(rFrame.
Height()));
773 aOut.append(
"Width: ");
774 aOut.append(static_cast<sal_Int64>(rFrame.
Width()));
785 while (aOut.getLength() < 40) aOut.append(
" ");
789 while (aOut.getLength() < 90) aOut.append(
" ");
795 while (aOut.getLength() < 140) aOut.append(
" ");
796 const OUString&
text =
static_cast<const SwTextFrame*
>(pFrame)->GetText();
817 SAL_INFO(
"sw.layout.debug", aOut.getStr());
818 m_pStream->WriteOString(aOut.makeStringAndClear());
819 (*m_pStream) <<
endl;
823 SAL_WARN(
"sw.layout.debug",
"max number of lines reached");
835 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
841 rOut.append(
"Master to ");
843 rOut.append(
"Follow from ");
844 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
850 rOut.append(
"Master to ");
852 rOut.append(
"Follow from ");
853 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
895 case PROT::Shrink :
pImpl.reset(
new SwSizeEnterLeave( pFrame, nFunc, nAct, pPar ) );
break;
897 case PROT::MoveBack :
pImpl.reset(
new SwUpperEnterLeave( pFrame, nFunc, nAct, pPar ) );
break;
922 void SwSizeEnterLeave::Leave()
924 m_nFrameHeight = m_pFrame->getFrameArea().Height() - m_nFrameHeight;
928 void SwUpperEnterLeave::Enter()
930 m_nFrameId = m_pFrame->GetUpper() ? sal_uInt16(
lcl_GetFrameId(m_pFrame->GetUpper())) : 0;
934 void SwUpperEnterLeave::Leave()
936 m_nFrameId = m_pFrame->GetUpper() ? sal_uInt16(
lcl_GetFrameId(m_pFrame->GetUpper())) : 0;
940 void SwFrameChangesLeave::Enter()
944 void SwFrameChangesLeave::Leave()
946 if (m_pFrame->getFrameArea() != m_aFrame)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
void Record(const SwFrame *pFrame, PROT nFunction, DbgAction nAct, void *pParam)
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
sal_Int64 toInt64(std::u16string_view str, sal_Int16 radix=10)
virtual ~SwImplEnterLeave()
const OUString & GetText() const
const SwTable * GetTable() const
void Left(const tools::Long nLeft)
SwFrameType GetType() const
const SwRect & getFramePrintArea() const
std::unique_ptr< std::set< sal_uInt16 > > m_pFrameIds
SwTabFrame is one table in the document layout, containing rows (which contain cells).
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
SwTableLine is one table row in the document model.
void Pos(const Point &rNew)
Of course Writer needs its own rectangles.
void CheckLine(OString &rLine)
analyze a line in the INI file
static OString lcl_TableInfo(const SwTabFrame *pTabFrame)
bool IsFootnoteFrame() const
SwEnterLeave(const SwFrame *pFrame, PROT nFunc, DbgAction nAct, void *pPar)
void InsertFrame(sal_uInt16 nFrameId)
if pFrameIds==NULL all Frames will be logged.
const SwTableBox * GetTabBox() const
const SwRect & getFrameArea() const
SwImplEnterLeave(const SwFrame *pF, PROT nFunct, DbgAction nAct, void *pPar)
static void lcl_Flags(OStringBuffer &rOut, const SwFrame *pFrame)
output the ValidSize-, ValidPos- and ValidPrtArea-Flag ("Sz","Ps","PA") of the frame; "+" stands for ...
void Width(tools::Long nNew)
static void SectFunc(OStringBuffer &rOut, DbgAction nAct, void const *pParam)
Handle the output of the SectionFrames.
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void DeleteFrame(sal_uInt16 nFrameId)
Removes a FrameId from the pFrameIds array, so that it won't be logged anymore.
static void SetRecord(PROT nNew)
exports com.sun.star. text
bool IsColumnFrame() const
static SwImplProtocol * s_pImpl
static sal_uLong lcl_GetFrameId(const SwFrame *pFrame)
static void lcl_FrameRect(OStringBuffer &rOut, const char *hint, const SwRect &rect)
output the frame as plain text.
SwNodeOffset GetIndex() const
SwLayoutFrame * GetUpper()
bool isFramePrintAreaValid() const
std::vector< tools::Long > m_aVars
SwNodes & GetNodes()
Node is in which nodes-array/doc?
bool isFrameAreaPositionValid() const
void SSize(const Size &rNew)
bool isFrameAreaSizeValid() const
static void lcl_Padded(OStringBuffer &rOut, const OString &s, size_t length)
static OUString lcl_CellText(const SwCellFrame *pFrame)
static void lcl_Start(OStringBuffer &rOut, OStringBuffer &rLay, DbgAction nAction)
enable indentation by two spaces during DbgAction::Start and disable it again at DbgAction::End.
static OString lcl_CellInfo(const SwCellFrame *pFrame)
SwTable is one table in the document model, containing rows (which contain cells).
static void lcl_FrameType(OStringBuffer &rOut, const SwFrame *pFrame)
output the type of the frame as plain text.
bool IsLayoutFrame() const
SvStream & ReadChar(char &rChar)
const SwStartNode * GetSttNd() const
SvStream & endl(SvStream &rStr)
#define SAL_INFO(area, stream)
bool IsNoTextFrame() const
void Top(const tools::Long nTop)
const SwModify * GetRegisteredIn() const
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm.hxx.
void Record_(const SwFrame *pFrame, PROT nFunction, DbgAction nAct, void *pParam)
Is only called if the PROTOCOL macro finds out, that this function should be recorded (...
static OString lcl_RowInfo(const SwRowFrame *pFrame)
SwNodeOffset Count() const
void FileInit()
read the file "dbg_lay.ini" in the current directory and evaluate it.
#define SAL_WARN(area, stream)
Ends a section of nodes in the document model.
const SwTableLine * GetTabLine() const
bool IsFootnoteContFrame() const
std::unique_ptr< SvFileStream > m_pStream
void Height(tools::Long nNew)
bool IsFooterFrame() const
std::unique_ptr< SwImplEnterLeave > pImpl
sal_uInt32 GetFrameId() const
SwCellFrame is one table cell in the document layout.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwRowFrame is one table row in the document layout.
bool IsHeaderFrame() const
Base class of the Writer document model elements.