hunspell: no need for autoreconf when not patching configure
[LibreOffice.git] / vcl / README
blob5a869ef77b9f41257bf10530e39c0ce9c0ebad4e
1 Visual Class Library is responsible for the widgets (windowing, buttons, controls, file-pickers etc.), operating system abstraction, including basic rendering (e.g. the output device).
3 It should not be confused with Borland's Visual Component Library, which is entirely unrelated.
5 VCL provides a graphical toolkit similar to gtk+, Qt, SWING etc.
7 source/
8         + the main cross-platform chunk of source
10 inc/
11         + cross-platform abstraction headers
13 headless/
14         + a backend renderer that draws to bitmaps
16 android/
17         + Android backend
19 osx/
20         + OS X backend
22 ios/
23         + iOS backend
25 quartz/
26         + code common to OS X and iOS
28 win/
29         + Windows backend
31 qt5/
32         + Qt5 (under construction)
34 unx/
35         + X11 backend and its sub-platforms
37         gtk/
38                 + GTK2 support
39         gtk3/
40                 + GTK3 support
41         kde4/
42                 + KDE4 support
43         kde5/
44                 + KDE5 support (under construction)
45         gtk3_kde5/
46                 + GTK3 support with KDE5 file pickers (until kde5 is finished)
47         generic/
48                 + raw X11 support
50                 plugadapt/
51                         + pluggable framework to select correct unx backend
53                 dtrans/
54                         + "data transfer" - clipboard handling
55                         + http://stackoverflow.com/questions/3261379/getting-html-source-or-rich-text-from-the-x-clipboard
56                           for tips how to show the current content of the
57                           clipboard
60 How the platform abstraction works
62         + InitVCL calls 'CreateSalInstance'
63                 + this is implemented by the compiled-in platform backend
64                 + it stores various bits of global state in the
65                   'SalData' (inc/saldatabasic.hxx) structure but:
66         + the SalInstance vtable is the primary outward facing gateway
67           API for platform backends
68                 + It is a factory for:
69                   SalFrames, SalVirtualDevices, SalPrinters,
70                   Timers, the SolarMutex, Drag&Drop and other
71                   objects, as well as the primary event loop wrapper.
73 Note: references to "SV" in the code mean StarView, which was a
74 portable C++ class library for GUIs, with very old roots, that was
75 developed by StarDivision. Nowadays it is not used by anything except
76 LibreOffice (and OpenOffice).
78 "svp" stands for "StarView Plugin".
80 == COM threading ==
82 The way COM is used in LO generally:
83 - vcl puts main thread into Single-threaded Apartment (STA)
84 - oslWorkerWrapperFunction() puts every thread spawned via oslCreateThread()
85   into MTA (free-threaded)
87 == GDIMetafile ==
89 GDIMetafile is a vector drawing representation that corresponds directly
90 to the SVM (StarView Metafile) format; it is extremely important as
91 an intermediate format in all sorts of drawing and printing operations.
93 There is a class MetafileXmlDump in include/test/mtfxmldump.hxx that
94 can store a GDIMetafile as XML, which makes debugging much easier
95 since you can just use "diff" to see changes.
97 To use it you need to link against "test" library and then (because
98 "test" is not part of the installation) run with:
99 LD_LIBRARY_PATH=workdir/LinkTarget/Library:workdir/UnpackedTarball/cppunit/src/cppunit/.libs instdir/program/soffice
101 == EMF+ ==
103 emf+ is vector file format used by MSO and is successor of wmf and
104 emf formats. see
105 http://msdn.microsoft.com/en-us/library/cc230724.aspx for
106 documentation. note that we didn't have this documentation from
107 start, so part of the code predates to the time when we had guessed
108 some parts and can be enhanced today. there also still many thing not
109 complete
111 emf+ is handled a bit differently compared to original emf/wmf files,
112 because GDIMetafile is missing features we need (mostly related to
113 transparency, argb colors, etc.)
115 emf/wmf is translated to GDIMetafile in import filter
116 vcl/source/filter/wmf and so special handling ends here
118 emf+ is encapsulated into GDIMetafile inside comment records and
119 parsed/rendered later, when it reaches cppcanvas. it is parsed and
120 rendered in cppcanvas/source/mtfrenderer. also note that there are
121 emf+-only and emf+-dual files. dual files contains both types of
122 records (emf and emf+) for rendering the images. these can used also
123 in applications which don't know emf+. in that case we must ignore
124 emf records and use emf+ for rendering. for more details see
125 documentation
127 parsing:
129  wmf/emf filter --> GDI metafile with emf+ in comments --> cppcanvas metafile renderer
131 lately the GDIMetafile rendering path changed which also influenced
132 emf+ rendering. now many things happen in drawing layer, where
133 GDIMetafile is translated into drawing layer primitives. for
134 metafiles with emf+ we let the mtfrenderer render them into bitmap
135 (with transparency) and use this bitmap in drawinlayer. cleaner
136 solution for current state would be to extend the drawing layer for
137 missing features and move parsing into drawing layer (might be quite
138 a lot of work). intermediary enhancement would be to know better the
139 needed size/resolution of the bitmap, before we render emf+ into
140 bitmap in drawing layer. Thorsten is working on the same problem with
141 svg rendering, so hopefully his approach could be extended for emf+ as
142 well. the places in drawing layer where we use canvas mtfrenderer to
143 render into bitmaps can be found when you grep for GetUseCanvas. also
144 look at vcl/source/gdi/gdimetafile.cxx where you can look for
145 UseCanvas again. moving the parsing into drawinglayer might also have
146 nice side effect for emf+-dual metafiles. in case the emf+ records
147 are broken, it would be easier to use the duplicit emf
148 rendering. fortunately we didn't run into such a broken emf+ file
149 yet. but there were already few cases where we first though that the
150 problem might be because of broken emf+ part. so far it always turned
151 out to be another problem.
153 rendering:
155  before
157  vcl --> cppcanvas metafile renderer --> vcl
159  now
161  drawing layer --> vcl --> cppcanvas metafile renderer --> vcl --> drawing layer
163 another interesting part is actual rendering into canvas bitmap and
164 using that bitmap later in code using vcl API.
166 EMF+ implementation has some extensive logging, best if you do a dbgutil
167 build, and then
169 export SAL_LOG=+INFO.cppcanvas.emf+INFO.vcl.emf
171 before running LibreOffice; it will give you lots of useful hints.
173 You can also fallback to EMF (from EMF+) rendering via
175 export EMF_PLUS_DISABLE=1
178 == Printing/PDF export ==
180 Printing from Writer works like this:
182 1) individual pages print by passing an appropriate OutputDevice to XRenderable
183 2) in drawinglayer, a VclMetafileProcessor2D is used to record everything on
184    the page (because the OutputDevice has been set up to record a GDIMetaFile)
185 3) the pages' GDIMetaFiles are converted to PDF by the vcl::PDFWriter
186    in vcl/source/gdi/pdfwriter*
188 Creating the ODF thumbnail for the first page works as above except step 3 is:
190 3) the GDIMetaFile is replayed to create the thumbnail
192 On-screen display differs in step 1 and 2:
194 1) the VCL Window gets invalidated somehow and paints itself
195 2) in drawinglayer, a VclPixelProcessor2D is used to display the content
198 === Debugging PDF export ===
200 Debugging the PDF export becomes much easier when
201 compression is disabled (so the PDF file is directly readable) and
202 the MARK function puts comments into the PDF file about which method
203 generated the following PDF content.
205 The compression can be disabled even using a env. var:
207 export VCL_DEBUG_DISABLE_PDFCOMPRESSION=1
209 To de-compress the contents of a PDF file written by a release build or
210 other programs, use the "pdfunzip" tool:
212 bin/run pdfunzip input.pdf output.pdf