Layercake: From UNO code to Writer Core

Slides:



Advertisements
Similar presentations
XSL XSLT and XPath 11-Apr-17.
Advertisements

How Tags are used to form your Web Page
Click to Add Title 0 Click to Add Subtitle To replace this photo with one of your own, go to the master page, delete this image, insert your own image,
DT211/3 Internet Application Development
Web Page Creation Part II ST: Introduction to Web Interface Design Prof. Angela Guercio.
Creating Buttons – Lesson 51 Creating Buttons Lesson 5.
HTML: Hyptertext Markup Language Doman’s Sections.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Creating XHTML Documents Essentials for.
HTML Basics BCIS 3680 Enterprise Programming. Web Client/Server Architecture 2  Your browser (the client) requests a Web page from a remote computer.
Active Standards – Q/A By Jeppe Pedersen and Alexander Karlsson 18/08/2015.
Project 6: Kayaking HTML5 Site
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
1 Preparation for site Create a folder in MyDocuments: beavercheese. Create a subfolder, images Classes, career, DW beginner Download.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
HTML HTML stands for Hyper Text Markup Language. HTML is used in making the base of a Website You can just use an online website maker like weebly.com.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Desktop Publishing Lesson 3 — Formatting Pages. Lesson 3 – Formatting Pages2 Objectives  Set up pages.  Set guides.  Use master pages.  Insert page.
Revised June 2008 Online PD Basic HTML1 Let’s Try It!  Open Notepad oStart > All Programs > Accessories > Notepad oDon’t get WordPad by mistake – won’t.
An Animated PowerPoint Template Staying on Track.
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
Made with OpenOffice.org 1 Beyond the Single Page Steve Oualline OpenOffice Writer.
Writing Import Filters for LibreOffice
Finally getting to html and CSS… Tim Berners-Lee, the writer of the software program that makes him the inventor of the WWW, defines the Internet as a.
Jacynthe Touchette, MSI JGH Health Sciences Library
Node.js Modules Header Mastering Node.js, Part 2 Eric W. Greene
Creating Visual Effects
Formatting a Research Paper
JSP: Actions elements and JSTL
Microsoft Office PowerPoint 2003
Customizing custom.
Introduction to HTML.
IGEM Wiki Workshop 11/05/2017.
Architecture Concept Documents
Learning the Basics – Lesson 1
Version control, using Git
Application images and atomic updates
Bibisect on Demand Bjoern Michaelsen
Finding out what is going on for beginners
Conference Presentation Template
Course Name: QTP Trainer: Laxmi Duration: 25 Hrs Session: Daily 1 Hr.
This would be the area for your title, which should be at least 72 ppi tall, which is equal to one inch (this is 87 points). This font is 72 ppi. If you.
This would be the area for your title Authors, authors authors Department of XXXXXXXXXXXX, University of North Dakota School of Medicine & Health Sciences.
Chapter 27 WWW and HTTP.
Contiki and Code Composer Studio
Formatting a Research Paper
This would be the area for your title, which should be at least 72 ppi tall, which is equal to one inch (this is 100 points). This font is 72 ppi. If.
PRESENTATION TITLE Optional second line Presented by:
Java Applets.
PRESENTATION TITLE PRESENTATION SUBTITLE
Chapter 10: File-System Interface
Teaching slides Chapter 6.
Files Management – The interfacing
jQuery Widgets: Tabs Requires core jQuery library + jQuery UI
Instructions BASIC POWERPOINT TEMPLATE FOOTERS
Animated PowerPoint Template
Carthage ios 8 onwards Dependency manager that streamlines the process of integrating the libraries into the project.
Chapter 1 Introducing Small Basic
External Style Sheets.
Chap 4. Programming Fundamentals
TITLE LEFT ALIGNED HERE ALL CAPS
SPL – PS1 Introduction to C++.
IS 135 Business Programming
TITLE LEFT ALIGNED HERE ALL CAPS
Plug-In Architecture Pattern
This would be the area for your title Authors, authors authors Department of XXXXXXXXXXXX, University of North Dakota School of Medicine & Health Sciences.
This would be the area for your title, which should be at least 72 ppi tall, which is equal to one inch (this is 87 points). This font is 72 ppi. If you.
This template is UND branded
This would be the area for your title, which should be at least 72 ppi tall, which is equal to one inch (this is 100 points). This font is 72 ppi. If.
Presentation transcript:

Layercake: From UNO code to Writer Core Bjoern Michaelsen Deputy Member, Board of Directors The Document Foundation Ubuntu LibreOffice package maintainer Canonical

Interfaces, Services and Implementations A quick race through some UNO concepts ...

Interfaces, Services and Implementations Interfaces say what you can do with a UNO-thing usually named com::sun::star... and then a name prefixed with X Services promise to provide a set of Interfaces and then a name not prefixed with X Implementations can provide a service or a set of Interfaces usually named … inconsistently have some some real core code behind it

XCargoStorage XTransport

