Top Banner
How the Text in Writer Gets on the Screen? Jan Holesovsky <[email protected]>
14

How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

Jul 14, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

How the Text in WriterGets on the Screen?

Jan Holesovsky <[email protected]>

Page 2: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

2 / 14 Event Name | Your Name

It all starts with a draw request

● Window::ImplCallPaint(● const Region* pRegion,

– [can be more rectangles etc.]● sal_uInt16 nPaintFlags )

– [whether to paint children etc.]

Page 3: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

3 / 14 Event Name | Your Name

It gets to the Writer's edit window

● SwEditWin = Window class for the Writer edit area● handling mouse and keyboard events and 

doing the final painting of the document from the buffered layout. 

● SwEditWin::Paint(● const Rectangle& rRect)

– [rectangle to repaint]

Page 4: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

4 / 14 Event Name | Your Name

SwCrsrShell – ancestor of SwWrtShell

● SwWrtShell is used by the UI to modify the document model

● SwCrsrShell::Paint(● const Rectangle &rRect)

Page 5: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

5 / 14 Event Name | Your Name

SwViewShell – ancestor of SwCrsrShell

● SwViewShell::Paint(● const Rectangle &rRect)

● The “real” drawing starts here● Toplevel – draws the shadows around the 

document etc.● Very ugly, actually – part of the code in the 

class, part is global in the .cxx● Many OutputDevices out there, etc.

Page 6: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

6 / 14 Event Name | Your Name

Now we are getting to the document model

● SwRootFrm – the root element of a Writer document layout

● SwRootFrm::Paint(● SwRect const& rRect,

– Rectangle to paint● SwPrintData const*const pPrintData) const

– Gets NULL here

Page 7: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

7 / 14 Event Name | Your Name

Getting deeper into the model

● Calling hierarchically (more times in the backtrace)

● SwLayoutFrm::Paint(● SwRect const& rRect,● SwPrintData const*const) const

Page 8: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

8 / 14 Event Name | Your Name

Finally we got to the text frame

● SwTxtFrm::Paint(● SwRect const& rRect,● SwPrintData const*const) const

● We split the frame to lines

Page 9: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

9 / 14 Event Name | Your Name

And then split the line to portions

● SwTxtPainter::DrawTextLine(● const SwRect &rPaint

– [rectangle to paint]● SwSaveClip &rClip,

– [clipping]● const sal_Bool bUnderSz )

– [paint the entire line, or by portions?]

Page 10: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

10 / 14 Event Name | Your Name

And now “only” draw the portions

● SwTxtPortion::Paint(● const SwTxtPaintInfo &rInf ) const

● SwTxtPaintInfo::DrawText(● const SwLinePortion &rPor,● const sal_Int32 nLength,● const sal_Bool bKern ) const● [just a wrapper for the next one]

Page 11: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

11 / 14 Event Name | Your Name

“Just do it” kind of method

● SwTxtPaintInfo::_DrawText(● const OUString &rText,● const SwLinePortion &rPor,● const sal_Int32 nStart,● const sal_Int32 nLength,● const sal_Bool bKern,● const sal_Bool bWrong,● const sal_Bool bSmartTag,● const sal_Bool bGrammarCheck ) 

Page 12: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

12 / 14 Event Name | Your Name

Getting closer to actual drawing

● SwFont::_DrawText(● SwDrawTextInfo &rInf)● [just a wrapper]

● SwSubFont::_DrawText(● SwDrawTextInfo &rInf,● const sal_Bool bGrey )● [takes care of the underlining, etc.]

Page 13: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

13 / 14 Event Name | Your Name

Compute the positions of the glyphs

● SwFntObj::DrawText(● SwDrawTextInfo &rInf )

Page 14: How the Text in Writer Gets on the Screen? · 3 / 14 Event Name | Your Name It gets to the Writer's edit window SwEditWin = Window class for the Writer edit area handling mouse and

14 / 14 Event Name | Your Name

And finally – draw the text!

● OutputDevice::DrawTextArray(● const Point& rStartPt,● const OUString& rStr,● const sal_Int32* pDXAry,

– [offsets of the letters]● sal_Int32 nIndex,● sal_Int32 nLen )