109 #include <rtl/strbuf.hxx>
118 #if OSL_DEBUG_LEVEL > 1
119 static bool bFrameId =
false;
131 std::unique_ptr<std::set<sal_uInt16>>
144 static void SectFunc( OStringBuffer& rOut,
DbgAction nAct,
void const * pParam );
152 Record_(pFrame, nFunction, nAct, pParam);
184 , m_nFunction(nFunct)
190 virtual void Enter();
191 virtual void Leave();
203 , m_nFrameHeight(pF->getFrameArea().
Height())
207 virtual void Leave()
override;
212 sal_uInt16 m_nFrameId;
221 virtual void Enter()
override;
222 virtual void Leave()
override;
232 , m_aFrame(pF->getFrameArea())
236 virtual void Enter()
override;
237 virtual void Leave()
override;
327 rLine = rLine.toAsciiLowerCase();
328 rLine = rLine.replace(
'\t',
' ' );
329 if(
'#' == rLine[0] )
331 if(
'[' == rLine[0] )
333 OString aTmp = rLine.getToken(0,
']');
334 if (aTmp ==
"[frmid")
339 else if (aTmp ==
"[frmtype")
344 else if (aTmp ==
"[record")
349 else if (aTmp ==
"[test")
354 else if (aTmp ==
"[max")
359 else if (aTmp ==
"[var")
365 rLine = rLine.copy(aTmp.getLength() + 1);
372 OString aTok = rLine.getToken( 0,
' ', nIndex );
374 if( !aTok.isEmpty() &&
'!' == aTok[0] )
379 if( !aTok.isEmpty() )
381 sal_Int64 nVal = aTok.toInt64();
399 nOld |=
PROT(nVal & o3tl::typed_flags<PROT>::mask);
420 while ( nIndex >= 0 );
426 SvFileStream aStream(
"dbg_lay.ini", StreamMode::READ );
431 while( aStream.
good() )
435 if(
'\n' == c ||
'\r' == c )
437 aLine = aLine.trim();
438 if( !aLine.isEmpty() )
445 if( !aLine.isEmpty() )
461 if( rLay.getLength() > 1 )
463 rLay.remove(rLay.getLength() - 2, rLay.getLength());
474 rOut.append(
" ValidSize");
476 rOut.append(
" ValidPos");
478 rOut.append(
" ValidPrtArea");
482 static void lcl_Padded(OStringBuffer& rOut,
const OString& s,
size_t length)
484 if (sal_Int32(length) < s.getLength())
485 length = s.getLength();
487 for (
size_t i = 0;
i < length - s.getLength();
i++)
495 char sz[RTL_STR_MAX_VALUEOFINT64];
496 rtl_str_valueOfInt64(sz, n, 10);
510 rOut.append(
", Width:");
512 rOut.append(
", Height:");
528 if (pFrame ==
nullptr)
531 if (pTabLine ==
nullptr)
558 result +=
"Para:" + OUString::number(10) +
" " +
563 return OUString::number(n) +
" para(s):" + result;
576 rOut.append(
"SwTextFrame ");
580 rOut.append(
"SwPageFrame ");
582 rOut.append(
"SwColumnFrame ");
586 rOut.append(
"(Col)");
587 rOut.append(
"SwBodyFrame ");
590 rOut.append(
"SwRootFrame ");
592 rOut.append(
"SwCellFrame ");
594 rOut.append(
"SwTabFrame ");
596 rOut.append(
"SwRowFrame ");
598 rOut.append(
"SwSectionFrame ");
600 rOut.append(
"SwHeaderFrame ");
602 rOut.append(
"SwFooterFrame ");
604 rOut.append(
"SwFootnoteFrame ");
606 rOut.append(
"SwFootnoteContFrame ");
608 rOut.append(
"SwFlyFrame ");
610 rOut.append(
"SwLayoutFrame ");
613 rOut.append(
"SwNoTextFrame");
615 rOut.append(
"Not impl. ");
626 sal_uInt16 nSpecial = 0;
670 aOut.append(
"SwFlowFrame::MoveFwd");
672 aOut.append(
"SwFlowFrame::MoveBwd");
677 aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam)));
681 aOut.append(
"SwFrame::Grow (test)");
685 aOut.append(
"SwFrame::Shrink (test)");
693 aOut.append(
"SwFrame::Grow");
697 aOut.append(
"SwFrame::Shrink");
699 aOut.append(
"SwFrame::AdjustNeighbourhood");
705 aOut.append(static_cast<sal_Int64>(*static_cast<tools::Long*>(pParam)));
716 case PROT::Leaf: aOut.append(
"SwFrame::GetPrev/NextSctLeaf");
722 aOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
726 aOut.append(
"Initialize");
734 aOut.append(
"PROT::Cut from ");
736 aOut.append(
"PROT::Paste to ");
737 aOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
740 aOut.append(
"SwTextFrame::TestFormat");
752 aOut.append(
"PosChg: (");
753 aOut.append(static_cast<sal_Int64>(rFrame.
Left()));
755 aOut.append(static_cast<sal_Int64>(rFrame.
Top()));
756 aOut.append(
") -> (");
764 aOut.append(
"Height: ");
765 aOut.append(static_cast<sal_Int64>(rFrame.
Height()));
772 aOut.append(
"Width: ");
773 aOut.append(static_cast<sal_Int64>(rFrame.
Width()));
784 while (aOut.getLength() < 40) aOut.append(
" ");
788 while (aOut.getLength() < 90) aOut.append(
" ");
794 while (aOut.getLength() < 140) aOut.append(
" ");
795 const OUString&
text =
static_cast<const SwTextFrame*
>(pFrame)->GetText();
816 SAL_INFO(
"sw.layout.debug", aOut.getStr());
817 m_pStream->WriteOString(aOut.makeStringAndClear());
818 (*m_pStream) <<
endl;
822 SAL_WARN(
"sw.layout.debug",
"max number of lines reached");
834 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
840 rOut.append(
"Master to ");
842 rOut.append(
"Follow from ");
843 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
849 rOut.append(
"Master to ");
851 rOut.append(
"Follow from ");
852 rOut.append(static_cast<sal_Int64>(
lcl_GetFrameId(static_cast<SwFrame const *>(pParam))));
894 case PROT::Shrink :
pImpl.reset(
new SwSizeEnterLeave( pFrame, nFunc, nAct, pPar ) );
break;
896 case PROT::MoveBack :
pImpl.reset(
new SwUpperEnterLeave( pFrame, nFunc, nAct, pPar ) );
break;
921 void SwSizeEnterLeave::Leave()
923 m_nFrameHeight = m_pFrame->getFrameArea().Height() - m_nFrameHeight;
927 void SwUpperEnterLeave::Enter()
929 m_nFrameId = m_pFrame->GetUpper() ? sal_uInt16(
lcl_GetFrameId(m_pFrame->GetUpper())) : 0;
933 void SwUpperEnterLeave::Leave()
935 m_nFrameId = m_pFrame->GetUpper() ? sal_uInt16(
lcl_GetFrameId(m_pFrame->GetUpper())) : 0;
939 void SwFrameChangesLeave::Enter()
943 void SwFrameChangesLeave::Leave()
945 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_uLong GetIndex() const
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).
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.
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
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
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)
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.