Lorry service still abstract implements XTransport and XCargoStorage

Lorry implementation concrete implements a service has some real code behind it

UNO Runtime Reflection How to find out what kind of UNO thing you are holding ...

XInterface

XServiceInfo

The css.script.theServiceDocumenter singleton Getting to the UNO documentation from your extension or script quickly ...

TheServiceDocumenter.showServiceDocs(...) void showServiceDocs( [in] com::sun::star::lang::XServiceInfo xService ); opens documentation for all services supported by this implementation in a browser

TheServiceDocumenter.showInterfaceDocs(...) void showInterfaceDocs( [in] com::sun::star::lang::XTypeProvider xTypeProvider ); opens documentation for all interfaces (types) supported by this implementation in a browser

Example Ad-hoc StarBasic TheServiceDocumenter = GetDefaultContext().getValueByName( "/singletons/com.sun.star.util.theServiceDocumenter") ' old style reflection helpers MsgBox(TheServiceDocumenter.Dbg_Methods) MsgBox(TheServiceDocumenter.Dbg_Properties) MsgBox(TheServiceDocumenter.Dbg_SupportedInterfaces) ' using the Service Documenter TheServiceDocumenter.showServiceDocs(ThisComponent) 'TheServiceDocumenter.showInterfaceDocs(ThisComponent)

Hard Things There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. – Phil Karlton

Interfaces, Services, UNO Wrappers and Core Interfaces say what you can do with a UNO-thing usually named com::sun::star... and then a name prefixed with X Services promise to provide a set of Interfaces and then a name not prefixed with X UNO Wrappers (implementations) can provide a service or a set of Interfaces usually named … inconsistently call real core code behind it Core implementations do the real work and usually are older than UNO

Interfaces, Services, UNO Wrappers and Core core implementation UNO Wrapper Interfaces and Services

Writer Python Tests Directory sw/qa/python has the tests Makefile sw/PythonTest_sw_python triggers them So, to trigger them manually: make PythonTest_sw_python

Debugging Python Tests: symbols ./autogen.sh --enable-symbols && make make sw.clean && make sw DEBUG=T

Debugging Python Tests Callgrinding tests: VALGRIND=callgrind make PythonTest_sw_python ls -lh ./workdir/PythonTest/sw_python/done.core/ callgrind_annotate $FILE \ --inclusive=yes \ --threshold=100 \ | grep sw/source/core/unocore \ | head -10 Debugging into tests: CPPUNITTRACE="gdb --args" make PythonTest_sw_python

check_styles.py: callgrind 32,453,621 unostyle.cxx:sw::XStyleFamily::getByName(rtl::OUString const&) [libswlo.so] 23,155,924 unostyle.cxx:non-virtual thunk to sw::XStyleFamily::getByName(rtl::OUString const&) [libswlo.so] 11,395,863 unostyle.cxx:com::sun::star::uno::Reference<com::sun::star::style::XStyle> lcl_CreateStyle<(SfxStyleFamily)2>(SfxStyleSheetBasePool*, SwDocShell*, rtl::OUString const&) [libswlo.so] 11,132,842 unostyle.cxx:SwXStyle::SwXStyle(SfxStyleSheetBasePool*, SfxStyleFamily, SwDoc*, rtl::OUString const&) [libswlo.so] 10,673,960 unostyle.cxx:non-virtual thunk to sw::XStyleFamily::getElementNames() [libswlo.so]

check_styles.py: backtrace (gdb) bt #0 SwDocStyleSheet::PresetNameAndFamily (this=0x7fffe1544638, rName=...) at ...sw/source/uibase/app/docstyle.cxx:2209 #1 0x00007fffdccad7f8 in SwStyleSheetIterator::Next (this=0x1640780) at ...sw/source/uibase/app/docstyle.cxx:3098 #2 0x00007fffdccad6df in SwStyleSheetIterator::First (this=0x1640780) at ...sw/source/uibase/app/docstyle.cxx:3087 #3 0x00007fffdca9da6d in sw::XStyleFamily::getElementNames (this=0x7fffd6da5998) at ...sw/source/core/unocore/unostyle.cxx:873 #4 0x00007ffff1796907 in gcc3::callVirtualMethod (pThis=0x7fffd6da59c0, nVtableIndex=6, pRegisterReturn=0x7fffffff1d40, pReturnTypeRef=0x862ed0, bSimpleReturn=false, pStack=0x7fffffff1ab0, nStack=0, pGPR=0x7fffffff1bd0, pFPR=0x7fffffff1c00) at ...bridges/source/cpp_uno/gcc3_linux_x86- 64/callvirtualmethod.cxx:133

Interfaces, Services, UNO Wrappers and Core core implementation: SwDocStyleSheet, SwStyleSheetIterator UNO Wrapper: SwXStyleFamily Interfaces and Services: com::sun::star::text::Text::ParagraphStyle

check_table.py: callgrind 118,911,501 unotbl.cxx:SwXTextTable::getData() 109,031,858 unotbl.cxx:SwXCellRange::getData() 107,979,526 unotext.cxx:SwXText::getString() [libswlo.so] 101,504,055 unotbl.cxx:SwXCell::getValue() [libswlo.so] 88,469,311 unoobj.cxx:SwXTextCursor::getString() [libswlo.so]

check_table.py: backtrace #0 sw_GetTableBoxColStr (nCol=0, rNm=...) at ...sw/source/core/table/swtable.cxx:1793 #1 0x00007fffdc6e7526 in sw_GetCellName (nColumn=0, nRow=0) at ...sw/source/core/unocore/unotbl.cxx:522 #2 0x00007fffdc6e7955 in lcl_CreateXCell (pFormat=0x7fffd69cf000, nColumn=0, nRow=0) at ...sw/source/core/unocore/unotbl.cxx:584 #3 0x00007fffdc6f8846 in SwXCellRange::GetCells (this=0x7fffd69f4698) at ...sw/source/core/unocore/unotbl.cxx:3342 #4 0x00007fffdc570ccc in SwChartDataSequence::GetCells (this=0x7fffd7683210) at ...sw/source/core/unocore/unochart.cxx:2149 #5 0x00007fffdc5710af in SwChartDataSequence::getNumericalData (this=0x7fffd7683210) at ...sw/source/core/unocore/unochart.cxx:2184 #6 0x00007ffff1799907 in gcc3::callVirtualMethod (pThis=0x7fffd7683248, nVtableIndex=3, pRegisterReturn=0x7fffffff1e60, pReturnTypeRef=0x1636620, bSimpleReturn=false, pStack=0x7fffffff1bd0, nStack=0, pGPR=0x7fffffff1cf0, pFPR=0x7fffffff1d20) at ...bridges/source/cpp_uno/gcc3_linux_x86- 64/callvirtualmethod.cxx:133

Interfaces, Services, UNO Wrappers and Core core implementation: sw_GetTableBoxColString() UNO Wrapper: SwXCellRange Interfaces and Services Com::sun::star::text::XTextTable

Thank you! @Sweet5hark See you at the LibreOffice Conference in Brno 2016 Find out more at http://conference.libreoffice.org

Default Slide Example Here is space for your content … Some hints: Use the master pages being the basis for the default slides It would be useful to add your presentation title to the footer. Add it via Insert – Page Number … – Footer Use the LibreOffice Color Palette delivered with LibreOffice (libreoffice.soc)

Pre-defined Shapes Here are some pre-defined shapes for your convenience: copy the shapes, copy their formatting, or use the LibO styles. Green Dark Green Bright You may add your code examples, XML statements, or debug output here ;-) Blue Dark Blue Bright Orange Dark Orange Bright Purple Dark Purple Bright Yellow Dark Yellow Bright

Section Header Example You may add additional text here ...

XTypeProvider

WIP: using the css. script WIP: using the css.script.theServiceDocumenter singleton for finding core implementations Getting to the C++ documentation of your implementation from your extension or script quickly ...

clang, the Ultimate: best solution: leak the information with a clang plugin triggering on getImplementationName(..) There might be some cases where the implementation name is dynamically generated That likely a bad idea anyway, so fix that then (or worst case: fallback on the scripted solution via component files)

The old manual ways: ad-hoc: Just search for the implementation name on http://opengrok.libreoffice.org lots of clutter from testcode etc. though somewhat more reliable: finding implementation in .component files, then find the implemenation in the cxx files of that library best solution: leak the information with a clang plugin triggering on getImplementationName(..)

Example Ad-hoc StarBasic TheServiceDocumenter = GetDefaultContext().getValueByName( "/singletons/com.sun.star.util.theServiceDocumenter") ' old style reflection helpers MsgBox(TheServiceDocumenter.Dbg_Methods) MsgBox(TheServiceDocumenter.Dbg_Properties) MsgBox(TheServiceDocumenter.Dbg_SupportedInterfaces) ' using the Service Documenter TheServiceDocumenter.CoreBaseUrl = "http://people.canonical.com/~bjoern/implref/5.1/" TheServiceDocumenter.showCoreDocs(ThisComponent) WIP: only works for SwXTextDocument for now Opens http://docs.libreoffice.org/sw/html/classSwXTextDocument.html

Finding implementation via .component files for f in `git ls-tree -r --name-only HEAD|grep '.component$'` do grep 'implementation name' $f|nl -s ",$f," done > componentgrep.csv In the second row, we then find the path of the component file In the third row, we then find the implemenation name thus we can find the ${module}/Library_${libname}.mk for each implementation and the cxx files where it could be implemented f

How should the Core Documentation Reference work in the end? It just opens “{$CoreBaseUrl}/{$ImplementationName}” in a browser and the URLs at ${CoreBaseUrl} are just statically generated redirects to http://docs.libreoffice.org (possibly we could also link to github or opengrok) later